预检测失败处理、正式检测-只检测某一个大项,日志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

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

View File

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

View File

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