From d20376c435557c6f02ad4aeb456e2add3b701b93 Mon Sep 17 00:00:00 2001 From: xudan Date: Tue, 5 Aug 2025 16:42:03 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=BA=93=E4=BD=8D?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E9=85=8D=E7=BD=AE=E5=8A=9F=E8=83=BD=EF=BC=8C?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E5=B9=B6=E5=B1=95=E7=A4=BA=E5=BA=93=E4=BD=8D?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=95=B0=E6=8D=AE=EF=BC=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=BB=93=E6=9E=84=E5=92=8C=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/card/point-detail-card.vue | 191 ++++++++++++++++++++++ src/services/editor.service.ts | 8 + 2 files changed, 199 insertions(+) diff --git a/src/components/card/point-detail-card.vue b/src/components/card/point-detail-card.vue index 98b55b4..7175aef 100644 --- a/src/components/card/point-detail-card.vue +++ b/src/components/card/point-detail-card.vue @@ -6,6 +6,46 @@ import sTheme from '@core/theme.service'; import { isNil } from 'lodash-es'; import { computed, inject, type InjectionKey, type ShallowRef } from 'vue'; +// 库位任务相关类型定义 +interface BinTaskOperation { + operation: string; + recfile?: string; + recognize?: boolean; + use_down_pgv?: boolean; + use_pgv?: boolean; + pgv_x_adjust?: boolean; +} + +interface BinTaskItem { + Load?: BinTaskOperation; + Unload?: BinTaskOperation; +} + +interface BinLocationProperty { + key: string; + type: string; + stringValue: string; +} + +interface BinLocationItem { + className: string; + instanceName: string; + pointName: string; + pos: { + x: number; + y: number; + }; + property: BinLocationProperty[]; +} + +interface BinLocationGroup { + binLocationList: BinLocationItem[]; +} + +interface BinLocationsList { + binLocationsList: BinLocationGroup[]; +} + type Props = { token: InjectionKey>; current?: string; @@ -85,6 +125,46 @@ const getStorageStatusTag = (location: StorageLocationInfo) => { return tags; }; + +// 解析库位任务数据 +const parseBinTask = (binTaskString: string): BinTaskItem[] => { + try { + return JSON.parse(binTaskString.replace(/\n/g, '').trim()); + } catch (error) { + console.error('解析库位任务数据失败:', error); + return []; + } +}; + +// 获取当前动作点对应的库位任务数据 +const binTaskData = computed(() => { + const rawData = editor.value.getBinLocationsList(); + + if (!rawData || !point.value) return []; + + const currentPointName = pen.value?.label || pen.value?.id; + if (!currentPointName) return []; + + // 获取库位组数据 + const binLocationGroups = Array.isArray(rawData) + ? (rawData as BinLocationGroup[]) + : (rawData as BinLocationsList)?.binLocationsList; + + if (!binLocationGroups) return []; + + const allBinLocations = binLocationGroups.flatMap((group) => group.binLocationList); + + 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); +}); @@ -259,5 +375,80 @@ const getStorageStatusTag = (location: StorageLocationInfo) => { } } } + + .bin-task-container { + .bin-task-group { + margin-bottom: 16px; + padding: 12px; + border-radius: 4px; + background-color: get-color(fill1); + border: 1px solid get-color(border1); + + &:last-child { + margin-bottom: 0; + } + + .bin-location-name { + font-weight: 600; + color: get-color(text1); + margin-bottom: 8px; + display: block; + } + + .bin-tasks { + .bin-task-item { + margin-bottom: 12px; + + &:last-child { + margin-bottom: 0; + } + + .task-operation { + margin-bottom: 8px; + padding: 8px; + border-radius: 4px; + background-color: get-color(fill2); + + &:last-child { + margin-bottom: 0; + } + + .operation-title { + font-weight: 500; + color: get-color(primary); + margin-bottom: 6px; + display: block; + } + + .operation-details { + .detail-item { + display: flex; + justify-content: space-between; + margin-bottom: 4px; + font-size: 12px; + + &:last-child { + margin-bottom: 0; + } + + .detail-key { + color: get-color(text2); + font-weight: 500; + flex-shrink: 0; + margin-right: 8px; + } + + .detail-value { + color: get-color(text1); + text-align: right; + word-break: break-all; + } + } + } + } + } + } + } + } } diff --git a/src/services/editor.service.ts b/src/services/editor.service.ts index 575d555..27a656e 100644 --- a/src/services/editor.service.ts +++ b/src/services/editor.service.ts @@ -98,6 +98,14 @@ export class EditorService extends Meta2d { return JSON.stringify(scene); } + /** + * 获取库位任务配置数据 + * @returns 库位任务配置列表 + */ + public getBinLocationsList(): unknown { + return (this.#originalSceneData as Record)?.binLocationsList; + } + /** * 加载机器人数据到编辑器 * @param groups 机器人组列表