From de5548bbbd6bc3823e0e91291e56bef4b3ee577b Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Wed, 8 Jan 2025 09:46:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataCheckSingleChannelSingleTestPopup.vue | 6 +-- frontend/src/views/home/components/test.vue | 48 +++++++++++-------- 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue b/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue index b55540c..5c1d71d 100644 --- a/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue +++ b/frontend/src/views/home/components/dataCheckSingleChannelSingleTestPopup.vue @@ -249,9 +249,9 @@ const defaultOperate = () => { currentDesc.value = node.sourceDesc checkIndex.value = node.index defaultExpandedKeys = [node.index] - // nextTick(() => { - // treeRef.value?.setCurrentKey(node.index); - // }); + + treeRef.value?.setCurrentKey(node.index); + } else { currentScriptTypeName.value = '' currentDesc.value = '' diff --git a/frontend/src/views/home/components/test.vue b/frontend/src/views/home/components/test.vue index 9fbca1e..bdd116f 100644 --- a/frontend/src/views/home/components/test.vue +++ b/frontend/src/views/home/components/test.vue @@ -70,7 +70,7 @@ :disabled="row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.INFO || row.devices[index1].chnResult[index2].color===CheckData.ButtonColorEnum.LOADING" :color="row.devices[index1].chnResult[index2].color" size="small" - @click="handleClick(item,chnItem+'',row.scriptType)" + @click="handleClick(item,chnItem,row.scriptType)" style="align-self: center;" > @@ -794,18 +794,18 @@ const setErrorCheckItem = (scriptType: string, devices: any) => { } } -const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: any = null) => { +const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: any[] = []) => { let scriptType = scriptData.filter(item => item.code === scriptCode)[0]?.id // devices = [{ - // chnResult: [2, 2], + // chnResult: [1, 1], // deviceId: "80b4b4f52a4c4064a18319525f8ac13c", // deviceName: "240002" // }] - setErrorCheckItem(scriptType, devices) let temp = null if (isStart) { temp = getLoadingResult(scriptType) } else { + setErrorCheckItem(scriptType, devices) temp = { scriptType, devices @@ -902,25 +902,31 @@ const getCheckResult = (scriptType: string) => { } // 点击查看(设备)通道检测详情。参数1:设备信息,参数2:通道号,-1:代表查看全部通道 -const handleClick = (item: any, chnNum: string, scriptType: string) => { +const handleClick = (item: any, chnNum: number, scriptType: string) => { let checkResultItem = checkResult.find(obj => obj.scriptType === scriptType) - let chnResult = checkResultItem?.devices.find(obj => obj.deviceId === item.deviceId)?.chnResult let flag = -1 - if (chnNum === '-1') { - if (chnResult.findIndex(obj => obj === CheckData.ChnCheckResultEnum.UNCONNECTED) !== -1) { - flag = 0 - } - if (chnResult.findIndex(obj => obj === CheckData.ChnCheckResultEnum.ERRORDATA) !== -1) { - flag = 1 - } - } else { - if (chnResult[chnNum - 1] === CheckData.ChnCheckResultEnum.UNCONNECTED) { - flag = 0 - } - if (chnResult[chnNum - 1] === CheckData.ChnCheckResultEnum.ERRORDATA) { - flag = 1 + if (checkResultItem) { + let device = checkResultItem.devices.find(obj => obj.deviceId === item.deviceId) + if (device) { + let chnResult = device.chnResult + if (chnNum === -1) { + if (chnResult.findIndex(obj => obj === CheckData.ChnCheckResultEnum.UNCONNECTED) !== -1) { + flag = 0 + } + if (chnResult.findIndex(obj => obj === CheckData.ChnCheckResultEnum.ERRORDATA) !== -1) { + flag = 1 + } + } else { + if (chnResult[chnNum - 1] === CheckData.ChnCheckResultEnum.UNCONNECTED) { + flag = 0 + } + if (chnResult[chnNum - 1] === CheckData.ChnCheckResultEnum.ERRORDATA) { + flag = 1 + } + } } } + if (flag === 0) { ElMessageBox.alert('设备通讯中断,请检查设备通讯是否正常', '通讯中断', { confirmButtonText: '确定', @@ -934,7 +940,7 @@ const handleClick = (item: any, chnNum: string, scriptType: string) => { }) } if (flag === -1) { - dataCheckSingleChannelSingleTestPopupRef.value?.open(item.deviceId, chnNum, scriptType); + dataCheckSingleChannelSingleTestPopupRef.value?.open(item.deviceId, chnNum + '', scriptType); } };