源未开启外联机错误弹窗出现2次

This commit is contained in:
caozehui
2025-01-23 09:33:00 +08:00
parent 1ad1a0198e
commit 440cfe1ac5
2 changed files with 22 additions and 22 deletions

View File

@@ -321,6 +321,9 @@ watch(testStatus, function (newValue, oldValue) {
}
})
// 次数
let count = 0
watch(webMsgSend, function (newValue, oldValue) {
if (newValue.code == 10520) {
ElMessageBox.alert('报文解析异常!', '初始化失败', {
@@ -344,12 +347,15 @@ watch(webMsgSend, function (newValue, oldValue) {
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:测试项解析有误!`})
emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10523) {
if (count === 0) {
ElMessageBox.alert('源连接失败!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:源连接失败!`})
emit('update:testStatus', 'test_init_fail')
count++
}
} else if (newValue.code == 10524) {
ElMessageBox.alert('获取源控制权失败!', '初始化失败', {
confirmButtonText: '确定',
@@ -408,13 +414,14 @@ watch(webMsgSend, function (newValue, oldValue) {
} else {
switch (newValue.requestId) {
case 'server_error':
if (newValue.operateCode === 'server_error') {
if (newValue.operateCode === 'server_error' && count === 0) {
ElMessageBox.alert('源连接失败!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:源连接失败!`})
emit('update:testStatus', 'test_init_fail')
count++
}
break;
case 'formal_real': // 正式测试
@@ -1311,11 +1318,12 @@ const handleResumeTest = () => {
};
const handleReCheck = () => {
activeIndex = 0;
percentage.value = 0;
testLogList.length = 0;
errorCheckItem.length = 0;
};
activeIndex = 0
percentage.value = 0
testLogList.length = 0
errorCheckItem.length = 0
count = 0
}
// 获取当前执行的大测试项序号
const getActiveIndex = (code: string): number => {
@@ -1340,13 +1348,6 @@ const getNextActiveIndex = (code: string = ''): number => {
return -1
}
function clear() {
errorCheckItem.length = 0
}
defineExpose({
clear,
})
</script>
<style scoped lang="scss">

View File

@@ -18,7 +18,7 @@
<preTest ref="preTestRef" v-if="stepsActiveIndex === 0" v-model:testStatus="preTestStatus" :webMsgSend="webMsgSend"></preTest>
<timeTest v-if="stepsActiveIndex === 1 && isTimeCheck" v-model:testStatus="timeTestStatus"></timeTest>
<!-- <channelsTest v-if="stepsActiveIndex === 2" v-model:testStatus="channelsTestStatus"></channelsTest> -->
<test ref="testRef" v-if="stepsActiveIndex >= 2" v-model:testStatus="TestStatus" :webMsgSend="webMsgSend" @update:webMsgSend="webMsgSend=$event"
<test v-if="stepsActiveIndex >= 2" v-model:testStatus="TestStatus" :webMsgSend="webMsgSend" @update:webMsgSend="webMsgSend=$event"
@sendPause="sendPause" @sendResume="sendResume" @sendReCheck="sendReCheck"></test>
<template #footer>
@@ -173,7 +173,7 @@ const webMsgSend = ref();//webSocket推送的数据
const dialogTitle = ref('');
const isTimeCheck = ref(false)
const preTestRef = ref(null);
const testRef = ref(null);
// const devIdArr = ref([])
// const planId = ref('')
@@ -504,7 +504,6 @@ const handleCancel = () => {
emit('quitClicked'); // 触发事件
// clearData()
// emit('update:visible', false); // 关闭对话框
testRef.value?.clear()
};