This commit is contained in:
caozehui
2025-01-09 14:18:50 +08:00
parent 5be1d22115
commit 839777ea4d

View File

@@ -288,6 +288,7 @@ const checkResultView: ComputedRef<CheckData.ScriptChnViewItem[]> = computed(()
}) })
return temp return temp
}) })
return result return result
}) })
@@ -312,12 +313,12 @@ watch(testStatus, function (newValue, oldValue) {
watch(webMsgSend, function (newValue, oldValue) { watch(webMsgSend, function (newValue, oldValue) {
if (newValue.code == 10550) { if (newValue.code == 10550) {
ElMessageBox.alert(`${newValue.data}设备通讯失败,请检查设备连接情况!`, '初始化失败', { // ElMessageBox.alert(`${newValue.data}设备通讯失败,请检查设备连接情况!`, '初始化失败', {
confirmButtonText: '确定', // confirmButtonText: '确定',
type: 'error', // type: 'error',
}) // })
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}设备通讯失败`}) testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}设备连接异常`})
emit('update:testStatus', 'test_init_fail') // emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10551) { } else if (newValue.code == 10551) {
ElMessageBox.alert(`${newValue.data}设备触发报告异常!`, '初始化失败', { ElMessageBox.alert(`${newValue.data}设备触发报告异常!`, '初始化失败', {
confirmButtonText: '确定', confirmButtonText: '确定',
@@ -337,6 +338,13 @@ watch(webMsgSend, function (newValue, oldValue) {
emit('update:testStatus', 'error') emit('update:testStatus', 'error')
} else { } else {
switch (newValue.requestId) { switch (newValue.requestId) {
case 'error_flow_end':
ElMessageBox.alert(`设备连接异常,请检查设备连接情况!`, '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
emit('update:testStatus', 'test_init_fail')
break
case 'socket_timeout': case 'socket_timeout':
switch (newValue.operateCode) { switch (newValue.operateCode) {
case "VOLTAGE": case "VOLTAGE":
@@ -396,6 +404,7 @@ watch(webMsgSend, function (newValue, oldValue) {
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:协议校验成功!`}) testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:协议校验成功!`})
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化成功!`}) testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化成功!`})
percentage.value = 3 percentage.value = 3
activeIndex = getNextActiveIndex() + 2 activeIndex = getNextActiveIndex() + 2
//startTimer() //startTimer()
@@ -421,6 +430,7 @@ watch(webMsgSend, function (newValue, oldValue) {
ElMessage.error('无法继续检测') ElMessage.error('无法继续检测')
break; break;
case 'FREQ_Start': case 'FREQ_Start':
activeIndex = getActiveIndex('FREQ')
updateCheckResultView("FREQ", true) updateCheckResultView("FREQ", true)
updateLog(true) updateLog(true)
break; break;
@@ -434,6 +444,7 @@ watch(webMsgSend, function (newValue, oldValue) {
} }
break; break;
case 'V_Start': case 'V_Start':
activeIndex = getActiveIndex('V')
updateCheckResultView("V", true) updateCheckResultView("V", true)
updateLog(true) updateLog(true)
break; break;
@@ -447,6 +458,7 @@ watch(webMsgSend, function (newValue, oldValue) {
} }
break; break;
case 'HV_Start': case 'HV_Start':
activeIndex = getActiveIndex('HV')
updateCheckResultView("HV", true) updateCheckResultView("HV", true)
updateLog(true) updateLog(true)
break; break;
@@ -460,6 +472,7 @@ watch(webMsgSend, function (newValue, oldValue) {
} }
break; break;
case 'HI_Start': case 'HI_Start':
activeIndex = getActiveIndex('HI')
updateCheckResultView("HI", true) updateCheckResultView("HI", true)
updateLog(true) updateLog(true)
break; break;
@@ -473,6 +486,7 @@ watch(webMsgSend, function (newValue, oldValue) {
} }
break; break;
case 'HP_Start': case 'HP_Start':
activeIndex = getActiveIndex('HP')
updateCheckResultView("HP", true) updateCheckResultView("HP", true)
updateLog(true) updateLog(true)
break; break;
@@ -486,6 +500,7 @@ watch(webMsgSend, function (newValue, oldValue) {
} }
break; break;
case 'HSV_Start': case 'HSV_Start':
activeIndex = getActiveIndex('HSV')
updateCheckResultView("HSV", true) updateCheckResultView("HSV", true)
updateLog(true) updateLog(true)
break; break;
@@ -499,6 +514,7 @@ watch(webMsgSend, function (newValue, oldValue) {
} }
break; break;
case 'HSI_Start': case 'HSI_Start':
activeIndex = getActiveIndex('HSI')
updateCheckResultView("HSI", true) updateCheckResultView("HSI", true)
updateLog(true) updateLog(true)
break; break;
@@ -512,6 +528,7 @@ watch(webMsgSend, function (newValue, oldValue) {
} }
break; break;
case 'VOLTAGE_Start': case 'VOLTAGE_Start':
activeIndex = getActiveIndex('VOLTAGE')
updateCheckResultView("VOLTAGE", true) updateCheckResultView("VOLTAGE", true)
updateLog(true) updateLog(true)
break; break;
@@ -525,6 +542,7 @@ watch(webMsgSend, function (newValue, oldValue) {
} }
break; break;
case 'I_Start': case 'I_Start':
activeIndex = getActiveIndex('I')
updateCheckResultView("I", true) updateCheckResultView("I", true)
updateLog(true) updateLog(true)
break; break;
@@ -538,6 +556,7 @@ watch(webMsgSend, function (newValue, oldValue) {
} }
break; break;
case 'IMBV_Start': case 'IMBV_Start':
activeIndex = getActiveIndex('IMBV')
updateCheckResultView("IMBV", true) updateCheckResultView("IMBV", true)
updateLog(true) updateLog(true)
break; break;
@@ -551,6 +570,7 @@ watch(webMsgSend, function (newValue, oldValue) {
} }
break; break;
case 'IMBA_Start': case 'IMBA_Start':
activeIndex = getActiveIndex('IMBA')
updateCheckResultView("IMBA", true) updateCheckResultView("IMBA", true)
updateLog(true) updateLog(true)
break; break;
@@ -564,6 +584,7 @@ watch(webMsgSend, function (newValue, oldValue) {
} }
break; break;
case 'F_Start': case 'F_Start':
activeIndex = getActiveIndex('F')
updateCheckResultView("F", true) updateCheckResultView("F", true)
updateLog(true) updateLog(true)
break; break;
@@ -836,8 +857,9 @@ const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: Ch
// chnResult: [3, 4], // chnResult: [3, 4],
// deviceId: "80b4b4f52a4c4064a18319525f8ac13c", // deviceId: "80b4b4f52a4c4064a18319525f8ac13c",
// deviceName: "240002" // deviceName: "240002"
// }, { // },
// chnResult: [3, 4, 4, 4], // {
// chnResult: [1, 4, 4, 4],
// deviceId: "df23a4178d194467a432ddf45e835e48", // deviceId: "df23a4178d194467a432ddf45e835e48",
// deviceName: "240003" // deviceName: "240003"
// }, // },
@@ -994,13 +1016,6 @@ const startTimer = () => {
console.log('开始检测第' + activeIndex + '项') console.log('开始检测第' + activeIndex + '项')
switch (activeIndex) { switch (activeIndex) {
case 0: case 0:
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'yjc_ytxjy',
// operateCode: "INIT_GATHER",
// code: 10200
// })
// }, 5000)
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'yjc_ytxjy', requestId: 'yjc_ytxjy',
@@ -1008,6 +1023,28 @@ const startTimer = () => {
code: 10200 code: 10200
}) })
}, 2000) }, 2000)
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'yjc_sbtxjy',
// operateCode: 'INIT_GATHER$01',
// code: 10550,
// data: '240001'
// })
// }, 4000)
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'yjc_sbtxjy',
// operateCode: 'INIT_GATHER$01',
// code: 10550,
// data: '240004'
// })
// }, 6000)
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'error_flow_end',
// })
// }, 8000)
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'yjc_sbtxjy', requestId: 'yjc_sbtxjy',
@@ -1024,27 +1061,29 @@ const startTimer = () => {
}, 6000) }, 6000)
break; break;
case 1: case 1:
emit('update:webMsgSend', {
requestId: 'HP_Start',
})
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'FREQ_Start' requestId: 'HP_End'
}) })
}, 1000) }, 2000)
setTimeout(() => { // setTimeout(() => {
emit('update:webMsgSend', { // emit('update:webMsgSend', {
requestId: 'FREQ_End' // requestId: 'FREQ_Start'
}) // })
}, 2000); // }, 1000)
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'FREQ_End'
// })
// }, 2000);
break; break;
case 2: case 2:
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'V_Start' requestId: 'V_Start'
}) })
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'V_Start',
// code: "10552"
// })
// }, 2000)
setTimeout(() => { setTimeout(() => {
emit('update:webMsgSend', { emit('update:webMsgSend', {
requestId: 'V_End' requestId: 'V_End'
@@ -1189,6 +1228,16 @@ const handleReCheck = () => {
errorCheckItem.length = 0; errorCheckItem.length = 0;
}; };
// 获取当前执行的大测试项序号
const getActiveIndex = (code: string): number => {
for (let i = 0; i < scriptData.length; i++) {
if (scriptData[i].code === code) {
return i + 1
}
}
return -1
}
// 获取当前执行的大测试项序 的 下一个大测试项序号 // 获取当前执行的大测试项序 的 下一个大测试项序号
const getNextActiveIndex = (code: string = ''): number => { const getNextActiveIndex = (code: string = ''): number => {
if (code === '') { if (code === '') {