This commit is contained in:
caozehui
2025-01-02 20:27:36 +08:00
parent 410cd53e51
commit 8a5bcca901
3 changed files with 220 additions and 134 deletions

View File

@@ -24,9 +24,9 @@ export const getFormData = (params: {
export const getTreeData = (params: { export const getTreeData = (params: {
scriptId: string, scriptId: string,
deviceId: string, deviceId: string,
chnNum: string, devNum: string,
scriptType: string | null, scriptType: string | null,
flag: number code: string
}) => { }) => {
return http.post("/result/treeData/", params, {loading: false}); return http.post("/result/treeData/", params, {loading: false});
} }

View File

@@ -79,7 +79,7 @@ import DataCheckRawDataTable from './dataCheckRawDataTable.vue'
import {CheckData} from "@/api/check/interface"; import {CheckData} from "@/api/check/interface";
import {useDictStore} from "@/stores/modules/dict"; import {useDictStore} from "@/stores/modules/dict";
import {useCheckStore} from "@/stores/modules/check"; import {useCheckStore} from "@/stores/modules/check";
import {getFormData, getTreeData, getTableData} from "@/api/check/test"; import {getFormData, getTreeData} from "@/api/check/test";
const {appendToBody} = withDefaults(defineProps<{ const {appendToBody} = withDefaults(defineProps<{
appendToBody: boolean appendToBody: boolean
@@ -156,92 +156,101 @@ const handleSwitchChange = async (data: any) => {
if (data === 0) { if (data === 0) {
// 发起请求,查询该测试项的检测结果 // 发起请求,查询该测试项的检测结果
// const result = await getTreeData({scriptId:checkStore.scriptId,deviceId, chnNum: formContent.chnNum+'', scriptType,0}) const {data: treeDataTemp} = await getTreeData({
treeDataUnqualified = [{ scriptId: checkStore.scriptId,
"scriptName": "频率准确度检测", deviceId,
"children": [ devNum: formContent.chnNum + '',
{ scriptType,
"scriptName": "电压对频率测量的影响", code: checkStore.planCode
"children": [ })
{ treeDataUnqualified = []
"scriptName": "输入:频率 50.05Hz Ua =10%Un...", //filterTree(treeDataTemp,2)
"scriptType": '2346adafdf' //treeDataUnqualified=treeDataTemp
}, // treeDataUnqualified = [{
{ // "scriptName": "频率准确度检测",
"scriptName": "输入:频率 51.05Hz Ua =10%Un...", // "children": [
"scriptType": '1246adaafdf' // {
}, // "scriptName": "电压对频率测量的影响",
{ // "children": [
"scriptName": "输入:频率 52.05Hz Ua =10%Un...", // {
"scriptType": '2136ada3fdf' // "scriptName": "输入:频率 50.05Hz Ua =10%Un...",
} // "scriptType": '2346adafdf'
] // },
}, // {
{ // "scriptName": "输入:频率 51.05Hz Ua =10%Un...",
"scriptName": "谐波对频率测量的影响", // "scriptType": '1246adaafdf'
"children": [ // },
{ // {
"scriptName": "输入:频率 50.05Hz Ua =100%Un...", // "scriptName": "输入:频率 52.05Hz Ua =10%Un...",
"scriptType": '234246adafdf' // "scriptType": '2136ada3fdf'
} // }
] // ]
} // },
] // {
}] // "scriptName": "谐波对频率测量的影响",
// "children": [
// {
// "scriptName": "输入:频率 50.05Hz Ua =100%Un...",
// "scriptType": '234246adafdf'
// }
// ]
// }
// ]
// }]
} else { } else {
// 发起请求,查询该测试项的检测结果 // 发起请求,查询该测试项的检测结果
// const result = await getTreeData({scriptId:checkStore.scriptId,deviceId, chnNum: formContent.chnNum+'', scriptType,1}) // const {data:treeDataAll} = await getTreeData({scriptId:checkStore.scriptId,deviceId, devNum: formContent.chnNum+'', scriptType,code:checkStore.planCode})
treeDataAll = [ treeDataAll = []
{ // treeDataAll = [
"scriptName": "频率准确度检测", // {
"children": [ // "scriptName": "频率准确度检测",
{ // "children": [
"scriptName": "额定工作条件下的检测", // {
"children": [ // "scriptName": "额定工作条件下的检测",
{ // "children": [
"scriptName": "输入:频率 42.5Hz...", // {
"scriptType": '2246ada2fdf' // "scriptName": "输入:频率 42.5Hz...",
}, // "scriptType": '2246ada2fdf'
{ // },
"scriptName": "输入:频率 50.0Hz...", // {
"scriptType": '2246a3dafdf' // "scriptName": "输入:频率 50.0Hz...",
}, // "scriptType": '2246a3dafdf'
{ // },
"scriptName": "输入:频率 50.05Hz....", // {
"scriptType": '22246adafdf' // "scriptName": "输入:频率 50.05Hz....",
} // "scriptType": '22246adafdf'
] // }
}, // ]
{ // },
"scriptName": "电压对频率测量的影响", // {
"children": [ // "scriptName": "电压对频率测量的影响",
{ // "children": [
"scriptName": "输入:频率 50.05Hz Ua =10%Un...", // {
"scriptType": '224a6adafdf' // "scriptName": "输入:频率 50.05Hz Ua =10%Un...",
}, // "scriptType": '224a6adafdf'
{ // },
"scriptName": "输入:频率 51.05Hz Ua =10%Un...", // {
"scriptType": '2246aadafdf' // "scriptName": "输入:频率 51.05Hz Ua =10%Un...",
}, // "scriptType": '2246aadafdf'
{ // },
"scriptName": "输入:频率 52.05Hz Ua =10%Un...", // {
"scriptType": '2246adaffdf' // "scriptName": "输入:频率 52.05Hz Ua =10%Un...",
} // "scriptType": '2246adaffdf'
] // }
}, // ]
{ // },
"scriptName": "谐波对频率测量的影响", // {
"children": [ // "scriptName": "谐波对频率测量的影响",
{ // "children": [
"scriptName": "输入:频率 50.05Hz Ua =100%Un...", // {
"scriptType": '2246aadafdf' // "scriptName": "输入:频率 50.05Hz Ua =100%Un...",
} // "scriptType": '2246aadafdf'
] // }
} // ]
] // }
} // ]
] // }
// ]
} }
defaultOperate() defaultOperate()
@@ -256,9 +265,15 @@ const defaultOperate = () => {
} else { } else {
node = getDefaultNode(treeDataAll) node = getDefaultNode(treeDataAll)
} }
currentScriptDsc.value = node?.scriptName if (node) {
checkedScriptType.value = node?.scriptType currentScriptDsc.value = node.scriptName
defaultExpandedKeys = [node?.scriptType] checkedScriptType.value = node.scriptType
defaultExpandedKeys = [node.scriptType]
} else {
currentScriptDsc.value = ''
checkedScriptType.value = ''
defaultExpandedKeys = []
}
} }
const updateTableData = async () => { const updateTableData = async () => {
@@ -423,6 +438,7 @@ const open = async (_deviceId: string, chnNum: string, _scriptType: string | nul
// {value: '3', label: '1'}, // {value: '3', label: '1'},
// {value: '4', label: '0'}], // {value: '4', label: '0'}],
// } // }
chnList = resFormContent.chnList.map(item => ({ chnList = resFormContent.chnList.map(item => ({
value: item.value, value: item.value,
label: item.label == '1' ? `${item.value}` : `${item.value}(不符合)` label: item.label == '1' ? `${item.value}` : `${item.value}(不符合)`
@@ -438,6 +454,8 @@ const open = async (_deviceId: string, chnNum: string, _scriptType: string | nul
visible.value = true; visible.value = true;
// console.log(filterTree(treeD, 1))
} }
const close = () => { const close = () => {
@@ -476,6 +494,74 @@ const getDefaultNode = (data: any[]) => {
return findFirstLeafNode(firstElement); return findFirstLeafNode(firstElement);
} }
// let treeD: any = [{
// "scriptTypeName": "暂态",
// "sort": null,
// "fly": null,
// "children": [
// {
// "scriptTypeName": "额定工作条件下的测量1",
// "sort": null,
// "fly": null,
// "children": [
// {
// "scriptTypeName": "输入:频率=50.0Hz Ua=100.0%Un Ub=100.0%Un Uc=100.0%Un Ia=100.0%In Ib=100.0%In Ic=100.0%In 暂态 A相(暂态深度=null% 暂态持续时间=null%) B相(暂态深度=null% 暂态持续时间=null%) C相(暂态深度=null% 暂态持续时间=null%) ",
// "sort": 81,
// "fly": 1,
// "children": null
// },
// {
// "scriptTypeName": "输入:频率=45.0Hz Ua=100.0%Un Ub=100.0%Un Uc=100.0%Un Ia=100.0%In Ib=100.0%In Ic=100.0%In 暂态 A相(暂态深度=null% 暂态持续时间=null%) B相(暂态深度=null% 暂态持续时间=null%) C相(暂态深度=null% 暂态持续时间=null%) ",
// "sort": 81,
// "fly": 0,
// "children": null
// }
// ]
// },
// {
// "scriptTypeName": "额定工作条件下的测量2",
// "sort": null,
// "fly": null,
// "children": [
// {
// "scriptTypeName": "输入:频率=50.0Hz Ua=100.0%Un Ub=100.0%Un Uc=100.0%Un Ia=100.0%In Ib=100.0%In Ic=100.0%In 暂态 A相(暂态深度=null% 暂态持续时间=null%) B相(暂态深度=null% 暂态持续时间=null%) C相(暂态深度=null% 暂态持续时间=null%) ",
// "sort": 81,
// "fly": 1,
// "children": null
// },
// {
// "scriptTypeName": "输入:频率=45.0Hz Ua=100.0%Un Ub=100.0%Un Uc=100.0%Un Ia=100.0%In Ib=100.0%In Ic=100.0%In 暂态 A相(暂态深度=null% 暂态持续时间=null%) B相(暂态深度=null% 暂态持续时间=null%) C相(暂态深度=null% 暂态持续时间=null%) ",
// "sort": 81,
// "fly": 0,
// "children": null
// }
// ]
// }
// ]
// }]
// fly: 1合格 2不合格 4数据错误
const filterTree = (treeData: any[], fly: number): any[] => {
if (!treeData || treeData.length === 0) {
return []
}
filter(treeData, fly)
return treeData
}
const filter = (treeData: any[], fly: number) => {
for (let i = 0; i < treeData.length; i++) {
let node = treeData[i]
if (node && node.fly !== fly) {
if (node.children && node.children.length > 0) {
filter(node.children, fly)
} else {
treeData.splice(i, 1)
}
}
}
}
defineExpose({ defineExpose({
open open
}) })

View File

@@ -412,11 +412,11 @@ watch(webMsgSend, function (newValue, oldValue) {
startTimer() startTimer()
} }
break; break;
case 'VOL_Start': case 'V_Start':
updateCheckResultView("V", true) updateCheckResultView("V", true)
updateLog(true) updateLog(true)
break; break;
case 'VOL_End': case 'V_End':
updateCheckResultView("V", false) updateCheckResultView("V", false)
updateLog(false) updateLog(false)
updatePercentage() updatePercentage()
@@ -425,11 +425,11 @@ watch(webMsgSend, function (newValue, oldValue) {
startTimer() startTimer()
} }
break; break;
case 'Harm_V_Start': case 'HV_Start':
updateCheckResultView("HV", true) updateCheckResultView("HV", true)
updateLog(true) updateLog(true)
break; break;
case 'Harm_V_End': case 'HV_End':
updateCheckResultView("HV", false) updateCheckResultView("HV", false)
updateLog(false) updateLog(false)
updatePercentage() updatePercentage()
@@ -438,11 +438,11 @@ watch(webMsgSend, function (newValue, oldValue) {
startTimer() startTimer()
} }
break; break;
case 'Harm_I_Start': case 'HI_Start':
updateCheckResultView("HI", true) updateCheckResultView("HI", true)
updateLog(true) updateLog(true)
break; break;
case 'Harm_I_End': case 'HI_End':
updateCheckResultView("HI", false) updateCheckResultView("HI", false)
updateLog(false) updateLog(false)
updatePercentage() updatePercentage()
@@ -451,11 +451,11 @@ watch(webMsgSend, function (newValue, oldValue) {
startTimer() startTimer()
} }
break; break;
case 'Harm_P_Start': case 'HP_Start':
updateCheckResultView("HP", true) updateCheckResultView("HP", true)
updateLog(true) updateLog(true)
break; break;
case 'Harm_P_End': case 'HP_End':
updateCheckResultView("HP", false) updateCheckResultView("HP", false)
updateLog(false) updateLog(false)
updatePercentage() updatePercentage()
@@ -464,11 +464,11 @@ watch(webMsgSend, function (newValue, oldValue) {
startTimer() startTimer()
} }
break; break;
case 'InHarm_V_Start': case 'HSV_Start':
updateCheckResultView("HSV", true) updateCheckResultView("HSV", true)
updateLog(true) updateLog(true)
break; break;
case 'InHarm_V_End': case 'HSV_End':
updateCheckResultView("HSV", false) updateCheckResultView("HSV", false)
updateLog(false) updateLog(false)
updatePercentage() updatePercentage()
@@ -477,11 +477,11 @@ watch(webMsgSend, function (newValue, oldValue) {
startTimer() startTimer()
} }
break; break;
case 'InHarm_I_Start': case 'HSI_Start':
updateCheckResultView("HSI", true) updateCheckResultView("HSI", true)
updateLog(true) updateLog(true)
break; break;
case 'InHarm_I_End': case 'HSI_End':
updateCheckResultView("HSI", false) updateCheckResultView("HSI", false)
updateLog(false) updateLog(false)
updatePercentage() updatePercentage()
@@ -490,11 +490,11 @@ watch(webMsgSend, function (newValue, oldValue) {
startTimer() startTimer()
} }
break; break;
case 'Dip_Start': case 'VOLTAGE_Start':
updateCheckResultView("VOLTAGE", true) updateCheckResultView("VOLTAGE", true)
updateLog(true) updateLog(true)
break; break;
case 'Dip_End': case 'VOLTAGE_End':
updateCheckResultView("VOLTAGE", false) updateCheckResultView("VOLTAGE", false)
updateLog(false) updateLog(false)
updatePercentage() updatePercentage()
@@ -503,11 +503,11 @@ watch(webMsgSend, function (newValue, oldValue) {
startTimer() startTimer()
} }
break; break;
case 'CUR_Start': case 'I_Start':
updateCheckResultView("I", true) updateCheckResultView("I", true)
updateLog(true) updateLog(true)
break; break;
case 'CUR_End': case 'I_End':
updateCheckResultView("I", false) updateCheckResultView("I", false)
updateLog(false) updateLog(false)
updatePercentage() updatePercentage()
@@ -516,11 +516,11 @@ watch(webMsgSend, function (newValue, oldValue) {
startTimer() startTimer()
} }
break; break;
case 'MSQI_U_Start': case 'IMBV_Start':
updateCheckResultView("IMBV", true) updateCheckResultView("IMBV", true)
updateLog(true) updateLog(true)
break; break;
case 'MSQI_U_End': case 'IMBV_End':
updateCheckResultView("IMBV", false) updateCheckResultView("IMBV", false)
updateLog(false) updateLog(false)
updatePercentage() updatePercentage()
@@ -529,11 +529,11 @@ watch(webMsgSend, function (newValue, oldValue) {
startTimer() startTimer()
} }
break; break;
case 'MSQI_I_Start': case 'IMBA_Start':
updateCheckResultView("IMBA", true) updateCheckResultView("IMBA", true)
updateLog(true) updateLog(true)
break; break;
case 'MSQI_I_End': case 'IMBA_End':
updateCheckResultView("IMBA", false) updateCheckResultView("IMBA", false)
updateLog(false) updateLog(false)
updatePercentage() updatePercentage()
@@ -542,11 +542,11 @@ watch(webMsgSend, function (newValue, oldValue) {
startTimer() startTimer()
} }
break; break;
case 'Flicker_Start': case 'F_Start':
updateCheckResultView("F", true) updateCheckResultView("F", true)
updateLog(true) updateLog(true)
break; break;
case 'Flicker_End': case 'F_End':
updateCheckResultView("F", false) updateCheckResultView("F", false)
updateLog(false) updateLog(false)
updatePercentage() updatePercentage()
@@ -969,132 +969,132 @@ const startTimer = () => {
break; break;
case 2: case 2:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'VOL_Start', requestId: 'V_Start',
params: {} params: {}
}) })
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'VOL_End', requestId: 'V_End',
params: {} params: {}
}) })
}, 2000); }, 2000);
break; break;
case 3: case 3:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Harm_V_Start', requestId: 'HV_Start',
params: {} params: {}
}) })
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Harm_V_End', requestId: 'HV_End',
params: {} params: {}
}) })
}, 2000) }, 2000)
break; break;
case 4: case 4:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Harm_I_Start', requestId: 'HI_Start',
params: {} params: {}
}) })
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Harm_I_End', requestId: 'HI_End',
params: {} params: {}
}) })
}, 2000) }, 2000)
break; break;
case 5: case 5:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Harm_P_Start', requestId: 'HP_Start',
params: {} params: {}
}) })
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Harm_P_End', requestId: 'HP_End',
params: {} params: {}
}) })
}, 2000) }, 2000)
break; break;
case 6: case 6:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'InHarm_V_Start', requestId: 'HSV_Start',
params: {} params: {}
}) })
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'InHarm_V_End', requestId: 'HSV_End',
params: {} params: {}
}) })
}, 2000) }, 2000)
break; break;
case 7: case 7:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'InHarm_I_Start', requestId: 'HSI_Start',
params: {} params: {}
}) })
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'InHarm_I_End', requestId: 'HSI_End',
params: {} params: {}
}) })
}, 2000) }, 2000)
break; break;
case 8: case 8:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Dip_Start', requestId: 'VOLTAGE_Start',
params: {} params: {}
}) })
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Dip_End', requestId: 'VOLTAGE_End',
params: {} params: {}
}) })
}, 2000) }, 2000)
break; break;
case 9: case 9:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'CUR_Start', requestId: 'I_Start',
params: {} params: {}
}) })
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'CUR_End', requestId: 'I_End',
params: {} params: {}
}) })
}, 2000) }, 2000)
break; break;
case 10: case 10:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'MSQI_U_Start', requestId: 'IMBV_Start',
params: {} params: {}
}) })
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'MSQI_U_End', requestId: 'IMBV_End',
params: {} params: {}
}) })
}, 2000) }, 2000)
break; break;
case 11: case 11:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'MSQI_I_Start', requestId: 'IMBA_Start',
params: {} params: {}
}) })
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'MSQI_I_End', requestId: 'IMBA_End',
params: {} params: {}
}, 2000) }, 2000)
}) })
break; break;
case 12: case 12:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Flicker_Start', requestId: 'F_Start',
params: {} params: {}
}) })
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'Flicker_End', requestId: 'F_End',
params: {} params: {}
}) })
}, 2000) }, 2000)