feat: 更新库位管理逻辑,确保添加、删除和修改库位时重新创建库位pen对象以反映最新的库位列表

This commit is contained in:
xudan 2025-09-09 10:04:35 +08:00
parent 87ef9b7212
commit 82c474f8e2

View File

@ -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) {