From 72dc018544454999bf0ff835befb63c4f07b05b6 Mon Sep 17 00:00:00 2001
From: wanghx <wanghx@yisa.com>
Date: Mon, 18 Dec 2023 10:36:44 +0800
Subject: [PATCH] =?UTF-8?q?fix():=20=E8=B7=AF=E5=86=85=E9=97=AE=E9=A2=98?=
 =?UTF-8?q?=E5=A4=84=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/config/character.config.js                     |  2 +-
 .../EquipmentMgm/MonitorEquipment/loadable.jsx     | 24 ++++++++++++++--------
 src/pages/SystemMgm/AreaManage/loadable.jsx        | 10 ++++-----
 src/pages/SystemMgm/OrgnizationMgm/loadable.jsx    |  4 ++--
 4 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/src/config/character.config.js b/src/config/character.config.js
index f234825..e9cdcbf 100644
--- a/src/config/character.config.js
+++ b/src/config/character.config.js
@@ -806,7 +806,7 @@ export const schedule = [
 export const pageSizeOptions = ["10", "40", "100"];
 ;
 
-const colorList = ['#3AA9FF', '#F997DF', '#F9EF97']
+const colorList = ['#3AA9FF', '#F997DF', '#F9EF97', '#f40']
 import utils from "@/config/utils"
 
 export const pieChartOption = {
diff --git a/src/pages/InRoadMgm/EquipmentMgm/MonitorEquipment/loadable.jsx b/src/pages/InRoadMgm/EquipmentMgm/MonitorEquipment/loadable.jsx
index 3713e29..aec96b1 100644
--- a/src/pages/InRoadMgm/EquipmentMgm/MonitorEquipment/loadable.jsx
+++ b/src/pages/InRoadMgm/EquipmentMgm/MonitorEquipment/loadable.jsx
@@ -274,16 +274,24 @@ function Fence(props) {
     }
     const handleSubmit = () => {
         if (editStatus) { // 编辑
-            monitorEdit({...form.getFieldsValue(), id: editId}).then((msg) => {
-                message.success(msg || '监控设备更新成功')
-                setEditModalVisible(false)
-                getData()
+            form.validateFields().then(data => {
+                monitorEdit({...data, id: editId}).then((msg) => {
+                    message.success(msg || '监控设备更新成功')
+                    setEditModalVisible(false)
+                    getData()
+                })
+            }).catch(err => {
+                console.error(err)
             })
         } else { // 新增
-            monitorAdd(form.getFieldsValue()).then((msg) => {
-                message.success(msg || '监控设备添加成功')
-                setEditModalVisible(false)
-                getData()
+            form.validateFields().then(data => {
+                monitorAdd(data).then((msg) => {
+                    message.success(msg || '监控设备添加成功')
+                    setEditModalVisible(false)
+                    getData()
+                })
+            }).catch(err => {
+                console.error(err)
             })
         }
     }
diff --git a/src/pages/SystemMgm/AreaManage/loadable.jsx b/src/pages/SystemMgm/AreaManage/loadable.jsx
index 88cfcf8..42a0d69 100644
--- a/src/pages/SystemMgm/AreaManage/loadable.jsx
+++ b/src/pages/SystemMgm/AreaManage/loadable.jsx
@@ -82,8 +82,8 @@ function AreaManage() {
         setModalAreaVisible(true)
     }
 
-    const handleAreaEdit = ({ name, id, virtually_code, code, lng_lat, type }) => {
-        setEditForm({ name, id, virtually_code, code, lng_lat, type })
+    const handleAreaEdit = ({ name, id, virtually_code, code, lng, lat, type }) => {
+        setEditForm({ name, id, virtually_code, code, lng_lat: lng ? `${lng}, ${lat}` : "", type })
         setEditStatus(true)
         setModalAreaVisible(true)
     }
@@ -159,7 +159,7 @@ function AreaManage() {
             setModalAreaVisible(true)
         }
     }
-    const treeTitleRender = ({ name, children, level, pid, id, virtually_code, lng_lat, code, type }) => {
+    const treeTitleRender = ({ name, children, level, pid, id, virtually_code, lng, lat, code, type }) => {
         return <>
             <span className='label-text'>{name}</span>
             {
@@ -171,14 +171,14 @@ function AreaManage() {
                 level == 2 ? <>
                     <PlusCircleOutlined className='label-icon' onClick={() => handleAreaAdd({ level, id, isCity: false })} />
                     <DeleteOutlined className="label-icon" onClick={() => handleAreaDel({ name, id, children })} />
-                    <EditOutlined className="label-icon" onClick={() => handleAreaEdit({ name, id, virtually_code, code, lng_lat, type })} />
+                    <EditOutlined className="label-icon" onClick={() => handleAreaEdit({ name, id, virtually_code, code, lng, lat, type })} />
                 </> : null
             }
             {
                 level > 2 ? <>
                     {/* <PlusCircleOutlined className='label-icon' onClick={() => handleAreaAdd({level, pid, isCity: false})} /> */}
                     <DeleteOutlined className="label-icon" onClick={() => handleAreaDel({ name, id, children })} />
-                    <EditOutlined className="label-icon" onClick={() => handleAreaEdit({ name, id, virtually_code, code, lng_lat, type })} />
+                    <EditOutlined className="label-icon" onClick={() => handleAreaEdit({ name, id, virtually_code, code, lng, lat, type })} />
                 </> : null
             }
         </>
diff --git a/src/pages/SystemMgm/OrgnizationMgm/loadable.jsx b/src/pages/SystemMgm/OrgnizationMgm/loadable.jsx
index 32db69b..2c91799 100644
--- a/src/pages/SystemMgm/OrgnizationMgm/loadable.jsx
+++ b/src/pages/SystemMgm/OrgnizationMgm/loadable.jsx
@@ -139,19 +139,19 @@ function OrgnizationMgm() {
     }
 
     const recursionFindIdPath = (data, id, path=[]) => {
+        path.push(item.id); // 将当前节点的name添加到路径中  
         for (let item of data) {  
             if (item.id === id) {  
                 // 如果找到目标id,则返回当前路径  
                 return path
             }  
-            path.push(item.id); // 将当前节点的name添加到路径中  
       
             if (Array.isArray(item.children) && item.children.length > 0) {  
                 // 如果当前节点有子节点,则递归搜索子节点  
                 const result = recursionFindIdPath(item.children, id, path);  
                 if (result) {  
                     // 如果在子节点中找到目标id,则返回结果  
-                    return result;  
+                    return result
                 }  
             }