优化检测脚本页面

录入检测脚本
This commit is contained in:
GGJ
2025-02-27 08:41:33 +08:00
parent 8b2cda80b1
commit 0bae200241
11 changed files with 924 additions and 334 deletions

View File

@@ -24,6 +24,7 @@
<Commun
:activeName="activeName"
:formContent="props.formContent"
:options="props.options"
style="width: 400px"
:disabled="tab.children.length == 0 ? false : true"
ref="communRef"
@@ -65,36 +66,50 @@
>
<template #default="{ row }">
<table class="tableL">
<tr>
<td class="theFirst">V</td>
<td>
{{
'电压=' +
row.channelList[item.num]?.famp +
(valueCode == 'Absolute' ? 'V' : '%')
}}
</td>
<td>
{{ '相角=' + row.channelList[item.num]?.fphase + '°' }}
</td>
</tr>
<tr>
<td class="theFirst">I</td>
<td>
{{
'电流=' +
row.channelList[item.num + 1]?.famp +
(valueCode == 'Absolute' ? 'V' : '%')
}}
</td>
<td>
{{
'相角=' +
row.channelList[item.num + 1]?.fphase +
'°'
}}
</td>
</tr>
<tbody>
<tr>
<td class="theFirst">V</td>
<td>
{{
row.channelList[item.num].famp == null
? '/'
: '电压=' +
row.channelList[item.num]?.famp +
(valueCode == 'Absolute' ? 'V' : '%')
}}
</td>
<td>
{{
row.channelList[item.num].fphase == null
? '/'
: '相角=' +
row.channelList[item.num].fphase +
'°'
}}
</td>
</tr>
<tr>
<td class="theFirst">I</td>
<td>
{{
row.channelList[item.num + 1].famp == null
? '/'
: '电流=' +
row.channelList[item.num + 1].famp +
(valueCode == 'Absolute' ? 'V' : '%')
}}
</td>
<td>
{{
row.channelList[item.num + 1].fphase == null
? '/'
: '相角=' +
row.channelList[item.num + 1].fphase +
'°'
}}
</td>
</tr>
</tbody>
</table>
</template>
</el-table-column>
@@ -181,6 +196,7 @@ import { CheckData } from '@/api/check/interface'
import { dlsDetails, deleteDtls, updateDtls, addScriptDtls, checkDataList } from '@/api/device/testScript'
import { useDictStore } from '@/stores/modules/dict'
import { useHandleData } from '@/hooks/useHandleData'
import { scriptDtlsCheckDataList } from '@/api/device/testScript/index'
interface TabOption {
label?: string
name?: string
@@ -273,9 +289,15 @@ const getCommunication = () => {
const tabChange = () => {
if (copyActiveName.value != activeName.value) {
copyActiveName.value == activeName.value
childActiveName.value = ''
childActiveName.value =
tabData.value.filter((item: any) => item.value == activeName.value)[0]?.children[0]?.value || ''
if (
tabData.value
.filter((item: any) => item.value == activeName.value)[0]
?.children.filter((item: any) => item.value == childActiveName.value).length == 0
) {
childActiveName.value =
tabData.value.filter((item: any) => item.value == activeName.value)[0]?.children[0]?.value || ''
}
}
inquireTable()
}
@@ -308,10 +330,26 @@ const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> =
}, 0)
}
// 复制
const copyRow = (row: any) => {
const copyRow = async (row: any) => {
let checkDataList: any = []
await communRef.value[0]?.getData().forEach((item: any) => {
item.children.forEach((k: any) => {
if (k.enable != 0 || k.errorFlag != 0) {
checkDataList.push({
pid: k.pid,
valueType: k.id,
dataType: k.dataType,
enable: k.enable,
errorFlag: k.errorFlag
})
}
})
})
let { data } = await scriptDtlsCheckDataList({ checkDataList: checkDataList, ...row, retryCompute: true })
let copyRow = JSON.parse(JSON.stringify(row))
delete copyRow.index
addScriptDtls({ ...copyRow, scriptType: activeName.value }).then(res => {
await addScriptDtls({ ...copyRow, scriptType: activeName.value, checkDataList: data }).then(res => {
if (res.code === 'A0000') {
ElMessage.success({
message: '复制成功!',