From fa5529623fc125a384b47b266a4e2113654ed5e6 Mon Sep 17 00:00:00 2001
From: zhangyongtian <1181606322@qq.com>
Date: Thu, 05 Sep 2024 21:10:17 +0800
Subject: [PATCH] feat: 办理记录对接

---
 gz-customerSystem/src/views/register/handleFeedback/component/handle.jsx     |  144 ++++++++++++-----------------------
 gz-customerSystem/src/views/register/matterDetail/FileUpLoad.jsx             |    0 
 gz-customerSystem/src/views/register/index.less                              |    4 
 gz-customerSystem/src/views/register/matterDetail/HandleRecord.jsx           |   85 +++++++++++++++++++++
 gz-customerSystem/src/views/register/visit/component/visitorRegister.jsx     |    2 
 gz-customerSystem/src/views/register/handleFeedback/component/CaseResult.jsx |    2 
 6 files changed, 140 insertions(+), 97 deletions(-)

diff --git a/gz-customerSystem/src/views/register/handleFeedback/component/CaseResult.jsx b/gz-customerSystem/src/views/register/handleFeedback/component/CaseResult.jsx
index 396f274..e48314f 100644
--- a/gz-customerSystem/src/views/register/handleFeedback/component/CaseResult.jsx
+++ b/gz-customerSystem/src/views/register/handleFeedback/component/CaseResult.jsx
@@ -9,7 +9,7 @@
 import React, { useState } from 'react';
 import { Modal, Form, Select, Upload, Input } from '@arco-design/web-react';
 import { Col, Space, Button, Tooltip, Radio } from 'antd';
-import DocumentScanner from './FileUpLoad'
+import DocumentScanner from '../../matterDetail/FileUpLoad'
 import { scan } from '@/assets/images/icon'
 import { tip, question1 } from '@/assets/images'
 import { NoHandleReason } from '../../visit/component/levelDetail'
diff --git a/gz-customerSystem/src/views/register/handleFeedback/component/handle.jsx b/gz-customerSystem/src/views/register/handleFeedback/component/handle.jsx
index b2ebf37..3246d0b 100644
--- a/gz-customerSystem/src/views/register/handleFeedback/component/handle.jsx
+++ b/gz-customerSystem/src/views/register/handleFeedback/component/handle.jsx
@@ -8,10 +8,11 @@
 import SelectObjModal from '@/components/SelectObjModal/selectPerson';
 import WantUserTag from '@/components/WantUserTag/Handling';
 import { scan } from '@/assets/images/icon'
-import DocumentScanner from './FileUpLoad'
+import DocumentScanner from '../../matterDetail/FileUpLoad';
 import * as $$ from '@/utils/utility';
 import CaseResult from './CaseResult'
 import ArcoUpload from '@/components/ArcoUpload';
+import HandleRecord from '../../matterDetail/HandleRecord';
 
 
 const InputSearch = Input.Search;
@@ -102,6 +103,9 @@
   return $$.ax.request({ url: `caseFeedback/listFeedback?id=` + id, type: 'get', service: 'mediate' });
 }
 
+function updateFeedbackApi(data) {
+  return $$.ax.request({ url: `caseFeedback/updateFeedback`, type: 'post', service: 'mediate', data });
+}
 
 
 
@@ -212,31 +216,6 @@
     },
   ]);
 
-
-
-  const toggleView = (id) => {
-    setList(list.map(record => {
-      if (record.id === id) {
-        return {
-          ...record,
-          showView: !record.showView,
-        };
-      }
-      return record;
-    }));
-  };
-
-  const handleEdit = (id) => {
-    console.log(id, 'handleEdit')
-    let handleContent = list.find(item => item.id = id).handleContent
-    setList(list.filter(record => record.id !== id));
-    setFormView(!formView);
-    formRef.current.setFieldsValue({
-      handleContent: handleContent
-    })
-  }
-
-
   const [scannerVisible, setScannerVisible] = useState(false);
 
   const handleConfirm = () => {
@@ -281,6 +260,7 @@
     }
   }
 
+  //获取理由id
   const getNewTimeId = async () => {
     const res = await getNewTimeIdApi()
     if (res.type) {
@@ -288,33 +268,60 @@
     }
   }
 
+  //新增、编辑办理理由
   const saveFeedback = async (submitData) => {
     console.log(submitData, 'submitData1111')
-    const res = await saveFeedbackApi(submitData)
-    if (res.type) {
-      $$.infoSuccess({ content: '保存成功' });
+    if(submitData.id) {
+      //编辑
+      const res = await updateFeedbackApi({
+        ...submitData,
+      })
+      if (res.type) {
+        $$.infoSuccess({ content: '修改成功' });
+        listFeedback('24083010062110001')
+      }
+    } else {
+      const res = await saveFeedbackApi({
+        ...submitData,
+        caseId: '24083010062110001',
+        id: id,
+        caseTaskId: '',
+      })
+      if (res.type) {
+        $$.infoSuccess({ content: '保存成功' });
+        listFeedback('24083010062110001')
+      }
     }
   }
 
+  //获取办理记录接口
   const listFeedback = async (id) => {
     const res = await listFeedbackApi(id)
     if (res.type) {
       let data = res.data.caseFeedbackList
       setList(data)
     }
-    console.log(list, 'listFeedbackApilistFeedbackApi')
   }
 
+  //添加办理记录
   const addMark = () => {
     setFormView(!formView);
     getNewTimeId()
   }
-
+  
+  //保存信息
   const handleFinish = () => {
-    console.log(formRef.current.getFields(), formRef, 'formRef.current.getFields()', 'formRef')
     let submitData = formRef.current.getFields()
     saveFeedback(submitData)
     setFormView(!formView);
+  }
+
+  //点击编辑办理事由
+  const handleEdit = (record) => {
+    setFormView(true)
+    formRef.current.setFieldsValue({
+      ...record
+    })
   }
 
   const Supervising = () => {
@@ -414,59 +421,9 @@
               </Col>
               <Col span={24}>
                 <div style={{ color: 'rgb(134, 144, 156)' }}>办理记录</div>
-                {list?.length > 0 ?
-                  <div>
-                    {list?.map(record => (
-                      <div key={record.id} className='container-bottom-left-record'>
-                        <div className='container-bottom-left-record-top'>
-                          {
-                            record.showView ? (
-                              <img src={down} alt='' style={{ width: '18px', marginRight: '6px' }} onClick={() => toggleView(record.id)} />
-                            ) : (
-                              <img src={fold} alt='' className='container-bottom-left-record-top-icon' onClick={() => toggleView(record.id)} />
-                            )
-                          }
-                          <div>{`${record.createTime} ${record.handleUnitName}`}</div>
-                          <div className={`container-bottom-left-record-top-${record.handleType === '2' ? 'remark' : 'hostOrg'}`}>{record.handleType === '2' ? '配合部门' : '承办部门'}</div>
-                          <div><img src={edit} alt='' className='container-bottom-left-record-top-edit' onClick={() => handleEdit(record.id)} /></div>
-                        </div>
-                        <div className='container-bottom-left-record-bottom' style={{ display: record.showView ? 'block' : 'none' }}>
-                          <table border="1" cellpadding="8" className='container-bottom-left-record-bottom-table'>
-                            <tr>
-                              <th bgcolor="#F7F8FA" className="table-title" width="120">操作人</th>
-                              <td>{record.handleUnitName}</td>
-                            </tr>
-                            <tr>
-                              <th bgcolor="#F7F8FA" className="table-title" width="120">办理意见</th>
-                              <td>{record.handleContent}</td>
-                            </tr>
-                            <tr>
-                              <th bgcolor="#F7F8FA" className="table-title" width="120">办理附件</th>
-                              <td>{record.handleUnitName}</td>
-                            </tr>
-                          </table>
-                        </div>
-                      </div>
-                    ))}
-                  </div>
-                  :
-                  <Empty
-                    icon={
-                      <div
-                        style={{
-                          display: 'flex',
-                          justifyContent: 'center',
-                          marginBottom: '100px'
-                        }}
-                      >
-                        <img src={empty} alt='' style={{ width: '160px', height: '160px' }} />
-                      </div>
-                    }
-                    description='暂无数据'
-                  />
-                }
-                {formView &&
-                  <div className='Form'>
+                <HandleRecord isReview={false} handleEdit={handleEdit} data={list} />
+                {/* {formView && */}
+                  <div className='Form' style={{display: formView ? '' : 'none'}}>
                     <Col span={24} style={{ marginBottom: '8px' }}>
                       <Space size='small'>
                         <div className='MediationInfo-subTitle' style={{ marginTop: '-9px' }}></div><h5>添加办理记录</h5>
@@ -528,11 +485,10 @@
                     </Col>
                     <Space size='middle'>
                       <Button type='primary' onClick={() => handleFinish()}>保存</Button>
-                      <Button type='secondary'>取消添加</Button>
+                      <Button type='secondary' onClick={() => { setFormView(!formView); }}>取消添加</Button>
                     </Space>
                   </div>
-
-                }
+                {/* } */}
               </Col>
             </Form>
             <Space style={{ marginTop: '38px', bottom: '4px' }}>
@@ -597,7 +553,7 @@
                     <Radio value='2' style={{ flex: 1, textAlign: 'center' }}>已回复</Radio>
                   </RadioGroup>
                   <div className='Supervising'>
-                  <div style={{ display: 'flex' }}>
+                    <div style={{ display: 'flex' }}>
                       <img src={knock} alt='' style={{ marginRight: '4px' }} />
                       <div style={{ color: '#EF6C24' }} >回复期限剩3小时</div>
                     </div>
@@ -728,8 +684,8 @@
             </Row>
           </Form>
         </Modal>
-        <Modal visible={response} onCancel={() => setResponse(false)} title='回复督办' centered footer={null} style={{overflowY:'auto'}}>
-          <div style={{  }}>
+        <Modal visible={response} onCancel={() => setResponse(false)} title='回复督办' centered footer={null} style={{ overflowY: 'auto' }}>
+          <div style={{}}>
             <Col span={24} style={{ marginBottom: '8px' }}>
               <Space size='small'>
                 <div className='MediationInfo-subTitle' style={{ marginTop: '-9px' }}></div><h5>督办意见</h5>
@@ -772,7 +728,7 @@
                     field='suggestion'
                   >
                     <div>
-                      
+
                     </div>
                     <div className='tabs1'>
                       {tabs2.map((tab) => (
@@ -792,7 +748,7 @@
                       ))}
                     </div>
                     <div>更多模板</div>
-                    
+
                     <Input.TextArea
                       rows={5}
                       wrapperStyle={{ width: '700px' }}
@@ -818,7 +774,7 @@
                     />
                   </FormItem>
                 </Col>
-                <Button type='primary' style={{ marginTop: '-16px',marginBottom:'16px' }} onClick={() => handleSupervising()}>提交</Button>
+                <Button type='primary' style={{ marginTop: '-16px', marginBottom: '16px' }} onClick={() => handleSupervising()}>提交</Button>
               </Row>
             </Form>
           </div>
diff --git a/gz-customerSystem/src/views/register/index.less b/gz-customerSystem/src/views/register/index.less
index 40f7e46..0f606bd 100644
--- a/gz-customerSystem/src/views/register/index.less
+++ b/gz-customerSystem/src/views/register/index.less
@@ -336,6 +336,7 @@
 					align-items: center;
 					background-color: #FAFAFA;
 					border-radius: 8px;
+					position: relative;
 
 
 					&-icon {
@@ -347,8 +348,9 @@
 					&-edit {
 						position: absolute;
 						right: 25px;
-						top: 45px;
+						top: 15px;
 						width: 18px;
+						cursor: pointer;
 					}
 
 					&-remark {
diff --git a/gz-customerSystem/src/views/register/handleFeedback/component/FileUpLoad.jsx b/gz-customerSystem/src/views/register/matterDetail/FileUpLoad.jsx
similarity index 100%
rename from gz-customerSystem/src/views/register/handleFeedback/component/FileUpLoad.jsx
rename to gz-customerSystem/src/views/register/matterDetail/FileUpLoad.jsx
diff --git a/gz-customerSystem/src/views/register/matterDetail/HandleRecord.jsx b/gz-customerSystem/src/views/register/matterDetail/HandleRecord.jsx
new file mode 100644
index 0000000..000d205
--- /dev/null
+++ b/gz-customerSystem/src/views/register/matterDetail/HandleRecord.jsx
@@ -0,0 +1,85 @@
+import React, { useState, useRef, useEffect } from 'react';
+import * as $$ from '@/utils/utility';
+import { Form, Input, Tabs, Typography, Empty, Radio, Button, Modal } from '@arco-design/web-react';
+import { register, fold, down, empty, link, edit } from '@/assets/images';
+
+export default function HandleRecord(props) {
+  const [formView, setFormView] = useState(false);
+  const [list, setList] = useState([]);
+
+  useEffect(() => {
+    setList(props.data)
+  }, [props.data])
+
+  const toggleView = (id) => {
+    setList(list.map(record => {
+      if (record.id === id) {
+        return {
+          ...record,
+          showView: !record.showView,
+        };
+      }
+      return record;
+    }));
+  };
+
+  const handleEdit = (id) => {
+    props.handleEdit(id)
+  }
+
+  return (
+    <div>
+      {list?.length > 0 ?
+        <div>
+          {list?.map(record => (
+            <div key={record.id} className='container-bottom-left-record'>
+              <div className='container-bottom-left-record-top'>
+                {
+                  record.showView ? (
+                    <img src={down} alt='' style={{ width: '18px', marginRight: '6px' }} onClick={() => toggleView(record.id)} />
+                  ) : (
+                    <img src={fold} alt='' className='container-bottom-left-record-top-icon' onClick={() => toggleView(record.id)} />
+                  )
+                }
+                <div>{`${record.createTime} ${record.handleUnitName}`}</div>
+                <div className={`container-bottom-left-record-top-${record.handleType === '2' ? 'remark' : 'hostOrg'}`}>{record.handleType === '2' ? '配合部门' : '承办部门'}</div>
+                <div><img src={edit} alt='' className='container-bottom-left-record-top-edit' onClick={() => handleEdit(record)} /></div>
+              </div>
+              <div className='container-bottom-left-record-bottom' style={{ display: record.showView ? 'block' : 'none' }}>
+                <table border="1" cellpadding="8" className='container-bottom-left-record-bottom-table'>
+                  <tr>
+                    <th bgcolor="#F7F8FA" className="table-title" width="120">操作人</th>
+                    <td>{record.handleUnitName}</td>
+                  </tr>
+                  <tr>
+                    <th bgcolor="#F7F8FA" className="table-title" width="120">办理意见</th>
+                    <td>{record.handleContent}</td>
+                  </tr>
+                  <tr>
+                    <th bgcolor="#F7F8FA" className="table-title" width="120">办理附件</th>
+                    <td>{record.handleUnitName}</td>
+                  </tr>
+                </table>
+              </div>
+            </div>
+          ))}
+        </div>
+        :
+        <Empty
+          icon={
+            <div
+              style={{
+                display: 'flex',
+                justifyContent: 'center',
+                marginBottom: '100px'
+              }}
+            >
+              <img src={empty} alt='' style={{ width: '160px', height: '160px' }} />
+            </div>
+          }
+          description='暂无数据'
+        />
+      }
+    </div>
+  )
+}
diff --git a/gz-customerSystem/src/views/register/visit/component/visitorRegister.jsx b/gz-customerSystem/src/views/register/visit/component/visitorRegister.jsx
index d40b3fc..4c41c45 100644
--- a/gz-customerSystem/src/views/register/visit/component/visitorRegister.jsx
+++ b/gz-customerSystem/src/views/register/visit/component/visitorRegister.jsx
@@ -20,7 +20,7 @@
 import MapView from './map';
 import { scan } from '@/assets/images/icon';
 import { EventLevelDrawer, MattersDetail } from './levelDetail';
-import DocumentScanner from '../../handleFeedback/component/FileUpLoad';
+import DocumentScanner from '../../matterDetail/FileUpLoad';
 import ArcoUpload from '@/components/ArcoUpload';
 
 

--
Gitblit v1.8.0