预检测

This commit is contained in:
sjl
2025-08-12 20:17:37 +08:00
parent 919e81da8b
commit 4e8a6300dd
3 changed files with 392 additions and 244 deletions

View File

@@ -84,7 +84,6 @@
import {ElMessage, ElMessageBox, StepProps} from "element-plus";
import {defineExpose, PropType, ref, toRef, watch} from 'vue';
import RealTimeData from './realTimeDataAlign.vue'
import { el } from "element-plus/es/locale";
const realTimeDataRef = ref()
@@ -119,7 +118,7 @@ const step4InitLog = ref([
const isShowDialog = ref(true)
const isShowDialog = ref(false)
const collapseActiveName = ref('1')
const activeIndex = ref(0)
const activeTotalNum = ref(5)
@@ -176,13 +175,43 @@ const testStatus = toRef(props, 'testStatus');
const webMsgSend = toRef(props, 'webMsgSend');
const ts = ref('');
// 在 script setup 中定义接口
interface ChannelData {
devNum: string;
standardDevInfo: string;
dataList: {
timeDev: string | null;
uaDev: number | null;
ubDev: number | null;
ucDev: number | null;
timeStdDev: string | null;
uaStdDev: number | null;
ubStdDev: number | null;
ucStdDev: number | null;
}[];
}
interface DeviceData {
devName: string;
channelDataList: ChannelData[];
}
// 修改 testDataStructure 的类型声明
const testDataStructure = ref<Record<string, DeviceData>>({});
watch(webMsgSend, function (newValue, oldValue) {
console.log('webMsgSend', newValue)
if (testStatus.value !== 'waiting') {
if(newValue.code == 25004){
ElMessage.error('接收数据超时!')
ts.value = 'error'
step5.value = 'error'
}
switch (newValue.requestId) {
case 'yjc_sbtxjy':
switch (newValue.operateCode) {
case 'INIT_GATHER$01':
case 'INIT_GATHER$02':
if (newValue.code == 10200) {
step1InitLog.value.push({
type: 'info',
@@ -233,9 +262,15 @@ watch(webMsgSend, function (newValue, oldValue) {
if (newValue.code == 10200) { //单个监测点成功
step2InitLog.value.push({
type: 'info',
log: '模型一致性检验成功!',
log: newValue.data + '模型一致性检验成功!',
})
}else if (newValue.code == 25002) { //单个监测点失败
}else if (newValue.code == 10201) {
step2.value = 'process'
step2InitLog.value = [{
type: 'wait',
log: '正在进行模型一致性校验.....',
}];
} else if (newValue.code == 25002) { //单个监测点失败
step2InitLog.value.push({
type: 'error',
log: '模型一致性检验失败!',
@@ -258,18 +293,27 @@ watch(webMsgSend, function (newValue, oldValue) {
if (newValue.code == 10200) { //单个监测点成功
step3InitLog.value.push({
type: 'info',
log: '实时数据对齐检验成功!',
log: newValue.data +'实时数据对齐检验成功!',
})
}else if (newValue.code == 10201) {
step3.value = 'process'
step3InitLog.value = [{
type: 'wait',
log: '正在进行实时数据对齐检验.....',
}];
}else if (newValue.code == 25002) { //单个监测点失败
step3InitLog.value.push({
type: 'error',
log: '实时数据对齐检验失败!',
})
}else if (newValue.code == 25001) { //最终成功
step3.value = 'error'
}else if (newValue.code == 25001 && newValue.data) { //最终成功
isShowDialog.value = true
step3.value = 'success'
step4.value = 'process'
activeIndex.value = 3
testDataStructure.value = newValue.data
}else if (newValue.code == 25003) { //最终失败
isShowDialog.value = true
step3.value = 'error'
ts.value = 'error'
step5.value = 'error'
@@ -279,32 +323,19 @@ watch(webMsgSend, function (newValue, oldValue) {
break;
case 'YJC_xujy':
switch (newValue.operateCode) {
case 'OPER_GATHER':
if (newValue.code == 10552) {
step4InitLog.value.push({
type: 'error',
log: '存在已经初始化步骤,已经自动关闭,请重新发起检测',
})
step4.value = 'error'
ts.value = 'error'
step5.value = 'error'
} else if (newValue.code == 10520) {
step4InitLog.value.push({
type: 'error',
log: '解析报文异常',
})
step4.value = 'error'
ts.value = 'error'
step5.value = 'error'
}
break;
case 'DATA_REQUEST$02':
if (newValue.code == 10200) {
step4InitLog.value.push({
type: 'info',
log: newValue.data,
})
}else if(newValue.code == 25002){
}else if (newValue.code == 10201) {
step4.value = 'process'
step4InitLog.value = [{
type: 'wait',
log: '正在进行相序性检.....',
}];
} else if(newValue.code == 25002){
step4InitLog.value.push({
type: 'error',
log: '相序校验失败!',
@@ -384,7 +415,7 @@ watch(activeIndex, function (newValue, oldValue) {
if (newValue <= activeTotalNum.value - 2) {
collapseActiveName.value = (newValue + 1).toString()
} else {
collapseActiveName.value = (newValue - 1).toString()
collapseActiveName.value = newValue.toString()
}
})
@@ -416,11 +447,10 @@ watch(ts, function (newValue, oldValue) {
emit('update:testStatus', ts.value)
})
// 定义一个初始化参数的方法
function initializeParameters() {
activeIndex.value = 0
step1.value = 'process'
step1.value = 'wait'
step2.value = 'wait'
step3.value = 'wait'
step4.value = 'wait'
@@ -450,10 +480,14 @@ function initializeParameters() {
log: '暂无数据,等待检测开始',
},
]
// 清空实时数据对齐验证的数据
testDataStructure.value = {}
isShowDialog.value = false
}
const openDialog = () => {
realTimeDataRef.value.open(props.mapping)
realTimeDataRef.value.open(props.mapping,testDataStructure.value)
}
defineExpose({
@@ -461,8 +495,6 @@ defineExpose({
});
</script>
<style scoped lang="scss">
.title-icon {
margin-left: 10px;
cursor: pointer;