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

View File

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