处理源未知异常、检测结果最大误差回显
This commit is contained in:
@@ -48,18 +48,22 @@ export namespace CheckData {
|
||||
stdA?: string,
|
||||
dataA?: string,
|
||||
errorA?: string,
|
||||
maxErrorA?: string,
|
||||
isDataA?: number,
|
||||
stdB?: string,
|
||||
dataB?: string,
|
||||
errorB?: string,
|
||||
maxErrorB?: string,
|
||||
isDataB?: number,
|
||||
stdC?: string,
|
||||
dataC?: string,
|
||||
errorC?: string,
|
||||
maxErrorC?: string,
|
||||
isDataC?: number,
|
||||
stdT?: string,
|
||||
dataT?: string,
|
||||
errorT?: string,
|
||||
maxErrorT?: string,
|
||||
isDataT?: number,
|
||||
|
||||
//最大误差值
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<template #default="scope">
|
||||
<el-tooltip effect="dark" placement="bottom">
|
||||
<template #content>
|
||||
最大误差:{{ maxErrorStr }}<br/>
|
||||
最大误差:{{ scope.row.maxErrorA }} <br/>
|
||||
误差值:{{ scope.row.errorA }} {{ scope.row.errorA !== '/' ? unit : '' }}
|
||||
</template>
|
||||
<el-tag type="success" v-if="scope.row.isDataA === 1">符合</el-tag>
|
||||
@@ -33,7 +33,7 @@
|
||||
<template #default="scope">
|
||||
<el-tooltip effect="dark" placement="bottom">
|
||||
<template #content>
|
||||
最大误差:{{ maxErrorStr }}<br/>
|
||||
最大误差:{{ scope.row.maxErrorB }}<br/>
|
||||
误差值:{{ scope.row.errorB }} {{ scope.row.errorB !== '/' ? unit : '' }}
|
||||
</template>
|
||||
<el-tag type="success" v-if="scope.row.isDataB === 1">符合</el-tag>
|
||||
@@ -50,7 +50,7 @@
|
||||
<template #default="scope">
|
||||
<el-tooltip effect="dark" placement="bottom">
|
||||
<template #content>
|
||||
最大误差: {{ maxErrorStr }}<br/>
|
||||
最大误差: {{ scope.row.maxErrorC }}<br/>
|
||||
误差值:{{ scope.row.errorC }} {{ scope.row.errorC !== '/' ? unit : '' }}
|
||||
</template>
|
||||
<el-tag type="success" v-if="scope.row.isDataC === 1">符合</el-tag>
|
||||
@@ -70,7 +70,7 @@
|
||||
<template #default="scope">
|
||||
<el-tooltip effect="dark" placement="bottom">
|
||||
<template #content>
|
||||
最大误差: {{ maxErrorStr }}<br/>
|
||||
最大误差: {{ scope.row.maxErrorT }}<br/>
|
||||
误差值:{{ scope.row.errorT }} {{ scope.row.errorT !== '/' ? unit : '' }}
|
||||
</template>
|
||||
<el-tag type="success" v-if="scope.row.isDataT === 1">符合</el-tag>
|
||||
@@ -112,14 +112,14 @@ const phaseT = computed(() => {
|
||||
return tableData[0].dataT == null || tableData[0].dataT == undefined ? 0 : 1
|
||||
})
|
||||
|
||||
const maxErrorStr = computed((data) => {
|
||||
let result = tableData[0].maxError ?? '/'
|
||||
let idx = result.indexOf('~');
|
||||
if (idx > 0) {
|
||||
result = result.substring(0, idx) + unit.value + result.substring(idx, result.length) + unit.value;
|
||||
}
|
||||
return result;
|
||||
})
|
||||
// const maxErrorStr = computed((data) => {
|
||||
// let result = tableData[0].maxError ?? '/'
|
||||
// let idx = result.indexOf('~');
|
||||
// if (idx > 0) {
|
||||
// result = result.substring(0, idx) + unit.value + result.substring(idx, result.length) + unit.value;
|
||||
// }
|
||||
// return result;
|
||||
// })
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@@ -338,7 +338,7 @@ const updateTableData = async () => {
|
||||
} else if (keys1.length != 0) {
|
||||
let tempHarmNumList: { value: string, label: string }[] = []
|
||||
for (let [key, value] of resTableData.resultData) {
|
||||
tempHarmNumList.push({value: key, label: key})
|
||||
tempHarmNumList.push({value: key, label: value.isData === '1' ? key : value.isData === '4' ? `${key}(/)` : `${key}(不符合)`})
|
||||
}
|
||||
|
||||
Object.assign(harmNumList, tempHarmNumList)
|
||||
@@ -368,8 +368,8 @@ const open = async (_deviceId: string, chnNum: string, _scriptType: string | nul
|
||||
|
||||
chnList = resFormContent.chnList.map((item: { value: string, label: string }) => ({
|
||||
value: item.value,
|
||||
label: item.value
|
||||
// label: item.label == '1' ? `${item.value}` : `${item.value}(不符合)`
|
||||
// label: item.value
|
||||
label: item.label == '1' ? `${item.value}` : item.label == '4' ? `${item.value}(/)` : `${item.value}(不符合)`
|
||||
}))
|
||||
|
||||
let dataRuleName = dictStore.getDictData('Data_Rule').find(item => item.id == resFormContent.dataRule)?.name
|
||||
@@ -417,14 +417,17 @@ const setCheckResultData = (data: CheckData.ResCheckResult) => {
|
||||
stdA: numberToFixed(data.dataA.resultData),
|
||||
dataA: numberToFixed(data.dataA.data),
|
||||
errorA: getError(data.dataA.resultData, data.dataA.data),
|
||||
maxErrorA: toMaxErrorStr(data.dataA.radius, data.unit),
|
||||
isDataA: data.dataA.isData,
|
||||
stdB: numberToFixed(data.dataB.resultData),
|
||||
dataB: numberToFixed(data.dataB.data),
|
||||
errorB: getError(data.dataB.resultData, data.dataB.data),
|
||||
maxErrorB: toMaxErrorStr(data.dataB.radius, data.unit),
|
||||
isDataB: data.dataB.isData,
|
||||
stdC: numberToFixed(data.dataC.resultData),
|
||||
dataC: numberToFixed(data.dataC.data),
|
||||
errorC: getError(data.dataC.resultData, data.dataC.data),
|
||||
maxErrorC: toMaxErrorStr(data.dataC.radius, data.unit),
|
||||
isDataC: data.dataC.isData,
|
||||
|
||||
maxError: data.radius,
|
||||
@@ -438,6 +441,7 @@ const setCheckResultData = (data: CheckData.ResCheckResult) => {
|
||||
stdT: numberToFixed(data.dataT.resultData),
|
||||
dataT: numberToFixed(data.dataT.data),
|
||||
errorT: getError(data.dataT.resultData, data.dataT.data),
|
||||
maxErrorT: toMaxErrorStr(data.dataT.radius, data.unit),
|
||||
isDataT: data.dataT?.isData,
|
||||
|
||||
maxError: data.radius,
|
||||
@@ -474,6 +478,15 @@ const getError = (num1: number, num2: number): string => {
|
||||
return Math.abs(Number(numberToFixed(num1)) - Number(numberToFixed(num2))).toFixed(fixed)
|
||||
}
|
||||
|
||||
const toMaxErrorStr = (oldMaxErroe: any, unit: any) => {
|
||||
let result = oldMaxErroe ?? '/'
|
||||
let idx = result.indexOf('~');
|
||||
if (idx > 0) {
|
||||
result = result.substring(0, idx) + unit + result.substring(idx, result.length) + unit;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
const findFirstLeafNode = (node: any): any => {
|
||||
if (!node.children || node.children.length === 0) {
|
||||
return node;
|
||||
|
||||
@@ -259,6 +259,13 @@ watch(webMsgSend, function (newValue, oldValue) {
|
||||
type: 'error',
|
||||
log: '源连接失败!',
|
||||
}];
|
||||
} else if (newValue.code == -1) {
|
||||
step1.value = 'error'
|
||||
ts.value = 'error'
|
||||
step1InitLog.value = [{
|
||||
type: 'error',
|
||||
log: '源未知异常!',
|
||||
}];
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -383,6 +383,14 @@ watch(webMsgSend, function (newValue, oldValue) {
|
||||
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:源初始化成功!`})
|
||||
percentage.value = 1
|
||||
}
|
||||
if (newValue.code == -1) {
|
||||
ElMessageBox.alert('源未知异常!', '初始化失败', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error',
|
||||
})
|
||||
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:源未知异常!`})
|
||||
emit('update:testStatus', 'test_init_fail')
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -1066,24 +1074,16 @@ const startTimer = () => {
|
||||
}, 6000)
|
||||
break;
|
||||
case 1:
|
||||
emit('update:webMsgSend', {
|
||||
requestId: 'HP_Start',
|
||||
})
|
||||
setTimeout(() => {
|
||||
emit('update:webMsgSend', {
|
||||
requestId: 'HP_End'
|
||||
requestId: 'FREQ_Start'
|
||||
})
|
||||
}, 2000)
|
||||
// setTimeout(() => {
|
||||
// emit('update:webMsgSend', {
|
||||
// requestId: 'FREQ_Start'
|
||||
// })
|
||||
// }, 1000)
|
||||
// setTimeout(() => {
|
||||
// emit('update:webMsgSend', {
|
||||
// requestId: 'FREQ_End'
|
||||
// })
|
||||
// }, 2000);
|
||||
}, 1000)
|
||||
setTimeout(() => {
|
||||
emit('update:webMsgSend', {
|
||||
requestId: 'FREQ_End'
|
||||
})
|
||||
}, 2000);
|
||||
break;
|
||||
case 2:
|
||||
emit('update:webMsgSend', {
|
||||
|
||||
@@ -261,10 +261,8 @@ const handleSubmit = () => {
|
||||
})
|
||||
TestStatus.value = 'error'
|
||||
}
|
||||
if (res.code === 'A0000') {
|
||||
preTestStatus.value = 'start'
|
||||
}
|
||||
})
|
||||
preTestStatus.value = 'start'
|
||||
break;
|
||||
case 1:
|
||||
timeTestStatus.value = 'start'
|
||||
@@ -288,9 +286,6 @@ const handleSubmit = () => {
|
||||
})
|
||||
TestStatus.value = 'test_init_fail'
|
||||
}
|
||||
if (res.code === 'A0000') {
|
||||
TestStatus.value = 'start'
|
||||
}
|
||||
/* if (res.code === 20000) {
|
||||
TestStatus.value = 'start'
|
||||
webMsgSend.value = ''
|
||||
@@ -298,34 +293,10 @@ const handleSubmit = () => {
|
||||
ElMessage.error(res.message)
|
||||
}*/
|
||||
})
|
||||
} else
|
||||
// if (TestStatus.value == 'process') {
|
||||
// // 发送暂停指令
|
||||
// sendPause()
|
||||
// // pauseTest({deviceIds}).then(res => {
|
||||
// // console.log(res)
|
||||
// // if (res.code === 20000) {
|
||||
// // TestStatus.value = 'paused'
|
||||
// // webMsgSend.value = ''
|
||||
// // } else {
|
||||
// // ElMessage.error(res.message)
|
||||
// // }
|
||||
// // })
|
||||
//
|
||||
// } else
|
||||
if (TestStatus.value == 'paused') {
|
||||
TestStatus.value = 'start'
|
||||
} else if (TestStatus.value == 'paused') {
|
||||
// 发送继续指令
|
||||
sendResume()
|
||||
// resumeTest({deviceIds}).then(res => {
|
||||
// console.log(res)
|
||||
// if (res.code === 20000) {
|
||||
// TestStatus.value = 'process'
|
||||
// webMsgSend.value = ''
|
||||
// } else {
|
||||
// ElMessage.error(res.message)
|
||||
// }
|
||||
// })
|
||||
|
||||
} else if (TestStatus.value == 'test_recheck') {
|
||||
// 发送重新检测指令
|
||||
sendReCheck()
|
||||
@@ -432,10 +403,8 @@ const sendReCheck = () => {
|
||||
})
|
||||
TestStatus.value = 'test_init_fail'
|
||||
}
|
||||
if (res.code === 'A0000') {
|
||||
TestStatus.value = 'start'
|
||||
}
|
||||
})
|
||||
TestStatus.value = 'start'
|
||||
}
|
||||
|
||||
const getIcon = (index: number) => {
|
||||
|
||||
Reference in New Issue
Block a user