From c1d6dff8bf8340fe030d3089cf5dff0e9cffcf58 Mon Sep 17 00:00:00 2001
From: zhangyongtian <1181606322@qq.com>
Date: Thu, 29 Aug 2024 10:24:12 +0800
Subject: [PATCH] Revert "更改命名"

---
 gz-customerSystem/src/views/register/visit/component/visitorRegister.jsx |   57 ++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 46 insertions(+), 11 deletions(-)

diff --git a/gz-customerSystem/src/views/register/visit/component/visitorRegister.jsx b/gz-customerSystem/src/views/register/visit/component/visitorRegister.jsx
index d6d3993..e2a0bfc 100644
--- a/gz-customerSystem/src/views/register/visit/component/visitorRegister.jsx
+++ b/gz-customerSystem/src/views/register/visit/component/visitorRegister.jsx
@@ -47,9 +47,10 @@
   const [fileTip, setFileTip] = useState('0');
   const [detailVisabled, setDetailVisabled] = useState(false);//查看信息弹窗控制
   const [mapView, setMapView] = useState(false);
-  const [flagId, setFlagId] = useState(0);//赋予当事人唯一id,用于删除
+  const [flagId, setFlagId] = useState(1);//赋予当事人唯一id,用于删除
   const [visible, setVisible] = useState(false);
   const [apply, setApply] = useState(false);
+  const [editData, setEditData] = useState(null);
 
   const addressOptions = [
     { label: '地址1', value: 'address1' },
@@ -370,12 +371,25 @@
 
   //添加当事人
   const handleAddParty = (value) => {
-    console.log(value);
-    setFakeData([...fakeData, {
-      ...value,
-      id: flagId
-    }])
-    setFlagId(flagId + 1)
+    console.log(value,'value1');
+    if (value.id) {
+      //编辑
+      const newList = fakeData.map(item => {
+        if (item.id === value.id) {
+          return value
+        } else {
+          return item
+        }
+      })
+      setFakeData(newList)
+      setEditData(null)
+    } else {
+      setFakeData([...fakeData, {
+        ...value,
+        id: flagId
+      }])
+      setFlagId(flagId + 1)
+    }
   }
 
   //删除当事人
@@ -385,13 +399,26 @@
     setFakeData(filterData)
   }
 
+  //编辑
+  const handleEdit = (value) => {
+    console.log(value);
+    if (value.partyType === 0 || value.partyType === 1) {
+      //当事人
+      setAddVisabled(true)
+    } else {
+      //代理人
+      setAgentVisible(true)
+    }
+    setEditData(value)
+  }
+
 
   return (
     <div className='dataSync-page'>
 
       <Col span={24} style={{ display: 'flex', alignItems: 'center' }}>
         <Space size='small'>
-          <div className='MediationInfo-subTitle' style={{ marginTop: '-9px' }}></div><h5>当事人信息</h5>
+          <div className='MediationInfo-subTitle' style={{ marginTop: '-9px', }}></div><h4>当事人信息</h4>
         </Space>
       </Col>
       <div style={{ margin: '16px 0' }}>
@@ -402,11 +429,12 @@
           handleCheckParty={handleCheckParty}
           handleAdd={handleAdd}
           handleDeleteParty={handleDeleteParty}
+          handleEdit={handleEdit}
         />
       </div>
       <Col span={24} style={{ display: 'flex', alignItems: 'center', marginBottom: '8px' }}>
         <Space size='small'>
-          <div className='MediationInfo-subTitle' style={{ marginTop: '-9px' }}></div><h5>纠纷基本情况</h5>
+          <div className='MediationInfo-subTitle' style={{ marginTop: '-9px' }}></div><h4>纠纷基本情况</h4>
         </Space>
       </Col>
       <Form
@@ -588,7 +616,7 @@
       </Form>
       <Col span={24} style={{ display: 'flex', alignItems: 'center', marginBottom: '8px', marginTop: '20px' }}>
         <Space size='small'>
-          <div className='MediationInfo-subTitle' style={{ marginTop: '-9px' }}></div><h5>事件材料</h5>
+          <div className='MediationInfo-subTitle' style={{ marginTop: '-9px' }}></div><h4>事件材料</h4>
         </Space>
       </Col>
       <TableView
@@ -734,6 +762,7 @@
           dialogType={dialogType}
           onClose={() => setAddVisabled(false)}
           handleAddParty={handleAddParty}
+          editData={editData}
         />
       </Modal>
       <Modal
@@ -752,6 +781,7 @@
           onClose={() => setAgentVisible(false)}
           fakeData={fakeData}
           dialogType={dialogType}
+          editData={editData}
         />
       </Modal>
       <Modal
@@ -777,7 +807,12 @@
         unmountOnExit={true}
         maskClosable={false}
       >
-        <MapView />
+        <MapView
+          selectAdd={(value) => {
+            props.formRef.current.setFieldValue('disputeAddress', value)
+            setMapView(false)
+          }}
+        />
       </Modal>
       <MattersDetail
         visible={visible}

--
Gitblit v1.8.0