Quellcode durchsuchen

feat(web-admin): expose facilityNodeId on storage slot select options

Needed so batch start/end fill can verify slots belong to the same box.

Co-authored-by: Cursor <cursoragent@cursor.com>
zlwu vor 3 Monaten
Ursprung
Commit
e6c8a9c88d
1 geänderte Dateien mit 7 neuen und 3 gelöschten Zeilen
  1. 7 3
      web-admin/src/utils/storage-slot-options.ts

+ 7 - 3
web-admin/src/utils/storage-slot-options.ts

@@ -9,6 +9,8 @@ export type StorageSlotSelectOption = {
   name: string
   /** 是否可分配(空格子);已占用项仍展示但应置灰 */
   available?: boolean
+  /** 所属设施节点(盒)ID,用于同盒校验 */
+  facilityNodeId?: string
 }
 
 export type LoadStorageSlotSelectOptions = {
@@ -27,7 +29,8 @@ function mapRemoteSlotSelectOption(item: Record<string, unknown>): StorageSlotSe
   return {
     id,
     name: available ? baseName : `${baseName}(已占用)`,
-    available
+    available,
+    facilityNodeId: String(item.facilityNodeId || item.facility_node_id || '').trim() || undefined
   }
 }
 
@@ -322,7 +325,7 @@ export async function loadStorageSlotSelectOptions(
 
 export function ensureStorageSlotsInOptions(
   options: StorageSlotSelectOption[],
-  stubs: Array<{ id?: string; name?: string }>
+  stubs: Array<{ id?: string; name?: string; facilityNodeId?: string }>
 ): StorageSlotSelectOption[] {
   const next = [...options]
   const seen = new Set(next.map((o) => o.id))
@@ -333,7 +336,8 @@ export function ensureStorageSlotsInOptions(
     next.unshift({
       id,
       name: String(stub.name || id),
-      available: true
+      available: true,
+      ...(stub.facilityNodeId ? { facilityNodeId: stub.facilityNodeId } : {})
     })
   }
   return next