联调检测脚本页面

This commit is contained in:
GGJ
2025-02-19 16:54:54 +08:00
parent d28669e6b0
commit 8caf856d2d
12 changed files with 543 additions and 240 deletions

View File

@@ -31,22 +31,31 @@
:cell-style="tableStyle.cellStyle"
:header-cell-style="{ textAlign: 'center', backgroundColor: '#003078', color: '#fff' }"
@cell-click="handleRowClick"
:key="key"
>
<el-table-column prop="name" label="相别" width="60" align="center" />
<el-table-column prop="frequency" label="电压/电流" align="center" width="60" />
<el-table-column prop="L1" label="值" width="180" align="center">
<template #default="{ row, $index }">
<span>
{{ row.frequency === 'V' ? '电压' : '电流' }}{{ form.channelList[$index].fAmp
}}{{ valueCode == 'Absolute' ? (row.frequency === 'V' ? 'V' : 'A') : '%' }} 相角{{
form.channelList[$index].fPhase
{{ row.type === 'V' ? '电压' : '电流' }}{{ form.channelList[$index].famp
}}{{ valueCode == 'Absolute' ? (row.type === 'V' ? 'V' : 'A') : '%' }} 相角{{
form.channelList[$index].fphase
}}°
</span>
</template>
</el-table-column>
<el-table-column label="操作" width="85">
<template #default="{ row, $index }">
<el-button type="primary" v-if="$index != 4" link :icon="CopyDocument">复制</el-button>
<el-button
type="primary"
v-if="$index != 4"
link
:icon="CopyDocument"
@click="copyRow($index)"
>
复制
</el-button>
</template>
</el-table-column>
<el-table-column label="操作" align="center">
@@ -88,7 +97,7 @@
<div class="form-item-container">
<el-form-item label="频率:" prop="name">
<div class="input-label-container">
<el-input type="number" style="width: 100px" v-model="form.fFreq" />
<el-input type="number" style="width: 100px" v-model="form.ffreq" />
<label>Hz</label>
</div>
</el-form-item>
@@ -121,12 +130,12 @@
</el-tabs>
</div>
<SetValueTable ref="setValueTable" />
<SetValueTable ref="setValueTableRef" />
<template #footer>
<div>
<el-button @click="close()"> </el-button>
<el-button type="primary" @click="save()">保存</el-button>
<el-button type="primary" @click="save">保存</el-button>
</div>
</template>
</el-dialog>
@@ -159,26 +168,27 @@ const props = defineProps({
required: true
},
formContent: {
type: Object,
type: [Object, Array],
required: true
}
})
console.log(`123`, props.formContent)
const key = ref(0)
// let valueType
const form: any = ref(scriptForm)
const childForm: any = ref([])
const ScriptValueType = ref('')
const setValueTableRef = ref()
const dialogVisible = ref(false)
const dialogTitle = ref()
const valueCode = ref() //Absolute绝对值
const valueCode = ref('') //Absolute绝对值
const tableData = [
{ name: 'L1', frequency: 'V', electricity: 0, fPhase: 0, sort: 0 },
{ name: 'L1', frequency: 'I', electricity: 0, fPhase: 0, sort: 0 },
{ name: 'L2', frequency: 'V', electricity: 0, fPhase: 0, sort: 1 },
{ name: 'L2', frequency: 'I', electricity: 0, fPhase: 0, sort: 1 },
{ name: 'L3', frequency: 'V', electricity: 0, fPhase: 0, sort: 2 },
{ name: 'L3', frequency: 'I', electricity: 0, fPhase: 0, sort: 2 }
{ name: 'L1', frequency: 'Ua', type: 'V', electricity: 0, fphase: 0, sort: 0 },
{ name: 'L1', frequency: 'Ia', type: 'I', electricity: 0, fphase: 0, sort: 0 },
{ name: 'L2', frequency: 'Ub', type: 'V', electricity: 0, fphase: 0, sort: 1 },
{ name: 'L2', frequency: 'Ib', type: 'I', electricity: 0, fphase: 0, sort: 1 },
{ name: 'L3', frequency: 'Uc', type: 'V', electricity: 0, fphase: 0, sort: 2 },
{ name: 'L3', frequency: 'Ic', type: 'I', electricity: 0, fphase: 0, sort: 2 }
]
const subType = ref('')
const tabChildren: any = ref([])
@@ -226,19 +236,26 @@ const close = () => {
// 保存数据
const save = () => {
console.log('🚀 ~ save ~ form.value:', form.value)
// dialogVisible.value = false
form.value.subType = subType.value
form.value.label = tabChildren.value.filter((item: any) => item.code == subType.value)[0].label
let copyForm = JSON.parse(JSON.stringify(form.value))
copyForm.channelList.forEach((channel: any) => {
// 筛选出 fAmp 和 fPhase 不同时为 0 的对象
channel.harmList = channel.harmList.filter((item: any) => item.fAmp !== 0 || item.fPhase !== 0)
// 筛选出 famp 和 fphase 不同时为 0 的对象
channel.harmList = channel.harmList.filter((item: any) => item.famp !== 0 || item.fphase !== 0)
channel.inHarmList = channel.inHarmList.filter(
(item: any) => item.inharm !== 0 || item.famp !== 0 || item.fphase !== 0
)
})
console.log('🚀 ~ save ~ form.value:', copyForm)
addScriptDtls({ ...copyForm, scriptId: props.formContent.id, scriptType: props.activeName }).then(res => {
if (res.code === 'A0000') {
ElMessage.success({ message: res.message })
dialogVisible.value = false
emit('addTab', form.value)
}
})
addScriptDtls({ ...copyForm, id: props.formContent.id }).then(res => {})
// emit('addTab', form.value)
}
@@ -255,10 +272,22 @@ const open = (sign: string, row: any) => {
.getDictData('Script_Value_Type')
.filter(item => item.id == props.formContent.valueType)[0].code
}
// 复制
const copyRow = (index: number) => {
scriptForm.channelList[index + 2] = JSON.parse(JSON.stringify(scriptForm.channelList[index]))
scriptForm.channelList[index + 3] = JSON.parse(JSON.stringify(scriptForm.channelList[index + 1]))
scriptForm.channelList[index].channelType == 'Ua'
? (scriptForm.channelList[index + 2].channelType = 'Ub')
: (scriptForm.channelList[index + 2].channelType = 'Uc')
scriptForm.channelList[index + 1].channelType == 'Ia'
? (scriptForm.channelList[index + 3].channelType = 'Ib')
: (scriptForm.channelList[index + 3].channelType = 'Ic')
key.value += 1
}
// 打开 drawer(新增、编辑)
const openDialog = () => {
setValueTable.value?.open()
setValueTableRef.value?.open()
}
// 对外映射