预检测实时数据对齐失败展示
This commit is contained in:
@@ -348,6 +348,7 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
log: '正在进行实时数据对齐检验.....',
|
log: '正在进行实时数据对齐检验.....',
|
||||||
}];
|
}];
|
||||||
}else if (newValue.code == 25002) { //单个监测点失败
|
}else if (newValue.code == 25002) { //单个监测点失败
|
||||||
|
|
||||||
step3InitLog.value.push({
|
step3InitLog.value.push({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
log: newValue.data + '实时数据对齐检验失败!',
|
log: newValue.data + '实时数据对齐检验失败!',
|
||||||
@@ -359,10 +360,12 @@ watch(webMsgSend, function (newValue, oldValue) {
|
|||||||
activeIndex.value = 3
|
activeIndex.value = 3
|
||||||
testDataStructure.value = newValue.data
|
testDataStructure.value = newValue.data
|
||||||
}else if (newValue.code == 25003) { //最终失败
|
}else if (newValue.code == 25003) { //最终失败
|
||||||
|
|
||||||
isShowDialog.value = true
|
isShowDialog.value = true
|
||||||
step3.value = 'error'
|
step3.value = 'error'
|
||||||
ts.value = 'error'
|
ts.value = 'error'
|
||||||
step5.value = 'error'
|
step5.value = 'error'
|
||||||
|
testDataStructure.value = newValue.data
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -562,11 +565,13 @@ function initializeParameters() {
|
|||||||
]
|
]
|
||||||
|
|
||||||
// 清空实时数据对齐验证的数据
|
// 清空实时数据对齐验证的数据
|
||||||
|
|
||||||
testDataStructure.value = {}
|
testDataStructure.value = {}
|
||||||
isShowDialog.value = false
|
isShowDialog.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
const openDialog = () => {
|
const openDialog = () => {
|
||||||
|
|
||||||
realTimeDataRef.value.open(props.mapping,testDataStructure.value)
|
realTimeDataRef.value.open(props.mapping,testDataStructure.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ const tabStatus = ref<Record<string, boolean>>({});
|
|||||||
const hasIncompleteData = (deviceName: string) => {
|
const hasIncompleteData = (deviceName: string) => {
|
||||||
const tableData = tableDataMap.value[deviceName];
|
const tableData = tableDataMap.value[deviceName];
|
||||||
if (!tableData || tableData.length === 0) return false;
|
if (!tableData || tableData.length === 0) return false;
|
||||||
|
|
||||||
// 检查每一行是否有缺失数据(包含null的字段)
|
// 检查每一行是否有缺失数据(包含null的字段)
|
||||||
return tableData.some(row => {
|
return tableData.some(row => {
|
||||||
return row.uaDev === '/' || row.ubDev === '/' || row.ucDev === '/' ||
|
return row.uaDev === '/' || row.ubDev === '/' || row.ucDev === '/' ||
|
||||||
@@ -122,7 +122,7 @@ const hasIncompleteData = (deviceName: string) => {
|
|||||||
|
|
||||||
// 获取映射的被检设备通道
|
// 获取映射的被检设备通道
|
||||||
const getMappedDutChannel = (deviceName: string, stdChannel: string) => {
|
const getMappedDutChannel = (deviceName: string, stdChannel: string) => {
|
||||||
console.log('getMappedDutChannel', deviceName, stdChannel,channelMapping.value);
|
|
||||||
// 添加安全检查
|
// 添加安全检查
|
||||||
if (!channelMapping.value[deviceName]) return '';
|
if (!channelMapping.value[deviceName]) return '';
|
||||||
return channelMapping.value[deviceName][stdChannel] || '';
|
return channelMapping.value[deviceName][stdChannel] || '';
|
||||||
@@ -152,7 +152,7 @@ const generateTableData = (deviceName: string, stdChannel: string) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (!channelData) return [];
|
if (!channelData) return [];
|
||||||
|
|
||||||
// 生成表格数据
|
// 生成表格数据
|
||||||
return channelData.dataList.map(dataItem => {
|
return channelData.dataList.map(dataItem => {
|
||||||
return {
|
return {
|
||||||
@@ -174,7 +174,7 @@ const updateTableData = (deviceName: string) => {
|
|||||||
if (selectedChannel) {
|
if (selectedChannel) {
|
||||||
const tableData = generateTableData(deviceName, selectedChannel);
|
const tableData = generateTableData(deviceName, selectedChannel);
|
||||||
tableDataMap.value[deviceName] = tableData;
|
tableDataMap.value[deviceName] = tableData;
|
||||||
console.log('tableDataMap:', tableDataMap.value);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -204,7 +204,7 @@ const initAllTableData = () => {
|
|||||||
|
|
||||||
const open = async (mapping : Record<string, Record<string, string>>,data : any) => {
|
const open = async (mapping : Record<string, Record<string, string>>,data : any) => {
|
||||||
let parsedData = data;
|
let parsedData = data;
|
||||||
|
|
||||||
// 如果 data 是字符串,先解析为对象
|
// 如果 data 是字符串,先解析为对象
|
||||||
if (typeof data === 'string') {
|
if (typeof data === 'string') {
|
||||||
try {
|
try {
|
||||||
@@ -217,8 +217,10 @@ const open = async (mapping : Record<string, Record<string, string>>,data : any)
|
|||||||
}
|
}
|
||||||
// 转换数据格式以匹配组件期望的格式
|
// 转换数据格式以匹配组件期望的格式
|
||||||
const convertedData: Record<string, DeviceData> = {};
|
const convertedData: Record<string, DeviceData> = {};
|
||||||
|
|
||||||
// 假设传入的数据是一个数组,需要转换为以设备名为键的对象
|
// 假设传入的数据是一个数组,需要转换为以设备名为键的对象
|
||||||
if (Array.isArray(parsedData)) {
|
if (Array.isArray(parsedData)) {
|
||||||
|
|
||||||
parsedData.forEach((deviceItem: any) => {
|
parsedData.forEach((deviceItem: any) => {
|
||||||
const deviceName = deviceItem.stdDevName;
|
const deviceName = deviceItem.stdDevName;
|
||||||
convertedData[deviceName] = {
|
convertedData[deviceName] = {
|
||||||
@@ -240,11 +242,13 @@ const open = async (mapping : Record<string, Record<string, string>>,data : any)
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
} else if (parsedData && typeof parsedData === 'object') {
|
} else if (parsedData && typeof parsedData === 'object') {
|
||||||
|
|
||||||
// 如果已经是期望的格式,直接使用
|
// 如果已经是期望的格式,直接使用
|
||||||
Object.assign(convertedData, parsedData);
|
Object.assign(convertedData, parsedData);
|
||||||
}
|
}
|
||||||
|
|
||||||
testDataStructure.value = convertedData;
|
testDataStructure.value = convertedData;
|
||||||
console.log('testDataStructure:', testDataStructure.value);
|
|
||||||
channelMapping.value = mapping;
|
channelMapping.value = mapping;
|
||||||
dialogVisible.value = true;
|
dialogVisible.value = true;
|
||||||
// 使用 nextTick 确保 DOM 更新后再初始化数据
|
// 使用 nextTick 确保 DOM 更新后再初始化数据
|
||||||
|
|||||||
Reference in New Issue
Block a user