From 90f4e53e9fc2c01ae62743f5dd53a485df95f277 Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Wed, 8 Jan 2025 20:57:11 +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/api/check/interface/index.ts | 4 ++-- frontend/src/views/home/components/test.vue | 22 +++++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/frontend/src/api/check/interface/index.ts b/frontend/src/api/check/interface/index.ts index c934930..91653fd 100644 --- a/frontend/src/api/check/interface/index.ts +++ b/frontend/src/api/check/interface/index.ts @@ -111,7 +111,7 @@ export namespace CheckData { LOADING = 0, SUCCESS = 1, FAIL = 2, - UNCONNECTED = 3, + TIMEOUT = 3, ERRORDATA = 4 } @@ -130,7 +130,7 @@ export namespace CheckData { export enum ButtonColorEnum { INFO = '#909399', - LOADING = '#607eab', + LOADING = '#003078', SUCCESS = '#67c23a', WARNING = '#e6a23c', DANGER = '#f56c6c', diff --git a/frontend/src/views/home/components/test.vue b/frontend/src/views/home/components/test.vue index b20e482..0dd37fd 100644 --- a/frontend/src/views/home/components/test.vue +++ b/frontend/src/views/home/components/test.vue @@ -235,7 +235,7 @@ const checkResultView: ComputedRef = computed(() case CheckData.ChnCheckResultEnum.FAIL: tempChnBtnResult.push({color: CheckData.ButtonColorEnum.DANGER, icon: 'Close'}) break; - case CheckData.ChnCheckResultEnum.UNCONNECTED: + case CheckData.ChnCheckResultEnum.TIMEOUT: tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'Link'}) break; case CheckData.ChnCheckResultEnum.ERRORDATA: @@ -263,7 +263,7 @@ const checkResultView: ComputedRef = computed(() case CheckData.ChnCheckResultEnum.FAIL: tempChnBtnResult.push({color: CheckData.ButtonColorEnum.DANGER, icon: 'Close'}) break; - case CheckData.ChnCheckResultEnum.UNCONNECTED: + case CheckData.ChnCheckResultEnum.TIMEOUT: tempChnBtnResult.push({color: CheckData.ButtonColorEnum.WARNING, icon: 'Link'}) break; case CheckData.ChnCheckResultEnum.ERRORDATA: @@ -289,6 +289,8 @@ watch(testStatus, function (newValue, oldValue) { if (newValue == 'start') { ElMessage.success('初始化开始!') + showTestLog() + if (oldValue == 'error') { testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:开始重新检测!`}) @@ -332,10 +334,15 @@ watch(webMsgSend, function (newValue, oldValue) { case 'socket_timeout': switch (newValue.operateCode) { case "VOLTAGE": + // todo 超时处理 页面按钮更新 ElMessageBox.alert('连接超时!', '连接超时', { confirmButtonText: '确定', type: 'error', }) + testLogList.push({ + type: 'warning', + log: `${new Date().toLocaleString()}:连接超时!` + }) emit('update:testStatus', 'connect_timeout') break; } @@ -364,6 +371,7 @@ watch(webMsgSend, function (newValue, oldValue) { case 'INIT_GATHER': if (newValue.code == 10200) { testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:源初始化成功!`}) + percentage.value = 1 } break; } @@ -373,6 +381,7 @@ watch(webMsgSend, function (newValue, oldValue) { case 'INIT_GATHER$01': if (newValue.code == 25001) { testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:设备通讯校验成功!`}) + percentage.value = 2 } break } @@ -384,7 +393,7 @@ watch(webMsgSend, function (newValue, oldValue) { ElMessage.success('初始化成功!') testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:协议校验成功!`}) testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化成功!`}) - + percentage.value = 3 activeIndex = getNextActiveIndex() + 2 // startTimer() @@ -928,7 +937,7 @@ const handleClick = (item: any, chnNum: number, scriptType: string) => { } if (flag === 0) { - ElMessageBox.alert('设备通讯中断,请检查设备通讯是否正常', '通讯中断', { + ElMessageBox.alert('连接超时,请检查设备通讯是否正常', '连接超时', { confirmButtonText: '确定', type: 'warning', }) @@ -951,8 +960,9 @@ const startTimer = () => { case 0: // setTimeout(() => { // emit('update:webMsgSend', { - // requestId: 'socket_timeout', - // operateCode: "VOLTAGE", + // requestId: 'yjc_ytxjy', + // operateCode: "INIT_GATHER", + // code: 10200 // }) // }, 5000) setTimeout(() => {