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 result
})
@@ -312,12 +313,12 @@ watch(testStatus, function (newValue, oldValue) {
watch(webMsgSend, function (newValue, oldValue) {
if (newValue.code == 10550) {
ElMessageBox.alert(`${newValue.data}设备通讯失败,请检查设备连接情况!`, '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}设备通讯失败`})
emit('update:testStatus', 'test_init_fail')
// ElMessageBox.alert(`${newValue.data}设备通讯失败,请检查设备连接情况!`, '初始化失败', {
// confirmButtonText: '确定',
// type: 'error',
// })
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}设备连接异常`})
// emit('update:testStatus', 'test_init_fail')
} else if (newValue.code == 10551) {
ElMessageBox.alert(`${newValue.data}设备触发报告异常!`, '初始化失败', {
confirmButtonText: '确定',
@@ -337,6 +338,13 @@ watch(webMsgSend, function (newValue, oldValue) {
emit('update:testStatus', 'error')
} else {
switch (newValue.requestId) {
case 'error_flow_end':
ElMessageBox.alert(`设备连接异常,请检查设备连接情况!`, '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
emit('update:testStatus', 'test_init_fail')
break
case 'socket_timeout':
switch (newValue.operateCode) {
case "VOLTAGE":
@@ -349,25 +357,25 @@ watch(webMsgSend, function (newValue, oldValue) {
break;
}
break;
case 'connect':
switch (newValue.operateCode) {
case "Source":
ElMessageBox.alert('源通讯失败,请检查源连接情况!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:源通讯失败!`})
break;
case "Dev":
ElMessageBox.alert('设备通讯失败,请检查设备连接情况!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:设备通讯失败!`})
break;
}
emit('update:testStatus', 'test_init_fail')
break;
case 'connect':
switch (newValue.operateCode) {
case "Source":
ElMessageBox.alert('源通讯失败,请检查源连接情况!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:源通讯失败!`})
break;
case "Dev":
ElMessageBox.alert('设备通讯失败,请检查设备连接情况!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:设备通讯失败!`})
break;
}
emit('update:testStatus', 'test_init_fail')
break;
case 'yjc_ytxjy':
switch (newValue.operateCode) {
case 'INIT_GATHER':
@@ -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()}:初始化成功!`})
percentage.value = 3
activeIndex = getNextActiveIndex() + 2
//startTimer()
@@ -421,6 +430,7 @@ watch(webMsgSend, function (newValue, oldValue) {
ElMessage.error('无法继续检测')
break;
case 'FREQ_Start':
activeIndex = getActiveIndex('FREQ')
updateCheckResultView("FREQ", true)
updateLog(true)
break;
@@ -434,6 +444,7 @@ watch(webMsgSend, function (newValue, oldValue) {
}
break;
case 'V_Start':
activeIndex = getActiveIndex('V')
updateCheckResultView("V", true)
updateLog(true)
break;
@@ -447,6 +458,7 @@ watch(webMsgSend, function (newValue, oldValue) {
}
break;
case 'HV_Start':
activeIndex = getActiveIndex('HV')
updateCheckResultView("HV", true)
updateLog(true)
break;
@@ -460,6 +472,7 @@ watch(webMsgSend, function (newValue, oldValue) {
}
break;
case 'HI_Start':
activeIndex = getActiveIndex('HI')
updateCheckResultView("HI", true)
updateLog(true)
break;
@@ -473,6 +486,7 @@ watch(webMsgSend, function (newValue, oldValue) {
}
break;
case 'HP_Start':
activeIndex = getActiveIndex('HP')
updateCheckResultView("HP", true)
updateLog(true)
break;
@@ -486,6 +500,7 @@ watch(webMsgSend, function (newValue, oldValue) {
}
break;
case 'HSV_Start':
activeIndex = getActiveIndex('HSV')
updateCheckResultView("HSV", true)
updateLog(true)
break;
@@ -499,6 +514,7 @@ watch(webMsgSend, function (newValue, oldValue) {
}
break;
case 'HSI_Start':
activeIndex = getActiveIndex('HSI')
updateCheckResultView("HSI", true)
updateLog(true)
break;
@@ -512,6 +528,7 @@ watch(webMsgSend, function (newValue, oldValue) {
}
break;
case 'VOLTAGE_Start':
activeIndex = getActiveIndex('VOLTAGE')
updateCheckResultView("VOLTAGE", true)
updateLog(true)
break;
@@ -525,6 +542,7 @@ watch(webMsgSend, function (newValue, oldValue) {
}
break;
case 'I_Start':
activeIndex = getActiveIndex('I')
updateCheckResultView("I", true)
updateLog(true)
break;
@@ -538,6 +556,7 @@ watch(webMsgSend, function (newValue, oldValue) {
}
break;
case 'IMBV_Start':
activeIndex = getActiveIndex('IMBV')
updateCheckResultView("IMBV", true)
updateLog(true)
break;
@@ -551,6 +570,7 @@ watch(webMsgSend, function (newValue, oldValue) {
}
break;
case 'IMBA_Start':
activeIndex = getActiveIndex('IMBA')
updateCheckResultView("IMBA", true)
updateLog(true)
break;
@@ -564,6 +584,7 @@ watch(webMsgSend, function (newValue, oldValue) {
}
break;
case 'F_Start':
activeIndex = getActiveIndex('F')
updateCheckResultView("F", true)
updateLog(true)
break;
@@ -836,8 +857,9 @@ const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: Ch
// chnResult: [3, 4],
// deviceId: "80b4b4f52a4c4064a18319525f8ac13c",
// deviceName: "240002"
// }, {
// chnResult: [3, 4, 4, 4],
// },
// {
// chnResult: [1, 4, 4, 4],
// deviceId: "df23a4178d194467a432ddf45e835e48",
// deviceName: "240003"
// },
@@ -994,13 +1016,6 @@ const startTimer = () => {
console.log('开始检测第' + activeIndex + '项')
switch (activeIndex) {
case 0:
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'yjc_ytxjy',
// operateCode: "INIT_GATHER",
// code: 10200
// })
// }, 5000)
setTimeout(() => {
emit('update:webMsgSend', {
requestId: 'yjc_ytxjy',
@@ -1008,6 +1023,28 @@ const startTimer = () => {
code: 10200
})
}, 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(() => {
emit('update:webMsgSend', {
requestId: 'yjc_sbtxjy',
@@ -1024,27 +1061,29 @@ const startTimer = () => {
}, 6000)
break;
case 1:
emit('update:webMsgSend', {
requestId: 'HP_Start',
})
setTimeout(() => {
emit('update:webMsgSend', {
requestId: 'FREQ_Start'
requestId: 'HP_End'
})
}, 1000)
setTimeout(() => {
emit('update:webMsgSend', {
requestId: 'FREQ_End'
})
}, 2000);
}, 2000)
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'FREQ_Start'
// })
// }, 1000)
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'FREQ_End'
// })
// }, 2000);
break;
case 2:
emit('update:webMsgSend', {
requestId: 'V_Start'
})
// setTimeout(() => {
// emit('update:webMsgSend', {
// requestId: 'V_Start',
// code: "10552"
// })
// }, 2000)
setTimeout(() => {
emit('update:webMsgSend', {
requestId: 'V_End'
@@ -1189,6 +1228,16 @@ const handleReCheck = () => {
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 => {
if (code === '') {