返回结果

This commit is contained in:
caozehui
2025-01-07 14:54:44 +08:00
parent ba0c577514
commit 689cc39bbc
3 changed files with 162 additions and 110 deletions

View File

@@ -300,7 +300,21 @@ watch(testStatus, function (newValue, oldValue) {
})
watch(webMsgSend, function (newValue, oldValue) {
if (newValue.code == 10552) { //todo 10552之后还会发送消息吗
if (newValue.code == 10550) {
ElMessageBox.alert(`${newValue.data}设备通讯失败,请检查设备连接情况!`, '预检测失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}设备通讯中断!`})
emit('update:testStatus', 'preTest_fail')
} else if (newValue.code == 10551) {
ElMessageBox.alert(`${newValue.data}设备触发报告异常!`, '预检测失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}设备触发报告异常!`})
emit('update:testStatus', 'preTest_fail')
} else if (newValue.code == 10552) { //todo 10552之后还会发送消息吗
ElMessageBox.alert('存在已经初始化步骤,执行自动关闭,请重新发起检测', '预检测失败', {
confirmButtonText: '确定',
type: 'error',
@@ -331,41 +345,21 @@ watch(webMsgSend, function (newValue, oldValue) {
// }
// emit('update:testStatus', 'preTest_fail')
// break;
case 'yjc_sbtxjy':
case 'YJC_xyjy':
switch (newValue.operateCode) {
case 'INIT_GATHER$01':
if (newValue.code == 10550) {
ElMessageBox.alert(`${newValue.data}设备通讯失败,请检查设备连接情况!`, '预检测失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}设备通讯中断!`})
emit('update:testStatus', 'preTest_fail')
}
if (newValue.code == 10551) {
ElMessageBox.alert(`${newValue.data}设备触发报告异常!`, '预检测失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}${newValue.data}设备触发报告异常!`})
emit('update:testStatus', 'preTest_fail')
case 'INIT_GATHER$03':
if (newValue.code == 25001) {
ElMessage.success('预检测成功!')
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:预检测成功!`})
activeIndex = getNextActiveIndex() + 2
startTimer()
emit('update:testStatus', 'process')
}
break;
}
break;
case 'YJC_xujy':
switch (newValue.operateCode) {
case 'DATA_REQUEST$02':
ElMessage.success('预检测成功!')
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:预检测成功!`})
activeIndex = getNextActiveIndex() + 2
startTimer()
emit('update:testStatus', 'process')
break
}
break;
case 'Pause_Success':
ElMessage.success('暂停成功')
emit('update:testStatus', 'paused')
@@ -388,7 +382,7 @@ watch(webMsgSend, function (newValue, oldValue) {
break;
case 'FREQ_End':
updatePercentage()
updateCheckResultView("FREQ", false)
updateCheckResultView("FREQ", false, newValue.data)
updateLog(false)
if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('FREQ')
@@ -401,7 +395,7 @@ watch(webMsgSend, function (newValue, oldValue) {
break;
case 'V_End':
updatePercentage()
updateCheckResultView("V", false)
updateCheckResultView("V", false, newValue.data)
updateLog(false)
if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('V')
@@ -414,7 +408,7 @@ watch(webMsgSend, function (newValue, oldValue) {
break;
case 'HV_End':
updatePercentage()
updateCheckResultView("HV", false)
updateCheckResultView("HV", false, newValue.data)
updateLog(false)
if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('HV')
@@ -427,7 +421,7 @@ watch(webMsgSend, function (newValue, oldValue) {
break;
case 'HI_End':
updatePercentage()
updateCheckResultView("HI", false)
updateCheckResultView("HI", false, newValue.data)
updateLog(false)
if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('HI')
@@ -440,7 +434,7 @@ watch(webMsgSend, function (newValue, oldValue) {
break;
case 'HP_End':
updatePercentage()
updateCheckResultView("HP", false)
updateCheckResultView("HP", false, newValue.data)
updateLog(false)
if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('HP')
@@ -453,7 +447,7 @@ watch(webMsgSend, function (newValue, oldValue) {
break;
case 'HSV_End':
updatePercentage()
updateCheckResultView("HSV", false)
updateCheckResultView("HSV", false, newValue.data)
updateLog(false)
if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('HSV')
@@ -466,7 +460,7 @@ watch(webMsgSend, function (newValue, oldValue) {
break;
case 'HSI_End':
updatePercentage()
updateCheckResultView("HSI", false)
updateCheckResultView("HSI", false, newValue.data)
updateLog(false)
if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('HSI')
@@ -479,7 +473,7 @@ watch(webMsgSend, function (newValue, oldValue) {
break;
case 'VOLTAGE_End':
updatePercentage()
updateCheckResultView("VOLTAGE", false)
updateCheckResultView("VOLTAGE", false, newValue.data)
updateLog(false)
if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('VOLTAGE')
@@ -492,7 +486,7 @@ watch(webMsgSend, function (newValue, oldValue) {
break;
case 'I_End':
updatePercentage()
updateCheckResultView("I", false)
updateCheckResultView("I", false, newValue.data)
updateLog(false)
if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('I')
@@ -505,7 +499,7 @@ watch(webMsgSend, function (newValue, oldValue) {
break;
case 'IMBV_End':
updatePercentage()
updateCheckResultView("IMBV", false)
updateCheckResultView("IMBV", false, newValue.data)
updateLog(false)
if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('IMBV')
@@ -518,7 +512,7 @@ watch(webMsgSend, function (newValue, oldValue) {
break;
case 'IMBA_End':
updatePercentage()
updateCheckResultView("IMBA", false)
updateCheckResultView("IMBA", false, newValue.data)
updateLog(false)
if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('IMBA')
@@ -531,7 +525,7 @@ watch(webMsgSend, function (newValue, oldValue) {
break;
case 'F_End':
updatePercentage()
updateCheckResultView("F", false)
updateCheckResultView("F", false, newValue.data)
updateLog(false)
if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('F')
@@ -727,13 +721,12 @@ const updateLog = (isStart: boolean) => {
})
}
if(activeIndex === checkTotal){
if (activeIndex === checkTotal) {
testLogList.push({
type: 'info',
log: currentTime.value + ' :检测结束,总用时' + getTimeDifference(timeDifference.value),
})
}
}
}
@@ -752,13 +745,16 @@ const updateLog = (isStart: boolean) => {
// }
// }
const updateCheckResultView = (scriptCode: string, isStart: boolean) => {
const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: any = null) => {
let scriptType = scriptData.filter(item => item.code === scriptCode)[0]?.id
let temp = null
if (isStart) {
temp = getLoadingResult(scriptType)
} else {
temp = getCheckResult(scriptType)
temp = {
scriptType,
devices,
}
}
updateCheckResult(temp)
};
@@ -816,30 +812,30 @@ const getCheckResult = (scriptType: string) => {
// }
// })
// } else {
devices = deviceList.map(item => {
let tempChnResult: CheckData.ChnCheckResultEnum[] = []
// if (item.deviceId === randomUnConnectedDeviceId && activeIndex >= randomUnConnectedRaw) {
// for (let i = 0; i < item.chnNum; i++) {
// tempChnResult.push(CheckData.ChnCheckResultEnum.UNCONNECTED)
// //errorCheckItem.push({scriptType,type:'warning'})
// }
// } else {
for (let i = 0; i < item.chnNum; i++) {
tempChnResult.push(CheckData.ChnCheckResultEnum.SUCCESS)
}
let randomNum = getRandomInt(item.chnNum * 2)
if (randomNum < item.chnNum && activeIndex >= 4 && activeIndex <= 8) {
tempChnResult[randomNum] = CheckData.ChnCheckResultEnum.FAIL
errorCheckItem.push({scriptType, type: 'error'})
}
// }
devices = deviceList.map(item => {
let tempChnResult: CheckData.ChnCheckResultEnum[] = []
// if (item.deviceId === randomUnConnectedDeviceId && activeIndex >= randomUnConnectedRaw) {
// for (let i = 0; i < item.chnNum; i++) {
// tempChnResult.push(CheckData.ChnCheckResultEnum.UNCONNECTED)
// //errorCheckItem.push({scriptType,type:'warning'})
// }
// } else {
for (let i = 0; i < item.chnNum; i++) {
tempChnResult.push(CheckData.ChnCheckResultEnum.SUCCESS)
}
let randomNum = getRandomInt(item.chnNum * 2)
if (randomNum < item.chnNum && activeIndex >= 4 && activeIndex <= 8) {
tempChnResult[randomNum] = CheckData.ChnCheckResultEnum.FAIL
errorCheckItem.push({scriptType, type: 'error'})
}
// }
return {
deviceId: item.deviceId,
deviceName: item.deviceName,
chnResult: tempChnResult,
}
})
return {
deviceId: item.deviceId,
deviceName: item.deviceName,
chnResult: tempChnResult,
}
})
// }
let tempScriptChnItem: CheckData.ScriptChnItem = {
@@ -909,8 +905,9 @@ const startTimer = () => {
}, 4000);
setTimeout(() => {
emit('update:webMsgSend', {
requestId: 'YJC_xujy',
operateCode: "DATA_REQUEST$02"
requestId: 'YJC_xyjy',
operateCode: "INIT_GATHER$03",
code: "25001"
})
}, 6000)
break;