预检测实时数据对齐失败展示
This commit is contained in:
@@ -112,7 +112,7 @@ const tabStatus = ref<Record<string, boolean>>({});
|
||||
const hasIncompleteData = (deviceName: string) => {
|
||||
const tableData = tableDataMap.value[deviceName];
|
||||
if (!tableData || tableData.length === 0) return false;
|
||||
|
||||
|
||||
// 检查每一行是否有缺失数据(包含null的字段)
|
||||
return tableData.some(row => {
|
||||
return row.uaDev === '/' || row.ubDev === '/' || row.ucDev === '/' ||
|
||||
@@ -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] || '';
|
||||
@@ -152,7 +152,7 @@ const generateTableData = (deviceName: string, stdChannel: string) => {
|
||||
);
|
||||
|
||||
if (!channelData) return [];
|
||||
|
||||
|
||||
// 生成表格数据
|
||||
return channelData.dataList.map(dataItem => {
|
||||
return {
|
||||
@@ -174,7 +174,7 @@ const updateTableData = (deviceName: string) => {
|
||||
if (selectedChannel) {
|
||||
const tableData = generateTableData(deviceName, selectedChannel);
|
||||
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) => {
|
||||
let parsedData = data;
|
||||
|
||||
|
||||
// 如果 data 是字符串,先解析为对象
|
||||
if (typeof data === 'string') {
|
||||
try {
|
||||
@@ -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 更新后再初始化数据
|
||||
|
||||
Reference in New Issue
Block a user