From 9ff5423368570e1c9ff8f04b8d32a85d2a29ad8d Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Mon, 13 Jan 2025 22:50:55 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=BD=92=E6=A1=A3?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/home/components/table.vue | 16 +- frontend/src/views/home/components/test.vue | 292 ++++++++++++------- 2 files changed, 194 insertions(+), 114 deletions(-) diff --git a/frontend/src/views/home/components/table.vue b/frontend/src/views/home/components/table.vue index 538c024..97091e5 100644 --- a/frontend/src/views/home/components/table.vue +++ b/frontend/src/views/home/components/table.vue @@ -154,8 +154,7 @@ v-if="form.activeTabs === 4" >数据查看 --> - { // loading.close() // ElMessage.success("归档成功"); // }, 2000) - documentedPqDev(checkStore.devices.map(item => {item.deviceId})) + documentedPqDev(checkStore.devices.map(item => {item.deviceId})).then((res) => { + if(res.code === ResultEnum.SUCCESS){ + ElMessage.success("归档成功!"); + } + }) } @@ -1043,7 +1047,11 @@ const openDrawer = async (title: string, row: any) => { if (title === '归档') { - await documentedPqDev([row.id]) + await documentedPqDev([row.id]).then((res) => { + if(res.code === ResultEnum.SUCCESS){ + ElMessage.success("归档成功!"); + } + }) emit('batchGenerateClicked'); // 触发事件 // const loading = ElLoading.service({ // lock: true, diff --git a/frontend/src/views/home/components/test.vue b/frontend/src/views/home/components/test.vue index cea9185..86fcd62 100644 --- a/frontend/src/views/home/components/test.vue +++ b/frontend/src/views/home/components/test.vue @@ -306,7 +306,7 @@ watch(testStatus, function (newValue, oldValue) { percentage.value = 0 } emit('update:testStatus', 'test_init') - //startTimer() // todo 可移除 + startTimer() // todo 可移除 testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化开始!`}) } }) @@ -357,25 +357,25 @@ watch(webMsgSend, function (newValue, oldValue) { break; } break; - case 'connect': - switch (newValue.operateCode) { - case "Source": - ElMessageBox.alert('源通讯失败,请检查源连接情况!', '初始化失败', { - confirmButtonText: '确定', - type: 'error', - }) - testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:源通讯失败!`}) - break; - case "Dev": - ElMessageBox.alert('设备通讯失败,请检查设备连接情况!', '初始化失败', { - confirmButtonText: '确定', - type: 'error', - }) - testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:设备通讯失败!`}) - break; - } - emit('update:testStatus', 'test_init_fail') - break; + // case 'connect': + // switch (newValue.operateCode) { + // case "Source": + // ElMessageBox.alert('源通讯失败,请检查源连接情况!', '初始化失败', { + // confirmButtonText: '确定', + // type: 'error', + // }) + // testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:源通讯失败!`}) + // break; + // case "Dev": + // ElMessageBox.alert('设备通讯失败,请检查设备连接情况!', '初始化失败', { + // confirmButtonText: '确定', + // type: 'error', + // }) + // testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:设备通讯失败!`}) + // break; + // } + // emit('update:testStatus', 'test_init_fail') + // break; case 'yjc_ytxjy': switch (newValue.operateCode) { case 'INIT_GATHER': @@ -414,7 +414,7 @@ watch(webMsgSend, function (newValue, oldValue) { percentage.value = 3 activeIndex = getNextActiveIndex() + 2 - //startTimer() + startTimer() emit('update:testStatus', 'process') } @@ -448,7 +448,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('FREQ') - //startTimer() + startTimer() } break; case 'V_Start': @@ -462,7 +462,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('V') - //startTimer() + startTimer() } break; case 'HV_Start': @@ -476,7 +476,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('HV') - //startTimer() + startTimer() } break; case 'HI_Start': @@ -490,7 +490,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('HI') - //startTimer() + startTimer() } break; case 'HP_Start': @@ -504,7 +504,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('HP') - //startTimer() + startTimer() } break; case 'HSV_Start': @@ -518,7 +518,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('HSV') - //startTimer() + startTimer() } break; case 'HSI_Start': @@ -532,7 +532,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('HSI') - //startTimer() + startTimer() } break; case 'VOLTAGE_Start': @@ -546,7 +546,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('VOLTAGE') - //startTimer() + startTimer() } break; case 'I_Start': @@ -560,7 +560,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('I') - //startTimer() + startTimer() } break; case 'IMBV_Start': @@ -574,7 +574,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('IMBV') - //startTimer() + startTimer() } break; case 'IMBA_Start': @@ -588,7 +588,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('IMBA') - //startTimer() + startTimer() } break; case 'F_Start': @@ -602,7 +602,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('F') - //startTimer() + startTimer() } break; case 'Quit': @@ -865,7 +865,7 @@ function getErrorCheckItem(scriptType: string) { const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: CheckData.DeviceCheckResult[] = []) => { let scriptType = scriptData.filter(item => item.code === scriptCode)[0]?.id - // devices = [ + devices = [ // { // chnResult: [3, 4], // deviceId: "80b4b4f52a4c4064a18319525f8ac13c", @@ -880,7 +880,13 @@ const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: Ch // chnResult: [1, 1, 1, 1], // deviceId: "ae5a7628260349c0a5e7c86c81fbd417", // deviceName: "240004" - // }] + // } + { + chnResult: [1, 1, 1, 1], + deviceId: "2957b271f39d4240a1c5e275c453676c", + deviceName: "测试003" + }, + ] let temp = null if (isStart) { temp = getLoadingResult(scriptType) @@ -1074,6 +1080,62 @@ const startTimer = () => { }, 6000) break; case 1: + emit('update:webMsgSend', { + requestId: 'V_Start' + }) + setTimeout(() => { + emit('update:webMsgSend', { + requestId: 'V_End' + }) + }, 2000); + // setTimeout(() => { + // emit('update:webMsgSend', { + // requestId: 'FREQ_Start' + // }) + // }, 1000) + // setTimeout(() => { + // emit('update:webMsgSend', { + // requestId: 'FREQ_End' + // }) + // }, 2000); + break; + case 2: + emit('update:webMsgSend', { + requestId: 'I_Start' + }) + setTimeout(() => { + emit('update:webMsgSend', { + requestId: 'I_End' + }) + }, 2000) + // emit('update:webMsgSend', { + // requestId: 'V_Start' + // }) + // setTimeout(() => { + // emit('update:webMsgSend', { + // requestId: 'V_End' + // }) + // }, 2000); + break; + case 3: + emit('update:webMsgSend', { + requestId: 'IMBV_Start' + }) + setTimeout(() => { + emit('update:webMsgSend', { + requestId: 'IMBV_End' + }) + }, 2000) + // emit('update:webMsgSend', { + // requestId: 'HV_Start', + // }) + // setTimeout(() => { + // emit('update:webMsgSend', { + // requestId: 'HV_End' + // }) + // }, 2000) + break; + case 4: setTimeout(() => { emit('update:webMsgSend', { requestId: 'FREQ_Start' @@ -1084,18 +1146,16 @@ const startTimer = () => { requestId: 'FREQ_End' }) }, 2000); + // emit('update:webMsgSend', { + // requestId: 'HI_Start' + // }) + // setTimeout(() => { + // emit('update:webMsgSend', { + // requestId: 'HI_End' + // }) + // }, 2000) break; - case 2: - emit('update:webMsgSend', { - requestId: 'V_Start' - }) - setTimeout(() => { - emit('update:webMsgSend', { - requestId: 'V_End' - }) - }, 2000); - break; - case 3: + case 5: emit('update:webMsgSend', { requestId: 'HV_Start', }) @@ -1104,8 +1164,16 @@ const startTimer = () => { requestId: 'HV_End' }) }, 2000) + // emit('update:webMsgSend', { + // requestId: 'HP_Start', + // }) + // setTimeout(() => { + // emit('update:webMsgSend', { + // requestId: 'HP_End' + // }) + // }, 2000) break; - case 4: + case 6: emit('update:webMsgSend', { requestId: 'HI_Start' }) @@ -1114,18 +1182,16 @@ const startTimer = () => { requestId: 'HI_End' }) }, 2000) + // emit('update:webMsgSend', { + // requestId: 'HSV_Start' + // }) + // setTimeout(() => { + // emit('update:webMsgSend', { + // requestId: 'HSV_End' + // }) + // }, 2000) break; - case 5: - emit('update:webMsgSend', { - requestId: 'HP_Start', - }) - setTimeout(() => { - emit('update:webMsgSend', { - requestId: 'HP_End' - }) - }, 2000) - break; - case 6: + case 7: emit('update:webMsgSend', { requestId: 'HSV_Start' }) @@ -1134,8 +1200,16 @@ const startTimer = () => { requestId: 'HSV_End' }) }, 2000) + // emit('update:webMsgSend', { + // requestId: 'HSI_Start' + // }) + // setTimeout(() => { + // emit('update:webMsgSend', { + // requestId: 'HSI_End' + // }) + // }, 2000) break; - case 7: + case 8: emit('update:webMsgSend', { requestId: 'HSI_Start' }) @@ -1144,57 +1218,55 @@ const startTimer = () => { requestId: 'HSI_End' }) }, 2000) + // emit('update:webMsgSend', { + // requestId: 'VOLTAGE_Start' + // }) + // setTimeout(() => { + // emit('update:webMsgSend', { + // requestId: 'VOLTAGE_End' + // }) + // }, 2000) break; - case 8: - emit('update:webMsgSend', { - requestId: 'VOLTAGE_Start' - }) - setTimeout(() => { - emit('update:webMsgSend', { - requestId: 'VOLTAGE_End' - }) - }, 2000) - break; - case 9: - emit('update:webMsgSend', { - requestId: 'I_Start' - }) - setTimeout(() => { - emit('update:webMsgSend', { - requestId: 'I_End' - }) - }, 2000) - break; - case 10: - emit('update:webMsgSend', { - requestId: 'IMBV_Start' - }) - setTimeout(() => { - emit('update:webMsgSend', { - requestId: 'IMBV_End' - }) - }, 2000) - break; - case 11: - emit('update:webMsgSend', { - requestId: 'IMBA_Start' - }) - setTimeout(() => { - emit('update:webMsgSend', { - requestId: 'IMBA_End' - }) - }, 2000) - break; - case 12: - emit('update:webMsgSend', { - requestId: 'F_Start' - }) - setTimeout(() => { - emit('update:webMsgSend', { - requestId: 'F_End' - }) - }, 2000) - break; + // case 9: + // emit('update:webMsgSend', { + // requestId: 'I_Start' + // }) + // setTimeout(() => { + // emit('update:webMsgSend', { + // requestId: 'I_End' + // }) + // }, 2000) + // break; + // case 10: + // emit('update:webMsgSend', { + // requestId: 'IMBV_Start' + // }) + // setTimeout(() => { + // emit('update:webMsgSend', { + // requestId: 'IMBV_End' + // }) + // }, 2000) + // break; + // case 11: + // emit('update:webMsgSend', { + // requestId: 'IMBA_Start' + // }) + // setTimeout(() => { + // emit('update:webMsgSend', { + // requestId: 'IMBA_End' + // }) + // }, 2000) + // break; + // case 12: + // emit('update:webMsgSend', { + // requestId: 'F_Start' + // }) + // setTimeout(() => { + // emit('update:webMsgSend', { + // requestId: 'F_End' + // }) + // }, 2000) + // break; case 13: emit('update:webMsgSend', { requestId: 'Quit' @@ -1222,7 +1294,7 @@ const handleResumeTest = () => { type: 'info', log: `${new Date().toLocaleString()}:继续检测`, }) - //startTimer() + startTimer() console.log('开始继续检测') }; From 089c97d85947424e6565568aa6765e587d9d89ab Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Mon, 13 Jan 2025 22:53:38 +0800 Subject: [PATCH 2/3] =?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 | 82 ++++++++++----------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/frontend/src/views/home/components/test.vue b/frontend/src/views/home/components/test.vue index 86fcd62..6b7d3bb 100644 --- a/frontend/src/views/home/components/test.vue +++ b/frontend/src/views/home/components/test.vue @@ -306,7 +306,7 @@ watch(testStatus, function (newValue, oldValue) { percentage.value = 0 } emit('update:testStatus', 'test_init') - startTimer() // todo 可移除 + //startTimer() // todo 可移除 testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化开始!`}) } }) @@ -357,25 +357,25 @@ watch(webMsgSend, function (newValue, oldValue) { break; } break; - // case 'connect': - // switch (newValue.operateCode) { - // case "Source": - // ElMessageBox.alert('源通讯失败,请检查源连接情况!', '初始化失败', { - // confirmButtonText: '确定', - // type: 'error', - // }) - // testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:源通讯失败!`}) - // break; - // case "Dev": - // ElMessageBox.alert('设备通讯失败,请检查设备连接情况!', '初始化失败', { - // confirmButtonText: '确定', - // type: 'error', - // }) - // testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:设备通讯失败!`}) - // break; - // } - // emit('update:testStatus', 'test_init_fail') - // break; + case 'connect': + switch (newValue.operateCode) { + case "Source": + ElMessageBox.alert('源通讯失败,请检查源连接情况!', '初始化失败', { + confirmButtonText: '确定', + type: 'error', + }) + testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:源通讯失败!`}) + break; + case "Dev": + ElMessageBox.alert('设备通讯失败,请检查设备连接情况!', '初始化失败', { + confirmButtonText: '确定', + type: 'error', + }) + testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:设备通讯失败!`}) + break; + } + emit('update:testStatus', 'test_init_fail') + break; case 'yjc_ytxjy': switch (newValue.operateCode) { case 'INIT_GATHER': @@ -414,7 +414,7 @@ watch(webMsgSend, function (newValue, oldValue) { percentage.value = 3 activeIndex = getNextActiveIndex() + 2 - startTimer() + //startTimer() emit('update:testStatus', 'process') } @@ -448,7 +448,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('FREQ') - startTimer() + //startTimer() } break; case 'V_Start': @@ -462,7 +462,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('V') - startTimer() + //startTimer() } break; case 'HV_Start': @@ -476,7 +476,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('HV') - startTimer() + //startTimer() } break; case 'HI_Start': @@ -490,7 +490,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('HI') - startTimer() + //startTimer() } break; case 'HP_Start': @@ -504,7 +504,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('HP') - startTimer() + //startTimer() } break; case 'HSV_Start': @@ -518,7 +518,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('HSV') - startTimer() + //startTimer() } break; case 'HSI_Start': @@ -532,7 +532,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('HSI') - startTimer() + //startTimer() } break; case 'VOLTAGE_Start': @@ -546,7 +546,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('VOLTAGE') - startTimer() + //startTimer() } break; case 'I_Start': @@ -560,7 +560,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('I') - startTimer() + //startTimer() } break; case 'IMBV_Start': @@ -574,7 +574,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('IMBV') - startTimer() + //startTimer() } break; case 'IMBA_Start': @@ -588,7 +588,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('IMBA') - startTimer() + //startTimer() } break; case 'F_Start': @@ -602,7 +602,7 @@ watch(webMsgSend, function (newValue, oldValue) { updateLog(false) if (testStatus.value != 'paused') { activeIndex = getNextActiveIndex('F') - startTimer() + //startTimer() } break; case 'Quit': @@ -865,7 +865,7 @@ function getErrorCheckItem(scriptType: string) { const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: CheckData.DeviceCheckResult[] = []) => { let scriptType = scriptData.filter(item => item.code === scriptCode)[0]?.id - devices = [ + // devices = [ // { // chnResult: [3, 4], // deviceId: "80b4b4f52a4c4064a18319525f8ac13c", @@ -881,12 +881,12 @@ const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: Ch // deviceId: "ae5a7628260349c0a5e7c86c81fbd417", // deviceName: "240004" // } - { - chnResult: [1, 1, 1, 1], - deviceId: "2957b271f39d4240a1c5e275c453676c", - deviceName: "测试003" - }, - ] + // { + // chnResult: [1, 1, 1, 1], + // deviceId: "2957b271f39d4240a1c5e275c453676c", + // deviceName: "测试003" + // }, + // ] let temp = null if (isStart) { temp = getLoadingResult(scriptType) @@ -1294,7 +1294,7 @@ const handleResumeTest = () => { type: 'info', log: `${new Date().toLocaleString()}:继续检测`, }) - startTimer() + //startTimer() console.log('开始继续检测') }; From 454aabdc975b5b9436d904cbeed5a76963dc55d7 Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Mon, 13 Jan 2025 22:59:03 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=8F=B3=E4=B8=8A=E8=A7=92=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/utils/errorHandler.ts | 36 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/frontend/src/utils/errorHandler.ts b/frontend/src/utils/errorHandler.ts index d8f6aae..34d9083 100644 --- a/frontend/src/utils/errorHandler.ts +++ b/frontend/src/utils/errorHandler.ts @@ -4,24 +4,24 @@ import { ElNotification } from "element-plus"; * @description 全局代码错误捕捉 * */ const errorHandler = (error: any) => { - // 过滤 HTTP 请求错误 - if (error.status || error.status == 0) return false; - let errorMap: { [key: string]: string } = { - InternalError: "Javascript引擎内部错误", - ReferenceError: "未找到对象", - TypeError: "使用了错误的类型或对象", - RangeError: "使用内置对象时,参数超范围", - SyntaxError: "语法错误", - EvalError: "错误的使用了Eval", - URIError: "URI错误" - }; - let errorName = errorMap[error.name] || "未知错误"; - ElNotification({ - title: errorName, - message: error, - type: "error", - duration: 3000 - }); + // // 过滤 HTTP 请求错误 + // if (error.status || error.status == 0) return false; + // let errorMap: { [key: string]: string } = { + // InternalError: "Javascript引擎内部错误", + // ReferenceError: "未找到对象", + // TypeError: "使用了错误的类型或对象", + // RangeError: "使用内置对象时,参数超范围", + // SyntaxError: "语法错误", + // EvalError: "错误的使用了Eval", + // URIError: "URI错误" + // }; + // let errorName = errorMap[error.name] || "未知错误"; + // ElNotification({ + // title: errorName, + // message: error, + // type: "error", + // duration: 3000 + // }); }; export default errorHandler;