From 7972683f56368cd8ce7ef8bb7f1d087416f4a3e7 Mon Sep 17 00:00:00 2001
From: chen.lin <1442464845@qq.com>
Date: 星期一, 02 二月 2026 13:23:35 +0800
Subject: [PATCH] 容器管理-编辑可入库区  选中数据排序  选择文字排序 兼容修改后的其他调用方法

---
 rsf-admin/src/page/basicInfo/basStation/CrossZoneAreaField.jsx |   38 ++++++++++++++++++++++++++++++++++++--
 1 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/rsf-admin/src/page/basicInfo/basStation/CrossZoneAreaField.jsx b/rsf-admin/src/page/basicInfo/basStation/CrossZoneAreaField.jsx
index 97b0746..708d31b 100644
--- a/rsf-admin/src/page/basicInfo/basStation/CrossZoneAreaField.jsx
+++ b/rsf-admin/src/page/basicInfo/basStation/CrossZoneAreaField.jsx
@@ -24,9 +24,43 @@
 
         setLoading(true);
         try {
-            const res = await request.post(`/warehouseAreas/many/${record.areas.join(',')}`);
+            // 鎻愬彇鎺掑簭淇℃伅鍜孖D
+            // Old format: [1, 2, 3] (array of integers)
+            // New format: [{id: 1, sort: 1}, {id: 2, sort: 2}] (array of objects)
+            const isObjectArray = record.areas.length > 0 && 
+                typeof record.areas[0] === 'object' && 
+                record.areas[0] !== null && 
+                'id' in record.areas[0];
+            
+            let areaIds = [];
+            let sortMap = new Map(); // 瀛樺偍 id -> sort 鐨勬槧灏�
+            
+            if (isObjectArray) {
+                // 瀵硅薄鏁扮粍鏍煎紡锛屾彁鍙朓D鍜屾帓搴忎俊鎭�
+                areaIds = record.areas.map(area => {
+                    const id = area.id;
+                    sortMap.set(id, area.sort || 0);
+                    return id;
+                });
+            } else {
+                // 绾疘D鏁扮粍鏍煎紡
+                areaIds = record.areas.map(id => Number(id));
+            }
+            
+            const res = await request.post(`/warehouseAreas/many/${areaIds.join(',')}`);
             if (res?.data?.code === 200) {
-                setAreaNames(res.data.data || []);
+                let areas = res.data.data || [];
+                
+                // 濡傛灉鏈夋帓搴忎俊鎭紝鎸夋帓搴忓�兼帓搴�
+                if (sortMap.size > 0) {
+                    areas = areas.sort((a, b) => {
+                        const sortA = sortMap.get(a.id) || 0;
+                        const sortB = sortMap.get(b.id) || 0;
+                        return sortA - sortB;
+                    });
+                }
+                
+                setAreaNames(areas);
             }
         } catch (error) {
             console.error('鑾峰彇鍖哄煙鍚嶇О澶辫触:', error);

--
Gitblit v1.9.1