From 72eb3e189b5a609a9c12c5d3dd28b7b2cba55deb Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Wed, 15 Jan 2025 08:53:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E5=81=9C=E9=A1=B5=E9=9D=A2=E6=95=88?= =?UTF-8?q?=E6=9E=9C=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/home/components/test.vue | 30 +++++++++++++-------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/frontend/src/views/home/components/test.vue b/frontend/src/views/home/components/test.vue index 38caea4..e5a43ad 100644 --- a/frontend/src/views/home/components/test.vue +++ b/frontend/src/views/home/components/test.vue @@ -13,7 +13,7 @@ @click="handlePause()">停止检测 - + 暂停中 @@ -303,7 +303,6 @@ watch(testStatus, function (newValue, oldValue) { if (newValue == 'start') { ElMessage.success('初始化开始!') - startData.value = new Date(); showTestLog() if (oldValue == 'error') { @@ -315,6 +314,8 @@ watch(testStatus, function (newValue, oldValue) { } emit('update:testStatus', 'test_init') //startTimer() // todo 可移除 + startData.value = new Date(); + timeDifference.value = 0; testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化开始!`}) } }) @@ -418,9 +419,11 @@ watch(webMsgSend, function (newValue, oldValue) { if (newValue.code == 25001) { ElMessage.success('初始化成功!') testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:协议校验成功!`}) + timeDifference.value = + new Date().getTime() - startData.value.getTime(); testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化成功!`}) percentage.value = 3 + activeIndex = getNextActiveIndex() + 2 //startTimer() @@ -716,16 +719,20 @@ const updateCheckResult = (data: CheckData.ScriptChnItem) => { checkResult.forEach(item => { if (item.scriptType == scriptType) { - item.devices.forEach((device, index) => { - let targetDevice = data.devices.find(dev => dev.deviceId === device.deviceId) + for (let i = 0; i < item.devices.length; i++) { + let targetDevice = data.devices.find(dev => dev.deviceId === item.devices[i].deviceId) if (targetDevice !== undefined) { - device.chnResult = [...targetDevice.chnResult] + item.devices[i].chnResult = [...targetDevice.chnResult] } - }) + } + // item.devices.forEach((device, index) => { + // let targetDevice = data.devices.find(dev => dev.deviceId === device.deviceId) + // if (targetDevice !== undefined) { + // device.chnResult = [...targetDevice.chnResult] + // } + // }) } }) - - } const scrollToBottom = () => { @@ -768,12 +775,13 @@ const updateLog = (isStart: boolean) => { let timeDifferenceItem = 0 if (activeIndex === 1 && isStart) { - timeDifference.value = 0; + // timeDifference.value = 0; //testLogList.length = 0; // 清空数组 } // debugger if (activeIndex <= checkTotal) { if (isStart) { + startData.value = new Date(); testLogList.push({ type: 'info', log: currentTime.value + ` :${scriptData[activeIndex - 1].scriptName}准确度检测:开始`, @@ -891,8 +899,8 @@ const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: Ch // } // { // chnResult: [1, 1, 1, 1], - // deviceId: "2957b271f39d4240a1c5e275c453676c", - // deviceName: "测试003" + // deviceId: "461813a4f30f4a34a1a273ecd0379458", + // deviceName: "25011407" // } // ] let temp = null