预见测代码

This commit is contained in:
2024-12-20 16:32:03 +08:00
parent 5f0b36b3bb
commit bbe23e1b14
5 changed files with 330 additions and 33 deletions

View File

@@ -62,6 +62,8 @@
</template>
<script lang="tsx" setup name="preTest">
import {ElMessage} from "element-plus";
const step1InitLog = ref([
{
type: 'info',
@@ -206,28 +208,133 @@ const props = defineProps({
testStatus: {
type: String,
default: 'wait'
},
webMsgSend: {
type: Object,
default: () => ({})
}
})
const testStatus = toRef(props, 'testStatus');
const webMsgSend = toRef(props, 'webMsgSend');
const ts = ref('');
watch(webMsgSend,function (newValue,oldValue){
console.log(newValue)
switch (newValue.requestId){
case 'yjc_ytxjy':
switch (newValue.operateCode){
case 'INIT_GATHER':
if(newValue.code == 10200) {
step1InitLog.value.push({
type: 'info',
log: '源校验成功!',
})
activeIndex.value++
}else if(newValue.code == 10201){
step1InitLog.value = [{
type: 'wait',
log: '正在进行源校验!',
}];
}else if(newValue.code == 10552){
ElMessage.error(newValue.code)
}
break;
}
break;
case 'yjc_sbtxjy':
switch (newValue.operateCode) {
case 'INIT_GATHER$01':
if (newValue.code == 10200) {
step2InitLog.value.push({
type: 'info',
log: newValue.data+'设备通讯校验成功!',
})
} else if (newValue.code == 10201) {
step2InitLog.value = [{
type: 'wait',
log: '正在进行设备通讯校验.....',
}];
} else if (newValue.code == 10552) {
ElMessage.error(newValue.code)
} else if (newValue.code == 25001) {
activeIndex.value++
}
break;
}
break;
case 'yjc_xyjy':
switch (newValue.operateCode) {
case 'INIT_GATHER$02':
if (newValue.code == 10200) {
step3InitLog.value.push({
type: 'info',
log: '实时数据协议校验:'+newValue.data+'通讯协议校验成功!',
})
} else if (newValue.code == 10201) {
step3InitLog.value = [{
type: 'wait',
log: '正在进行通讯协议校验.....',
}];
} else if (newValue.code == 10552) {
ElMessage.error(newValue.code)
}
break;
case 'INIT_GATHER$03':
if (newValue.code == 10200) {
step3InitLog.value.push({
type: 'info',
log: '暂态数据协议校验:'+newValue.data+'通讯协议校验成功!',
})
} else if (newValue.code == 10201) {
} else if (newValue.code == 10552) {
ElMessage.error(newValue.code)
} else if (newValue.code == 25001) {
activeIndex.value++
}
break;
}
break;
case 'YJC_xujy':
break;
case 'quit':
break;
}
})
watch(activeIndex, function (newValue, oldValue) {
console.log(activeIndex.value)
if (activeIndex.value === 1) {
step1InitLog.value.length = 0;
step1InitLog.value = step1Log.value;
}
if (activeIndex.value === 2) {
step2InitLog.value.length = 0;
step2InitLog.value = step2Log.value;
}
if (activeIndex.value === 3) {
step3InitLog.value.length = 0;
step3InitLog.value = step3Log.value;
}
if (activeIndex.value > 3) {
step4InitLog.value.length = 0;
step4InitLog.value = step4Log.value;
}
if (activeIndex.value < activeTotalNum.value - 2)
collapseActiveName.value = (newValue + 1).toString()
@@ -241,7 +348,7 @@ watch(testStatus, function (newValue, oldValue) {
if (ts.value === 'start') {
ts.value = 'process'
let timer = setInterval(() => {
/*let timer = setInterval(() => {
if (activeIndex.value < activeTotalNum.value - 2)
activeIndex.value++
else if (activeIndex.value === activeTotalNum.value - 2) {
@@ -253,7 +360,15 @@ watch(testStatus, function (newValue, oldValue) {
ts.value = 'success'
}
}, 1500);
}, 1500);*/
}else if(ts.value === 'waiting'){
activeIndex.value = 0
step1InitLog.value = [
{
type: 'info',
log: '暂无数据,等待检测开始',
},
]
}
})