预检测失败处理、正式检测-只检测某一个大项,日志bug

This commit is contained in:
caozehui
2025-01-09 14:45:43 +08:00
parent 839777ea4d
commit cffbfe1380
3 changed files with 71 additions and 68 deletions

View File

@@ -4,7 +4,7 @@
<el-tab-pane label="预检测项目">
<div class="form-grid">
<el-checkbox v-for="(item, index) in detectionOptions" v-model="item.selected" :key="index"
:label="item.name"></el-checkbox>
:label="item.name"></el-checkbox>
<!-- disabled="true" -->
</div>
</el-tab-pane>
@@ -14,11 +14,11 @@
<div class="dialog-left">
<el-steps direction="vertical" :active="activeIndex" :process-status="currentStepStatus"
finish-status="success">
<el-step :status="step1" title="源通讯校验" />
<el-step :status="step2" title="设备通讯校验" />
<el-step :status="step3" title="协议校验" />
<el-step :status="step4" title="相序校验" />
<el-step :status="step5" title="检测完成" />
<el-step :status="step1" title="源通讯校验"/>
<el-step :status="step2" title="设备通讯校验"/>
<el-step :status="step3" title="协议校验"/>
<el-step :status="step4" title="相序校验"/>
<el-step :status="step5" title="检测完成"/>
</el-steps>
</div>
<div class="dialog-right">
@@ -26,32 +26,32 @@
<el-collapse-item title="源通讯校验" name="1">
<div class="div-log">
<p v-for="(item, index) in step1InitLog" :key="index"
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
{{ item.log }} <br />
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
{{ item.log }} <br/>
</p>
</div>
</el-collapse-item>
<el-collapse-item title="设备通讯校验" name="2">
<div class="div-log">
<p v-for="(item, index) in step2InitLog" :key="index"
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
{{ item.log }} <br />
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
{{ item.log }} <br/>
</p>
</div>
</el-collapse-item>
<el-collapse-item title="协议校验" name="3">
<div class="div-log">
<p v-for="(item, index) in step3InitLog" :key="index"
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
{{ item.log }} <br />
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
{{ item.log }} <br/>
</p>
</div>
</el-collapse-item>
<el-collapse-item title="相序校验" name="4">
<div class="div-log">
<p v-for="(item, index) in step4InitLog" :key="index"
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
{{ item.log }} <br />
:style="{ color: item.type === 'error' ? '#F56C6C' : 'var(--el-text-color-regular)' }">
{{ item.log }} <br/>
</p>
</div>
</el-collapse-item>
@@ -62,8 +62,9 @@
</template>
<script lang="tsx" setup name="preTest">
import {ElMessage} from "element-plus";
import { defineExpose } from 'vue';
import {ElMessage, ElMessageBox} from "element-plus";
import {defineExpose} from 'vue';
const step1InitLog = ref([
{
type: 'info',
@@ -222,21 +223,18 @@ const props = defineProps({
})
const testStatus = toRef(props, 'testStatus');
const webMsgSend = toRef(props, 'webMsgSend');
const ts = ref('');
watch(webMsgSend,function (newValue,oldValue){
// console.log(newValue)
watch(webMsgSend, function (newValue, oldValue) {
// console.log(newValue)
switch (newValue.requestId){
switch (newValue.requestId) {
case 'yjc_ytxjy':
switch (newValue.operateCode){
switch (newValue.operateCode) {
case 'INIT_GATHER':
if(newValue.code == 10200) {
if (newValue.code == 10200) {
step1InitLog.value.push({
type: 'info',
log: '源初始化成功!',
@@ -244,17 +242,17 @@ watch(webMsgSend,function (newValue,oldValue){
activeIndex.value = 1
step1.value = 'success'
step2.value = 'process'
}else if(newValue.code == 10201){
} else if (newValue.code == 10201) {
step1.value = 'process'
step1InitLog.value = [{
type: 'wait',
log: '正在进行源初始化!',
}];
}else if(newValue.code == 10552){
} else if (newValue.code == 10552) {
ElMessage.error(newValue.code)
step1.value = 'error'
ts.value = 'error'
}else if(newValue.code == 10523){
} else if (newValue.code == 10523) {
step1.value = 'error'
ts.value = 'error'
step1InitLog.value = [{
@@ -265,8 +263,6 @@ watch(webMsgSend,function (newValue,oldValue){
break;
}
break;
case 'yjc_sbtxjy':
@@ -276,7 +272,7 @@ watch(webMsgSend,function (newValue,oldValue){
if (newValue.code == 10200) {
step2InitLog.value.push({
type: 'info',
log: newValue.data+'设备通讯校验成功!',
log: newValue.data + '设备通讯校验成功!',
})
} else if (newValue.code == 10201) {
@@ -288,14 +284,14 @@ watch(webMsgSend,function (newValue,oldValue){
} else if (newValue.code == 10550) {
step2InitLog.value.push({
type: 'error',
log: newValue.data+'设备连接异常!',
log: newValue.data + '设备连接异常!',
})
step2.value = 'error'
ts.value = 'error'
}else if (newValue.code == 10551) {
} else if (newValue.code == 10551) {
step2InitLog.value.push({
type: 'error',
log: newValue.data+'设备触发报告异常!',
log: newValue.data + '设备触发报告异常!',
})
step2.value = 'error'
ts.value = 'error'
@@ -322,7 +318,7 @@ watch(webMsgSend,function (newValue,oldValue){
if (newValue.code == 10200) {
step3InitLog.value.push({
type: 'info',
log: '统计数据协议校验:'+newValue.data+'通讯协议校验成功!',
log: '统计数据协议校验:' + newValue.data + '通讯协议校验成功!',
})
} else if (newValue.code == 10201) {
@@ -334,18 +330,18 @@ watch(webMsgSend,function (newValue,oldValue){
} else if (newValue.code == 10550) {
step3InitLog.value.push({
type: 'error',
log: newValue.data+'设备连接异常!',
log: newValue.data + '设备连接异常!',
})
step3.value = 'error'
ts.value = 'error'
}else if (newValue.code == 10551) {
} else if (newValue.code == 10551) {
step3InitLog.value.push({
type: 'error',
log: newValue.data+'设备触发报告异常!',
log: newValue.data + '设备触发报告异常!',
})
step3.value = 'error'
ts.value = 'error'
}else if (newValue.code == 10552) {
} else if (newValue.code == 10552) {
step3.value = 'error'
//ElMessage.error("存在已经初始化步骤,已经自动关闭,请重新发起检测!")
step3InitLog.value = [{
@@ -359,7 +355,7 @@ watch(webMsgSend,function (newValue,oldValue){
if (newValue.code == 10200) {
step3InitLog.value.push({
type: 'info',
log: '实时数据协议校验:'+newValue.data+'通讯协议校验成功!',
log: '实时数据协议校验:' + newValue.data + '通讯协议校验成功!',
})
} else if (newValue.code == 10201) {
@@ -368,17 +364,17 @@ watch(webMsgSend,function (newValue,oldValue){
type: 'wait',
log: '正在进行通讯协议校验.....',
}];
}else if (newValue.code == 10550) {
} else if (newValue.code == 10550) {
step3InitLog.value.push({
type: 'error',
log: newValue.data+'设备连接异常!',
log: newValue.data + '设备连接异常!',
})
step3.value = 'error'
ts.value = 'error'
}else if (newValue.code == 10551) {
} else if (newValue.code == 10551) {
step3InitLog.value.push({
type: 'error',
log: newValue.data+'设备触发报告异常!',
log: newValue.data + '设备触发报告异常!',
})
step3.value = 'error'
ts.value = 'error'
@@ -396,22 +392,22 @@ watch(webMsgSend,function (newValue,oldValue){
if (newValue.code == 10200) {
step3InitLog.value.push({
type: 'info',
log: '暂态数据协议校验:'+newValue.data+'通讯协议校验成功!',
log: '暂态数据协议校验:' + newValue.data + '通讯协议校验成功!',
})
} else if (newValue.code == 10201) {
step3.value = 'process'
}else if (newValue.code == 10550) {
} else if (newValue.code == 10550) {
step3InitLog.value.push({
type: 'error',
log: newValue.data+'设备连接异常!',
log: newValue.data + '设备连接异常!',
})
step3.value = 'error'
ts.value = 'error'
}else if (newValue.code == 10551) {
} else if (newValue.code == 10551) {
step3InitLog.value.push({
type: 'error',
log: newValue.data+'设备触发报告异常!',
log: newValue.data + '设备触发报告异常!',
})
step3.value = 'error'
ts.value = 'error'
@@ -464,12 +460,12 @@ watch(webMsgSend,function (newValue,oldValue){
case 'DATA_REQUEST$02':
if (newValue.code == 10200) {
let type = 'info'
if(newValue.data.includes('不合格')){
if (newValue.data.includes('不合格')) {
type = 'error'
}
step4InitLog.value.push({
type: type,
log: '相序校验:'+newValue.data,
log: '相序校验:' + newValue.data,
})
} else if (newValue.code == 10201) {
@@ -478,8 +474,7 @@ watch(webMsgSend,function (newValue,oldValue){
type: 'wait',
log: '获取数据相序校验数据!',
}];
}
else if (newValue.code == 25001) {
} else if (newValue.code == 25001) {
step4.value = 'success'
step5.value = 'success'
step4InitLog.value.push({
@@ -496,7 +491,7 @@ watch(webMsgSend,function (newValue,oldValue){
case 'quit':
break;
case 'connect':
switch (newValue.operateCode){
switch (newValue.operateCode) {
case "Source":
step1.value = 'error'
step1InitLog.value = [{
@@ -517,15 +512,22 @@ watch(webMsgSend,function (newValue,oldValue){
break;
case 'unknown_operate':
break;
case 'error_flow_end':
ElMessageBox.alert(`设备连接异常,请检查设备连接情况!`, '检测失败', {
confirmButtonText: '确定',
type: 'error',
})
ts.value = 'error'
break;
}
})
watch(activeIndex, function (newValue, oldValue) {
if (newValue <= activeTotalNum.value - 2){
collapseActiveName.value = (newValue+1).toString()
} else{
if (newValue <= activeTotalNum.value - 2) {
collapseActiveName.value = (newValue + 1).toString()
} else {
collapseActiveName.value = (newValue - 1).toString()
}
})
@@ -536,7 +538,7 @@ watch(testStatus, function (newValue, oldValue) {
ts.value = props.testStatus;
if (ts.value === 'start') {
ts.value = 'process'
}else if(ts.value === 'waiting'){
} else if (ts.value === 'waiting') {
activeIndex.value = 0
step1InitLog.value = [
{
@@ -560,8 +562,6 @@ watch(ts, function (newValue, oldValue) {
})
// 定义一个初始化参数的方法
function initializeParameters() {
activeIndex.value = 0
@@ -599,9 +599,6 @@ function initializeParameters() {
}
defineExpose({
initializeParameters,
});

View File

@@ -33,7 +33,7 @@
<el-button
type="primary"
:icon="RefreshLeft"
v-if="testStatus === 'error'"
v-if="testStatus === 'test_recheck'"
@click="emit('sendReCheck')">重新检测
</el-button>

View File

@@ -35,7 +35,7 @@
检测中
</el-button>
<el-button type="warning" :icon="VideoPlay" v-if="ActiveStatue === 'paused'" @click="handleSubmit">继续检测</el-button>
<el-button type="primary" :icon="RefreshLeft" v-if="ActiveStatue === 'error'" @click="handleSubmit">重新检测</el-button>
<el-button type="primary" :icon="RefreshLeft" v-if="ActiveStatue === 'test_recheck'" @click="handleSubmit">重新检测</el-button>
<el-button type="primary" v-if="ActiveStatue === 'test_init'" disabled>
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
<component :is="Refresh"/>
@@ -43,7 +43,8 @@
初始化中
</el-button>
<el-button :type="ActiveStatue==='success'?'primary':'danger'" :icon="Right"
v-if="ActiveStatue === 'success'||ActiveStatue==='test_init_fail'||ActiveStatue==='connect_timeout'" @click="nextStep">
v-if="ActiveStatue === 'success'||ActiveStatue==='error'||ActiveStatue==='test_init_fail'||ActiveStatue==='connect_timeout'"
@click="nextStep">
{{ nextStepText }}
</el-button>
</div>
@@ -312,7 +313,7 @@ const handleSubmit = () => {
// }
// })
} else if (TestStatus.value == 'error') {
} else if (TestStatus.value == 'test_recheck') {
// 发送重新检测指令
sendReCheck()
@@ -359,6 +360,11 @@ watch(ActiveStatue, function (newValue, oldValue) {
stepsActiveIndex.value++;
nextStepText.value = '检测完成'
}
if (newValue === 'error' && stepsActiveIndex.value === stepsTotalNum.value - 3) {
stepsActiveIndex.value++;
stepsActiveIndex.value++;
nextStepText.value = '检测失败'
}
if (newValue === 'test_init_fail' && stepsActiveIndex.value === stepsTotalNum.value - 2) {
stepsActiveIndex.value++;
stepsActiveIndex.value++;
@@ -426,14 +432,14 @@ const getIcon = (index: number) => {
};
const nextStep = () => {
if (stepsActiveIndex.value < stepsTotalNum.value) {
if (stepsActiveIndex.value < stepsTotalNum.value && ActiveStatue.value != 'error') {
stepsActiveIndex.value++
if (!isTimeCheck.value) {//不具备守时检测,预检测后直接跳正式检测
stepsActiveIndex.value++
}
ActiveStatue.value = 'waiting'
} else if (stepsActiveIndex.value === stepsTotalNum.value) {
} else if (stepsActiveIndex.value === stepsTotalNum.value || ActiveStatue.value === 'error') {
//emit('update:visible', false); // 关闭对话框
clearData()
dialogVisible.value = false;