diff --git a/src/components/card/point-detail-card.vue b/src/components/card/point-detail-card.vue index 68667c3..101d034 100644 --- a/src/components/card/point-detail-card.vue +++ b/src/components/card/point-detail-card.vue @@ -138,32 +138,55 @@ const parseBinTask = (binTaskString: string): BinTaskItem[] => { // 获取当前动作点对应的库位任务数据 const binTaskData = computed(() => { - const rawData = editor.value.getBinLocationsList(); + try { + const rawData = editor.value.getBinLocationsList(); - if (!rawData || !point.value) return []; + if (!rawData || !point.value) return []; - const currentPointName = pen.value?.label || pen.value?.id; - if (!currentPointName) return []; + const currentPointName = pen.value?.label || pen.value?.id; + if (!currentPointName) return []; - // 获取库位组数据 - const binLocationGroups = Array.isArray(rawData) - ? (rawData as BinLocationGroup[]) - : (rawData as BinLocationsList)?.binLocationsList; + // 获取库位组数据 + const binLocationGroups = Array.isArray(rawData) + ? (rawData as BinLocationGroup[]) + : (rawData as BinLocationsList)?.binLocationsList; - if (!binLocationGroups) return []; + if (!binLocationGroups || !Array.isArray(binLocationGroups)) return []; - const allBinLocations = binLocationGroups.flatMap((group) => group.binLocationList); + const allBinLocations = binLocationGroups + .filter((group) => group && Array.isArray(group.binLocationList)) + .flatMap((group) => group.binLocationList) + .filter((item) => item && typeof item === 'object'); - return allBinLocations - .filter((item) => item.pointName === currentPointName) - .map((item) => { - const binTaskProperty = item.property.find((prop) => prop.key === 'binTask'); - return { - instanceName: item.instanceName, - binTasks: binTaskProperty ? parseBinTask(binTaskProperty.stringValue) : [], - }; - }) - .filter((item) => item.binTasks.length > 0); + return allBinLocations + .filter((item) => item.pointName === currentPointName) + .map((item) => { + try { + if (!item.property || !Array.isArray(item.property)) { + return { + instanceName: item.instanceName || '未知库位', + binTasks: [], + }; + } + + const binTaskProperty = item.property.find((prop) => prop && prop.key === 'binTask'); + return { + instanceName: item.instanceName || '未知库位', + binTasks: binTaskProperty && binTaskProperty.stringValue ? parseBinTask(binTaskProperty.stringValue) : [], + }; + } catch (error) { + console.error('处理库位任务数据失败:', error, item); + return { + instanceName: item.instanceName || '未知库位', + binTasks: [], + }; + } + }) + .filter((item) => item.binTasks.length > 0); + } catch (error) { + console.error('获取库位任务数据失败:', error); + return []; + } }); @@ -271,24 +294,24 @@ const binTaskData = computed(() => { {{ binLocation.instanceName }}
-
+
装载
{{ key }}: - {{ typeof value === 'boolean' ? (value ? '是' : '否') : value }} + {{ typeof value === 'boolean' ? (value ? '是' : '否') : (value ?? '未知') }}
-
+
卸载
{{ key }}: - {{ typeof value === 'boolean' ? (value ? '是' : '否') : value }} + {{ typeof value === 'boolean' ? (value ? '是' : '否') : (value ?? '未知') }}