From b2434de9e541031c17fabe06b3d294ed4823d903 Mon Sep 17 00:00:00 2001
From: dminyi <1301963064@qq.com>
Date: Fri, 06 Sep 2024 09:40:48 +0800
Subject: [PATCH] Merge branch 'master' of http://120.79.193.119:9090/r/gzzfw/frontEnd/gzDyh into master

---
 gz-customerSystem/src/views/register/handleFeedback/component/handle.jsx |  132 ++++++++++++++-----------------------------
 1 files changed, 44 insertions(+), 88 deletions(-)

diff --git a/gz-customerSystem/src/views/register/handleFeedback/component/handle.jsx b/gz-customerSystem/src/views/register/handleFeedback/component/handle.jsx
index 59e385d..228fab8 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';
 import TableView from '@/components/TableView';
 
 
@@ -99,6 +100,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 });
+}
 
 
 
@@ -251,31 +255,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 = () => {
@@ -320,6 +299,7 @@
     }
   }
 
+  //获取理由id
   const getNewTimeId = async () => {
     const res = await getNewTimeIdApi()
     if (res.type) {
@@ -327,33 +307,60 @@
     }
   }
 
+  //新增、编辑办理理由
   const saveFeedback = async (submitData) => {
     console.log(submitData, 'submitData1111')
-    const res = await saveFeedbackApi({ ...submitData, id: id, caseId: '24083010062110001', caseTaskId: '12345' })
-    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 = () => {
@@ -457,59 +464,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>
@@ -571,11 +528,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' }}>

--
Gitblit v1.8.0