diff --git a/src/components/card/point-edit-card.vue b/src/components/card/point-edit-card.vue index 9b05c0b..9716612 100644 --- a/src/components/card/point-edit-card.vue +++ b/src/components/card/point-edit-card.vue @@ -104,6 +104,9 @@ function onAddLocation() { const defaultName = generateDefaultLocationName(); p.associatedStorageLocations.push(defaultName); editor.value.updatePen(props.id!, { point: { ...p } }, false); + + // 重新创建库位pen对象以反映最新的库位列表 + editor.value.createStorageLocationPens(props.id!, p.associatedStorageLocations); } function onRemoveLocation(i: number) { const p = point.value!; @@ -128,6 +131,9 @@ function onRemoveLocation(i: number) { p.associatedStorageLocations.splice(i, 1); editor.value.updatePen(props.id!, { point: { ...p } }, false); + // 重新创建库位pen对象以反映最新的库位列表 + editor.value.createStorageLocationPens(props.id!, p.associatedStorageLocations); + // 同步更新地图文件中的binLocationList(删除库位) if (pointName && removedLocationName) { editor.value.removeBinLocation(pointName, removedLocationName); @@ -141,6 +147,9 @@ function onRemoveLocation(i: number) { p.associatedStorageLocations.splice(i, 1); editor.value.updatePen(props.id!, { point: { ...p } }, false); + // 重新创建库位pen对象以反映最新的库位列表 + editor.value.createStorageLocationPens(props.id!, p.associatedStorageLocations); + // 同步更新地图文件中的binLocationList(删除库位) if (pointName && removedLocationName) { editor.value.removeBinLocation(pointName, removedLocationName); @@ -159,6 +168,9 @@ function onChangeLocation(i: number, v: string) { p.associatedStorageLocations[i] = newLocationName; editor.value.updatePen(props.id!, { point: { ...p } }, false); + // 重新创建库位pen对象以反映最新的库位列表 + editor.value.createStorageLocationPens(props.id!, p.associatedStorageLocations); + // 同步更新地图文件中的binLocationList const pointName = pen.value?.label || pen.value?.id || ''; if (pointName && oldLocationName !== newLocationName) {