From b35fe5e98be47f6e2af4b094caedd390d5fb514c Mon Sep 17 00:00:00 2001 From: xudan Date: Wed, 6 Aug 2025 09:14:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A2=9E=E5=BC=BA=E5=BA=93=E4=BD=8D?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=95=B0=E6=8D=AE=E5=A4=84=E7=90=86=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E6=B7=BB=E5=8A=A0=E9=94=99=E8=AF=AF=E5=A4=84?= =?UTF-8?q?=E7=90=86=E5=92=8C=E6=95=B0=E6=8D=AE=E9=AA=8C=E8=AF=81=EF=BC=8C?= =?UTF-8?q?=E7=A1=AE=E4=BF=9D=E7=BB=84=E4=BB=B6=E7=A8=B3=E5=AE=9A=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/card/point-detail-card.vue | 71 +++++++++++++++-------- 1 file changed, 47 insertions(+), 24 deletions(-) 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 ?? '未知') }}