feat: 更新库位管理逻辑,确保添加、删除和修改库位时重新创建库位pen对象以反映最新的库位列表
This commit is contained in:
parent
87ef9b7212
commit
82c474f8e2
@ -104,6 +104,9 @@ function onAddLocation() {
|
|||||||
const defaultName = generateDefaultLocationName();
|
const defaultName = generateDefaultLocationName();
|
||||||
p.associatedStorageLocations.push(defaultName);
|
p.associatedStorageLocations.push(defaultName);
|
||||||
editor.value.updatePen(props.id!, { point: { ...p } }, false);
|
editor.value.updatePen(props.id!, { point: { ...p } }, false);
|
||||||
|
|
||||||
|
// 重新创建库位pen对象以反映最新的库位列表
|
||||||
|
editor.value.createStorageLocationPens(props.id!, p.associatedStorageLocations);
|
||||||
}
|
}
|
||||||
function onRemoveLocation(i: number) {
|
function onRemoveLocation(i: number) {
|
||||||
const p = point.value!;
|
const p = point.value!;
|
||||||
@ -128,6 +131,9 @@ function onRemoveLocation(i: number) {
|
|||||||
p.associatedStorageLocations.splice(i, 1);
|
p.associatedStorageLocations.splice(i, 1);
|
||||||
editor.value.updatePen(props.id!, { point: { ...p } }, false);
|
editor.value.updatePen(props.id!, { point: { ...p } }, false);
|
||||||
|
|
||||||
|
// 重新创建库位pen对象以反映最新的库位列表
|
||||||
|
editor.value.createStorageLocationPens(props.id!, p.associatedStorageLocations);
|
||||||
|
|
||||||
// 同步更新地图文件中的binLocationList(删除库位)
|
// 同步更新地图文件中的binLocationList(删除库位)
|
||||||
if (pointName && removedLocationName) {
|
if (pointName && removedLocationName) {
|
||||||
editor.value.removeBinLocation(pointName, removedLocationName);
|
editor.value.removeBinLocation(pointName, removedLocationName);
|
||||||
@ -141,6 +147,9 @@ function onRemoveLocation(i: number) {
|
|||||||
p.associatedStorageLocations.splice(i, 1);
|
p.associatedStorageLocations.splice(i, 1);
|
||||||
editor.value.updatePen(props.id!, { point: { ...p } }, false);
|
editor.value.updatePen(props.id!, { point: { ...p } }, false);
|
||||||
|
|
||||||
|
// 重新创建库位pen对象以反映最新的库位列表
|
||||||
|
editor.value.createStorageLocationPens(props.id!, p.associatedStorageLocations);
|
||||||
|
|
||||||
// 同步更新地图文件中的binLocationList(删除库位)
|
// 同步更新地图文件中的binLocationList(删除库位)
|
||||||
if (pointName && removedLocationName) {
|
if (pointName && removedLocationName) {
|
||||||
editor.value.removeBinLocation(pointName, removedLocationName);
|
editor.value.removeBinLocation(pointName, removedLocationName);
|
||||||
@ -159,6 +168,9 @@ function onChangeLocation(i: number, v: string) {
|
|||||||
p.associatedStorageLocations[i] = newLocationName;
|
p.associatedStorageLocations[i] = newLocationName;
|
||||||
editor.value.updatePen(props.id!, { point: { ...p } }, false);
|
editor.value.updatePen(props.id!, { point: { ...p } }, false);
|
||||||
|
|
||||||
|
// 重新创建库位pen对象以反映最新的库位列表
|
||||||
|
editor.value.createStorageLocationPens(props.id!, p.associatedStorageLocations);
|
||||||
|
|
||||||
// 同步更新地图文件中的binLocationList
|
// 同步更新地图文件中的binLocationList
|
||||||
const pointName = pen.value?.label || pen.value?.id || '';
|
const pointName = pen.value?.label || pen.value?.id || '';
|
||||||
if (pointName && oldLocationName !== newLocationName) {
|
if (pointName && oldLocationName !== newLocationName) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user