diff --git a/frontend/src/views/home/components/test.vue b/frontend/src/views/home/components/test.vue index 96a88c3..a5def51 100644 --- a/frontend/src/views/home/components/test.vue +++ b/frontend/src/views/home/components/test.vue @@ -415,6 +415,39 @@ watch(webMsgSend, function(newValue, oldValue) { } else { // ========== 根据请求ID处理不同类型的消息 ========== switch (newValue.requestId) { + // 源过载测试 + case 'overloadTest': + if (newValue.code === 1) { + ElMessageBox.alert('电压过载!', '初始化失败', { + confirmButtonText: '确定', + type: 'error', + }) + testLogList.push({ type: 'error', log: `${new Date().toLocaleString()}:电压过载!` }) + emit('update:testStatus', 'test_init_fail') + count++ + } + if (newValue.code === 2) { + ElMessageBox.alert('电流过载!', '初始化失败', { + confirmButtonText: '确定', + type: 'error', + }) + testLogList.push({ type: 'error', log: `${new Date().toLocaleString()}:电流过载!` }) + emit('update:testStatus', 'test_init_fail') + count++ + } + if (newValue.code === 3) { + ElMessageBox.alert('电压和电流过载!', '初始化失败', { + confirmButtonText: '确定', + type: 'error', + }) + testLogList.push({ type: 'error', log: `${new Date().toLocaleString()}:电压和电流过载!` }) + emit('update:testStatus', 'test_init_fail') + count++ + } + if (newValue.code === 4) { + testLogList.push({ type: 'info', log: `${new Date().toLocaleString()}:过载测试成功!` }) + } + break; // 服务端错误 case 'server_error': if (newValue.operateCode === 'server_error' && count === 0) { diff --git a/frontend/src/views/home/components/testPopup.vue b/frontend/src/views/home/components/testPopup.vue index 14d8a2d..bfaada9 100644 --- a/frontend/src/views/home/components/testPopup.vue +++ b/frontend/src/views/home/components/testPopup.vue @@ -133,7 +133,8 @@ (ActiveStatue === 'success' || ActiveStatue === 'error' || ActiveStatue === 'connect_timeout' || - ActiveStatue === 'pause_timeout') + ActiveStatue === 'pause_timeout'|| + ActiveStatue === 'test_init_fail') " @click="nextStep" > @@ -472,7 +473,11 @@ watch(TestStatus, function (newValue, oldValue) { // 监听总体状态变化,处理步骤切换和错误状态 watch(ActiveStatue, function (newValue, oldValue) { - + //初始化失败 + if(newValue==='test_init_fail'){ + stepsActiveIndex.value = stepsTotalNum.value + 1 // 跳到最后一步 + nextStepText.value = '初始化失败' + } // 处理错误状态 if (newValue === 'error') {