预检测实时数据对齐失败展示

This commit is contained in:
sjl
2025-09-25 10:11:15 +08:00
parent 9ee71d29d4
commit 8ea49f9609
2 changed files with 15 additions and 6 deletions

View File

@@ -348,6 +348,7 @@ watch(webMsgSend, function (newValue, oldValue) {
log: '正在进行实时数据对齐检验.....',
}];
}else if (newValue.code == 25002) { //单个监测点失败
step3InitLog.value.push({
type: 'error',
log: newValue.data + '实时数据对齐检验失败!',
@@ -359,10 +360,12 @@ watch(webMsgSend, function (newValue, oldValue) {
activeIndex.value = 3
testDataStructure.value = newValue.data
}else if (newValue.code == 25003) { //最终失败
isShowDialog.value = true
step3.value = 'error'
ts.value = 'error'
step5.value = 'error'
testDataStructure.value = newValue.data
}
break;
}
@@ -562,11 +565,13 @@ function initializeParameters() {
]
// 清空实时数据对齐验证的数据
testDataStructure.value = {}
isShowDialog.value = false
}
const openDialog = () => {
realTimeDataRef.value.open(props.mapping,testDataStructure.value)
}

View File

@@ -122,7 +122,7 @@ const hasIncompleteData = (deviceName: string) => {
// 获取映射的被检设备通道
const getMappedDutChannel = (deviceName: string, stdChannel: string) => {
console.log('getMappedDutChannel', deviceName, stdChannel,channelMapping.value);
// 添加安全检查
if (!channelMapping.value[deviceName]) return '';
return channelMapping.value[deviceName][stdChannel] || '';
@@ -174,7 +174,7 @@ const updateTableData = (deviceName: string) => {
if (selectedChannel) {
const tableData = generateTableData(deviceName, selectedChannel);
tableDataMap.value[deviceName] = tableData;
console.log('tableDataMap:', tableDataMap.value);
}
};
@@ -217,8 +217,10 @@ const open = async (mapping : Record<string, Record<string, string>>,data : any)
}
// 转换数据格式以匹配组件期望的格式
const convertedData: Record<string, DeviceData> = {};
// 假设传入的数据是一个数组,需要转换为以设备名为键的对象
if (Array.isArray(parsedData)) {
parsedData.forEach((deviceItem: any) => {
const deviceName = deviceItem.stdDevName;
convertedData[deviceName] = {
@@ -240,11 +242,13 @@ const open = async (mapping : Record<string, Record<string, string>>,data : any)
};
});
} else if (parsedData && typeof parsedData === 'object') {
// 如果已经是期望的格式,直接使用
Object.assign(convertedData, parsedData);
}
testDataStructure.value = convertedData;
console.log('testDataStructure:', testDataStructure.value);
channelMapping.value = mapping;
dialogVisible.value = true;
// 使用 nextTick 确保 DOM 更新后再初始化数据