From 5ac6bbf04b0139f06a1d9dcaaf81b16009d986b8 Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Tue, 7 Jan 2025 19:03:00 +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 --- frontend/src/views/home/components/test.vue | 139 ++++++++++++------ .../src/views/home/components/testPopup.vue | 46 +++--- 2 files changed, 118 insertions(+), 67 deletions(-) diff --git a/frontend/src/views/home/components/test.vue b/frontend/src/views/home/components/test.vue index 5c91dc2..20b1bfb 100644 --- a/frontend/src/views/home/components/test.vue +++ b/frontend/src/views/home/components/test.vue @@ -12,18 +12,24 @@ :icon="VideoPause" @click="emit('sendPause')">停止检测 - 预检测中 - - 预检测失败 - + + + + + + + + + + + + + + + + + +
- - -

= computed(() watch(testStatus, function (newValue, oldValue) { if (newValue == 'start') { - ElMessage.success('预检测开始!') + ElMessage.success('初始化开始!') if (oldValue == 'error') { testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:开始重新检测!`}) @@ -293,29 +296,29 @@ watch(testStatus, function (newValue, oldValue) { activeIndex = 0 percentage.value = 0 } - emit('update:testStatus', 'preTest_process') - //startTimer() // todo 可移除 - testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:预检测开始!`}) + emit('update:testStatus', 'test_init') + startTimer() // todo 可移除 + testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化开始!`}) } }) watch(webMsgSend, function (newValue, oldValue) { if (newValue.code == 10550) { - ElMessageBox.alert(`${newValue.data}设备通讯失败,请检查设备连接情况!`, '预检测失败', { + ElMessageBox.alert(`${newValue.data}设备通讯失败,请检查设备连接情况!`, '初始化失败', { confirmButtonText: '确定', type: 'error', }) testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:${newValue.data}设备通讯中断!`}) - emit('update:testStatus', 'preTest_fail') + emit('update:testStatus', 'test_init_fail') } else if (newValue.code == 10551) { - ElMessageBox.alert(`${newValue.data}设备触发报告异常!`, '预检测失败', { + ElMessageBox.alert(`${newValue.data}设备触发报告异常!`, '初始化失败', { confirmButtonText: '确定', type: 'error', }) testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:${newValue.data}设备触发报告异常!`}) - emit('update:testStatus', 'preTest_fail') + emit('update:testStatus', 'test_init_fail') } else if (newValue.code == 10552) { //todo 10552之后还会发送消息吗? - ElMessageBox.alert('存在已经初始化步骤,执行自动关闭,请重新发起检测', '预检测失败', { + ElMessageBox.alert('存在已经初始化步骤,执行自动关闭,请重新发起检测', '初始化失败', { confirmButtonText: '确定', type: 'error', }) @@ -326,34 +329,64 @@ watch(webMsgSend, function (newValue, oldValue) { emit('update:testStatus', 'error') } else { switch (newValue.requestId) { + case 'socket_timeout': + switch (newValue.operateCode) { + case "VOLTAGE": + ElMessageBox.alert('连接超时!', '连接超时', { + confirmButtonText: '确定', + type: 'error', + }) + emit('update:testStatus', 'connect_timeout') + break; + } + break; // case 'connect': // switch (newValue.operateCode) { // case "Source": - // ElMessageBox.alert('源通讯失败,请检查源连接情况!', '预检测失败', { + // ElMessageBox.alert('源通讯失败,请检查源连接情况!', '初始化失败', { // confirmButtonText: '确定', // type: 'error', // }) // testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:源通讯失败!`}) // break; // case "Dev": - // ElMessageBox.alert('设备通讯失败,请检查设备连接情况!', '预检测失败', { + // ElMessageBox.alert('设备通讯失败,请检查设备连接情况!', '初始化失败', { // confirmButtonText: '确定', // type: 'error', // }) // testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:设备通讯失败!`}) // break; // } - // emit('update:testStatus', 'preTest_fail') + // emit('update:testStatus', 'test_init_fail') // break; + case 'yjc_ytxjy': + switch (newValue.operateCode) { + case 'INIT_GATHER': + if (newValue.code == 10200) { + testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:源初始化成功!`}) + } + break; + } + break; + case 'yjc_sbtxjy': + switch (newValue.operateCode) { + case 'INIT_GATHER$01': + if (newValue.code == 25001) { + testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:设备通讯校验成功!`}) + } + break + } + break; case 'yjc_xyjy': switch (newValue.operateCode) { case 'INIT_GATHER$03': if (newValue.code == 25001) { - ElMessage.success('预检测成功!') - testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:预检测成功!`}) + ElMessage.success('初始化成功!') + testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:协议校验成功!`}) + testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化成功!`}) activeIndex = getNextActiveIndex() + 2 - //startTimer() + startTimer() emit('update:testStatus', 'process') } @@ -386,7 +419,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('FREQ') - //startTimer() + startTimer() } break; case 'V_Start': @@ -399,7 +432,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('V') - //startTimer() + startTimer() } break; case 'HV_Start': @@ -412,7 +445,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('HV') - //startTimer() + startTimer() } break; case 'HI_Start': @@ -425,7 +458,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('HI') - //startTimer() + startTimer() } break; case 'HP_Start': @@ -438,7 +471,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('HP') - //startTimer() + startTimer() } break; case 'HSV_Start': @@ -451,7 +484,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('HSV') - //startTimer() + startTimer() } break; case 'HSI_Start': @@ -464,7 +497,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('HSI') - //startTimer() + startTimer() } break; case 'VOLTAGE_Start': @@ -477,7 +510,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('VOLTAGE') - //startTimer() + startTimer() } break; case 'I_Start': @@ -490,7 +523,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('I') - //startTimer() + startTimer() } break; case 'IMBV_Start': @@ -503,7 +536,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('IMBV') - //startTimer() + startTimer() } break; case 'IMBA_Start': @@ -516,7 +549,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('IMBA') - //startTimer() + startTimer() } break; case 'F_Start': @@ -529,7 +562,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('F') - //startTimer() + startTimer() } break; case 'Quit': @@ -763,6 +796,11 @@ const setErrorCheckItem = (scriptType: string, devices: any) => { const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: any = null) => { let scriptType = scriptData.filter(item => item.code === scriptCode)[0]?.id + devices = [{ + chnResult: [2, 2], + deviceId: "80b4b4f52a4c4064a18319525f8ac13c", + deviceName: "240002" + }] setErrorCheckItem(scriptType, devices) let temp = null if (isStart) { @@ -770,7 +808,7 @@ const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: an } else { temp = { scriptType, - devices, + devices } } updateCheckResult(temp) @@ -905,26 +943,31 @@ const startTimer = () => { console.log('开始检测第' + activeIndex + '项') switch (activeIndex) { case 0: + // setTimeout(() => { + // emit('update:webMsgSend', { + // requestId: 'socket_timeout', + // operateCode: "VOLTAGE", + // }) + // }, 5000) setTimeout(() => { emit('update:webMsgSend', { requestId: 'yjc_ytxjy', operateCode: "INIT_GATHER", - code: "2222" + code: 10200 }) }, 2000) setTimeout(() => { emit('update:webMsgSend', { requestId: 'yjc_sbtxjy', operateCode: "INIT_GATHER$01", - code: "2222", - data: '240003' + code: 25001 }) }, 4000); setTimeout(() => { emit('update:webMsgSend', { requestId: 'yjc_xyjy', operateCode: "INIT_GATHER$03", - code: "25001" + code: 25001 }) }, 6000) break; @@ -1083,7 +1126,7 @@ const handleResumeTest = () => { type: 'info', log: `${new Date().toLocaleString()}:继续检测`, }) - //startTimer() + startTimer() console.log('开始继续检测') }; diff --git a/frontend/src/views/home/components/testPopup.vue b/frontend/src/views/home/components/testPopup.vue index 82f8b9f..1b70c08 100644 --- a/frontend/src/views/home/components/testPopup.vue +++ b/frontend/src/views/home/components/testPopup.vue @@ -24,12 +24,12 @@ 跳过 开始检测 - 停止检测 + 检测中 继续检测 重新检测 - 预检测中 + 初始化中 + v-if="ActiveStatue === 'success'||ActiveStatue==='test_init_fail'||ActiveStatue==='connect_timeout'" @click="nextStep"> {{ nextStepText }}

@@ -272,20 +272,22 @@ const detectionOptions = ref([ }*/ }) TestStatus.value = 'start' - } else if (TestStatus.value == 'process') { - // 发送暂停指令 - sendPause() - // pauseTest({deviceIds}).then(res => { - // console.log(res) - // if (res.code === 20000) { - // TestStatus.value = 'paused' - // webMsgSend.value = '' - // } else { - // ElMessage.error(res.message) - // } - // }) - - } else if (TestStatus.value == 'paused') { + } else + // if (TestStatus.value == 'process') { + // // 发送暂停指令 + // sendPause() + // // pauseTest({deviceIds}).then(res => { + // // console.log(res) + // // if (res.code === 20000) { + // // TestStatus.value = 'paused' + // // webMsgSend.value = '' + // // } else { + // // ElMessage.error(res.message) + // // } + // // }) + // + // } else + if (TestStatus.value == 'paused') { // 发送继续指令 sendResume() // resumeTest({deviceIds}).then(res => { @@ -348,11 +350,17 @@ const detectionOptions = ref([ stepsActiveIndex.value++; nextStepText.value = '检测完成' } - if(newValue === 'preTest_fail' && stepsActiveIndex.value === stepsTotalNum.value - 2) + if(newValue === 'test_init_fail' && stepsActiveIndex.value === stepsTotalNum.value - 2) { stepsActiveIndex.value++; stepsActiveIndex.value++; - nextStepText.value = '预检测失败' + nextStepText.value = '初始化失败' + } + if(newValue === 'connect_timeout' && stepsActiveIndex.value === stepsTotalNum.value - 2) + { + stepsActiveIndex.value++; + stepsActiveIndex.value++; + nextStepText.value = '连接超时' } })