From d64e35fa84942b91bad5a1e57f523b906a03bf6e Mon Sep 17 00:00:00 2001
From: dminyi <1301963064@qq.com>
Date: Wed, 28 Aug 2024 16:29:22 +0800
Subject: [PATCH] 自行受理

---
 gz-customerSystem/src/views/register/visit/component/visitorRegister.jsx |   50 ++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 40 insertions(+), 10 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..5c8c631 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

--
Gitblit v1.8.0