From f6939b0ec6680da8416a3161b524e7b73a7a3db8 Mon Sep 17 00:00:00 2001
From: zhangyongtian <1181606322@qq.com>
Date: Tue, 10 Sep 2024 16:55:34 +0800
Subject: [PATCH] fix: delete改回get请求

---
 gz-customerSystem/src/views/register/visit/component/applyDialog.jsx |   39 +++++++++++++++++++++++++++++----------
 1 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/gz-customerSystem/src/views/register/visit/component/applyDialog.jsx b/gz-customerSystem/src/views/register/visit/component/applyDialog.jsx
index 4e4be9f..cb72582 100644
--- a/gz-customerSystem/src/views/register/visit/component/applyDialog.jsx
+++ b/gz-customerSystem/src/views/register/visit/component/applyDialog.jsx
@@ -16,6 +16,7 @@
 import KeyVisits from "@/components/personCard/KeyVisits";
 import SelectUnitDialog from "./selectUnitDialog";
 import ArcoUpload from '@/components/ArcoUpload';
+import { Scrollbars } from "react-custom-scrollbars";
 
 const FormItem = Form.Item;
 const Option = Select.Option;
@@ -28,6 +29,10 @@
   return $$.ax.request({ url: `caseUtils/getNewTimeId`, type: 'get', service: 'utils' });
 }
 
+function delFile(id) {
+  return $$.ax.request({ url: `fileInfo/deleteFileById`, type: 'get', service: 'sys', data: { id } });
+}
+
 export default function ApplyDialog(props) {
   const formRef = useRef();
   const [perClass, setPerClass] = useState('09_01001-1');
@@ -36,6 +41,7 @@
 
   useEffect(() => {
     if (props.editData) {
+      console.log(props.editData);
       //编辑
       formRef.current.setFieldsValue({
         ...props.editData
@@ -79,13 +85,21 @@
     }
   }
 
+  //删除文件
+  const handleDelFile = async (id) => {
+    const res = await delFile(id)
+    if (res.type) {
+      $$.infoSuccess({ content: '删除成功!' });
+    }
+  }
+
   //页面返回
   const formType = (type) => {
     if (type === '09_01001-1') {
       //自然人
       return (
         <>
-          <Col span={24}>
+          <Col span={24} className="doubleFile">
             <ArcoUpload
               params={{
                 action: `${appUrl.fileUrl}/${appUrl.sys}/api/web/fileInfo/upload?mainId=${props.mainId}&ownerId=${id}&ownerType=22_00018-202`,
@@ -94,6 +108,8 @@
               handleChangeFile={handleChangeFile}
               label='身份证明材料'
               editData={props.editData}
+              handleDelFile={handleDelFile}
+              ownerType='22_00018-202'
             />
           </Col>
           <Col span={12}>
@@ -221,24 +237,28 @@
       let isLegal = type === '09_01001-2'
       return (
         <>
-          <Col span={24}>
+          <Col span={24} className="doubleFile">
             <ArcoUpload
               params={{
-                action: `${appUrl.fileUrl}/${appUrl.sys}/api/web/fileInfo/upload?mainId=${props.mainId}&ownerId=${id}&ownerType=22_00018-202`,
+                action: `${appUrl.fileUrl}/${appUrl.sys}/api/web/fileInfo/upload?mainId=${props.mainId}&ownerId=${id}&ownerType=22_00018-203`,
               }}
               field='file'
               label={isLegal ? '企业登记材料' : '机构登记材料'}
               editData={props.editData}
+              handleDelFile={handleDelFile}
+              ownerType='22_00018-203'
             />
           </Col>
-          <Col span={24}>
+          <Col span={24} className="doubleFile">
             <ArcoUpload
               params={{
-                action: `${appUrl.fileUrl}/${appUrl.sys}/api/web/fileInfo/upload?mainId=${props.mainId}&ownerId=${id}&ownerType=22_00018-202`,
+                action: `${appUrl.fileUrl}/${appUrl.sys}/api/web/fileInfo/upload?mainId=${props.mainId}&ownerId=${id}&ownerType=22_00018-204`,
               }}
               field='file1'
               label={isLegal ? '法定代表人身份证明材料' : '机构代表人身份证明材料'}
               editData={props.editData}
+              handleDelFile={handleDelFile}
+              ownerType='22_00018-204'
             />
           </Col>
           <Col span={12}>
@@ -312,7 +332,6 @@
       formRef.current.validate(undefined, (errors, values) => {
         if (!errors) {
           const fieldValue = formRef.current.getFields()
-          console.log(fieldValue);
           if (props.editData) {
             props.handleAddParty({
               ...fieldValue
@@ -340,7 +359,7 @@
 
   return (
     <div className="applyDialog">
-      <div style={{ height: '590px', overflowY: 'scroll' }}>
+      <Scrollbars style={{ height: '590px' }} autoHide>
         <div className="dialogTitle">当事人类型</div>
         <Row gutter={[16, 16]} style={{ margin: '0 2px 0 0' }}>
           {$$.options.personClass.map((x, t) => {
@@ -377,10 +396,10 @@
         </Row>
 
         {/* 重复来访重点人员 */}
-        <div style={{ width: 'calc(100% - 9px)', background: '#f2f3f5', marginBottom: '20px', padding: '12px' }}>
+        {/* <div style={{ width: 'calc(100% - 9px)', background: '#f2f3f5', marginBottom: '20px', padding: '12px' }}>
           <KeyVisits />
-        </div>
-      </div>
+        </div> */}
+      </Scrollbars>
       <div className='dialogFooter'>
         <Button
           type="primary"

--
Gitblit v1.8.0