From 01e6aae8ac9ceea44a4a36199d27d24f5cf565df Mon Sep 17 00:00:00 2001
From: vincentlu <t1341870251@gmail.com>
Date: 星期二, 16 十二月 2025 10:46:45 +0800
Subject: [PATCH] #

---
 zy-acs-flow/src/map/areaSettings/index.jsx |   24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/zy-acs-flow/src/map/areaSettings/index.jsx b/zy-acs-flow/src/map/areaSettings/index.jsx
index 58b2c8e..c7894ab 100644
--- a/zy-acs-flow/src/map/areaSettings/index.jsx
+++ b/zy-acs-flow/src/map/areaSettings/index.jsx
@@ -20,12 +20,13 @@
 import { getAreaInfo, fetchAgvListAll, updateAreaData, removeArea } from '../http';
 
 const getAgvOptionId = (option) => {
-    // console.log(option);
-
-    if (typeof option === 'string') {
-        return option;
+    if (option == null) {
+        return '';
     }
-    return option?.value ?? option?.id ?? option?.agvNo ?? option?.code ?? option?.name ?? '';
+    if (typeof option === 'string' || typeof option === 'number') {
+        return String(option);
+    }
+    return option?.id ?? '';
 };
 
 const areAgvSelectionsEqual = (aIds = [], bIds = []) => {
@@ -34,6 +35,14 @@
     }
     const setA = new Set(aIds);
     return bIds.every(id => setA.has(id));
+};
+
+const mapSelectionToOptions = (selection = [], options = []) => {
+    const optionMap = new Map(options.map(option => [getAgvOptionId(option), option]));
+    return selection
+        .map(item => optionMap.get(item) || null)
+        .filter(Boolean);
+
 };
 
 const AreaSettings = (props) => {
@@ -101,10 +110,11 @@
             setPriority(curAreaInfo.priority ?? '');
 
             const selected = curAreaInfo.agvList || [];
-            setAgvList(selected);
+            const normalizedSelection = mapSelectionToOptions(selected, agvOptions);
+            setAgvList(normalizedSelection);
             setInitialBasic({
                 name: curAreaInfo.name || '',
-                agvIds: selected
+                agvIds: normalizedSelection.map(getAgvOptionId)
             });
 
             const codes = curAreaInfo.codeList || [];

--
Gitblit v1.9.1