From 126d818da70a1711223d22217a3d7a88a8570988 Mon Sep 17 00:00:00 2001
From: zhangyongtian <1181606322@qq.com>
Date: Sun, 15 Sep 2024 17:45:34 +0800
Subject: [PATCH] fix: 结案申请bug修改

---
 gz-customerSystem/src/views/register/handleFeedback/component/AuditView.jsx |  289 ++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 184 insertions(+), 105 deletions(-)

diff --git a/gz-customerSystem/src/views/register/handleFeedback/component/AuditView.jsx b/gz-customerSystem/src/views/register/handleFeedback/component/AuditView.jsx
index e9238b0..d409482 100644
--- a/gz-customerSystem/src/views/register/handleFeedback/component/AuditView.jsx
+++ b/gz-customerSystem/src/views/register/handleFeedback/component/AuditView.jsx
@@ -1,31 +1,69 @@
-import React, { useRef, useState } from 'react';
-import { Row, Col, Space, Tooltip } from 'antd';
-import { Form, Input, Radio, Button } from '@arco-design/web-react';
+import React, { useRef, useState, useEffect } from 'react';
+import { Row, Col, Space } from 'antd';
+import { Form, Input, Radio, Button, Tooltip } from '@arco-design/web-react';
 import { register } from '@/assets/images'
 import { question1, } from '@/assets/images';
 import ArcoUpload from '@/components/ArcoUpload';
 import * as $$ from '@/utils/utility';
+import { Scrollbars } from "react-custom-scrollbars";
+import { getOffset, getSize } from '@/utils/utility';
+import { useNavigate } from 'react-router-dom';
 
 const FormItem = Form.Item;
 const appUrl = $$.appUrl;
-const RadioGroup = Radio.Group;// 根据调解案号获取纠纷登记信息
-
+const RadioGroup = Radio.Group;
+const TextArea = Input.TextArea;
 
 function delFile(id) {
   return $$.ax.request({ url: `fileInfo/deleteFileById`, type: 'get', service: 'sys', data: { id } });
 }
 
+function getData(data) {
+  return $$.ax.request({ url: `caseAssistApply/getByCaseId`, type: 'get', service: 'mediate', data });
+}
 
+function submit(data) {
+  return $$.ax.request({ url: `caseAssistApply/reviewCaseAssistApply`, type: 'post', service: 'mediate', data });
+}
 
-const AuditView = () => {
+const AuditView = (props) => {
+  const navigate = useNavigate();
   const formRef = useRef();
-  const [value, setValue] = useState(1);
-  const id = 1;
+  const scrollRef = useRef(null);
+  const [id, setId] = useState();
+  const [infoData, setInfoData] = useState({});
+  const [height, setHeight] = useState(500);
+  const [agreeRadio, setAgreeRadio] = useState();
 
-  const onChange = (e) => {
-    console.log('radio checked', e.target.value);
-    setValue(e.target.value);
+  useEffect(() => {
+    getInfoData()
+    onWindowResize()
+    window.addEventListener("resize", onWindowResize);
+    // 返回一个函数,该函数会在组件卸载前执行  
+    return () => {
+      // 组件销毁时执行  
+      window.removeEventListener("resize", onWindowResize);
+    };
+  }, [])
+
+  const onWindowResize = () => {
+    let offsetTop = 0;
+    if (scrollRef.current.container) {
+      offsetTop = getOffset(scrollRef.current.container).top;
+    }
+    setHeight(getSize().windowH - offsetTop - 80)
   };
+
+  //回显数据
+  const getInfoData = async () => {
+    const res = await getData({
+      caseId: props.caseId
+    })
+    if (res.type) {
+      setInfoData(res.data || {})
+      setId(res.data.id)
+    }
+  }
 
   //删除文件
   const handleDelFile = async (id) => {
@@ -35,104 +73,145 @@
     }
   }
 
+  const handleSubmit = () => {
+    if (formRef.current) {
+      formRef.current.validate(undefined, (errors, values) => {
+        if (!errors) {
+          const { file, ...rest } = formRef.current.getFields()
+          requestSubmit({
+            ...rest,
+            id: id
+          })
+        }
+      })
+    }
+  }
+
+  const requestSubmit = async (data) => {
+    const res = await submit(data)
+    if (res.type) {
+      $$.infoSuccess({ content: '提交成功!' });
+      navigate('/mediate/visit/visitWorkBench')
+    }
+  }
+
   return (
-    <>
-      <div className="auditView">
-        <Col span={24} className='title'>
-          <Space size='small'>
-            <div className='MediationInfo-subTitle' style={{ marginTop: '-9px' }}></div><h5>联合处置申请</h5>
-          </Space>
-        </Col>
-        <Row gutter={[16, 16]}>
-          <Col span={24}>
-            <div><div className="title-text">添加配合部门</div></div>
-            <div>白云区新市街司法所、白云区新市街劳监大队</div>
-          </Col>
-          <Col span={24}>
-            <div><div className="title-text">添加理由</div></div>
-            <div>在调解过程中,我们发现需要白云区新市街司法所的专业司法能力支持事项办理,以促进调解工作的顺利进行。</div>
-          </Col>
-          {/*事项等级分为三级,颜色需要做判断*/}
-          <Col span={24}>
-            <div className="title"><div className="title-text">申请时间</div></div>
-            <div >2024-7-21 12:00</div>
-          </Col>
-          <Col span={24}>
-            <div><div className="title-text">申请人</div></div>
-            <div>广州市白云区新市街汇桥北社区委员会 张三丰<img src={register} alt='' style={{ width: '14px', height: '14px', marginLeft: '8px', marginTop: '-1px' }}/></div>
-          </Col>
-        </Row>
-
-      </div>
-      <div className="auditView">
-        <Col span={24} className='title'>
-          <Space size='small'>
-            <div className='MediationInfo-subTitle' style={{ marginTop: '-9px' }}></div><h5>审核</h5>
-          </Space>
-        </Col>
-        <Form
-          ref={formRef}
-          layout='vertical'
-          requiredSymbol={false}
-          scrollToFirstError={true}
-        >
-          <Row style={{ marginBottom: '-16px' }}>
-            <Col span={24}>
-              <FormItem
-                label='审核结果'
-                field='majorStatus'
-              >
-                <RadioGroup options={[{ value: 0, label: '否' }, { value: 1, label: '是' }]} direction='vertical' />
-              </FormItem>
+    <div className='dataSync'>
+      <div className='dataSync-noBackTabPage' style={{ background: '#fff' }}>
+        <Scrollbars style={{ height: height + 'px' }} autoHide ref={scrollRef}>
+          <div className="whiteBox">
+            <Col span={24} className='title'>
+              <Space size='small'>
+                <div className='MediationInfo-subTitle' style={{ marginTop: '-9px' }}></div><h5>联合处置申请</h5>
+              </Space>
             </Col>
-            <Col span={24}>
-              <FormItem
-                label={(<div style={{ display: 'flex' }}>理由说明<div className="must">必填</div></div>)}
-                field='handleContent'
-                rules={[{ message: '请填写不同意联合处置申请的理由', required: true }]}
-              >
-                <Input.TextArea
-                  maxLength={200}
-                  showWordLimit
-                  rows={5}
-                  placeholder='请完整描述事项概况,应具备5要素:发生时间+发生地点+人物情况+事项起因+事项经过'
-                  wrapperStyle={{ width: '100%' }}
-                />
-              </FormItem>
-            </Col>
-            <Col span={24}>
-              <FormItem
-                label={<div style={{ display: 'flex' }}>
-                  <span style={{ color: '#86909C' }}>附件材料</span>
-                  <Tooltip>
-                    <img src={question1} alt="" style={{ width: '13px', height: '13px', margin: '4px 4px 0px 4px' }} />
-                  </Tooltip>
+            <Row gutter={[16, 16]}>
+              <Col span={24}>
+                <div><div className="title-text">添加配合部门</div></div>
+                <div>{infoData.applyAssistUnitName || '-'}</div>
+              </Col>
+              <Col span={24}>
+                <div><div className="title-text">添加理由</div></div>
+                <div>{infoData.applyContent || '-'}</div>
+              </Col>
+              <Col span={24}>
+                <div className="title"><div className="title-text">申请时间</div></div>
+                <div>{$$.myTimeFormat(infoData.applyTime, 'YYYY-MM-DD HH:mm') || '-'}</div>
+              </Col>
+              <Col span={24}>
+                <div><div className="title-text">申请人</div></div>
+                <div>
+                  {infoData.applyUnitName}&nbsp;&nbsp;
+                  {infoData.applyUserName || '-'}
+                  <img src={register} alt="" className="title-register" />
                 </div>
-                }
-                field='caseDes'
-                rules={[{ message: '请填写事项概况', required: true }]}
-              >
-                <ArcoUpload
-                  params={{
-                    action: `${appUrl.fileUrl}/${appUrl.sys}/api/web/fileInfo/upload?mainId='24083010062110001'&&ownerId=${id}&ownerType=22_00018-102`,
-                  }}
-                  field='file1'
-                  // handleChangeFile={handleChangeFile}
-                  label=''
-                  // editData={props.editData}
-                  handleDelFile={handleDelFile}
-                />
-              </FormItem>
-            </Col>
-          </Row>
-        </Form>
-        <Space style={{}}>
-          <Button type='primary' >提交</Button>
-          <Button type='secondary'>返回上级页面</Button>
-        </Space>
-      </div>
+              </Col>
+            </Row>
 
-    </>
+          </div>
+          <div className='whiteBox' style={{ borderTop: '8px solid #f0f2f5' }}>
+            <Space size='small'>
+              <div className='MediationInfo-subTitle' style={{ marginTop: '-8px' }}></div><h5>审核</h5>
+            </Space>
+            <Form
+              ref={formRef}
+              layout='vertical'
+              requiredSymbol={false}
+              initialValues={{
+                auditResult: '24_00004-1',
+                auditResultName: "同意"
+              }}//默认值
+              scrollToFirstError
+            >
+              <Row>
+                <Col span={24}>
+                  <FormItem
+                    label={(<div style={{ display: 'flex' }}>审核结果</div>)}
+                    field='auditResult'
+                  >
+                    <RadioGroup
+                      direction='vertical'
+                      options={$$.options.auditResult}
+                      onChange={(value) => {
+                        setAgreeRadio(value)
+                        if (value) {
+                          const data = $$.options.auditResult.find(item => item.value === value)
+                          formRef.current.setFieldValue('auditResultName', data.label)
+                        } else {
+                          formRef.current.setFieldValue('auditResultName', '')
+                        }
+                      }}
+                    />
+                  </FormItem>
+                </Col>
+                {agreeRadio == '24_00004-2' &&
+                  <>
+                    <Col span={24}>
+                      <FormItem
+                        label={(<div style={{ display: 'flex' }}>理由说明<div className="must">必填</div></div>)}
+                        field='auditContent'
+                        rules={[{ required: true, message: '请选择理由说明' }]}
+                      >
+                        <TextArea
+                          autoSize={{ minRows: 4, maxRows: 8 }}
+                          placeholder='请填写不同意联合处置申请的理由'
+                        />
+                      </FormItem>
+                    </Col>
+                    <Col span={24} className="doubleFile">
+                      <ArcoUpload
+                        params={{
+                          action: `${appUrl.fileUrl}/${appUrl.sys}/api/web/fileInfo/upload?mainId=${props.caseId}&ownerId=${id}&ownerType=22_00018-509`,
+                        }}
+                        field='file'
+                        label={
+                          <div>
+                            附件材料
+                            <Tooltip>
+                              <img src={question1} alt="" style={{ width: '13px', height: '13px', margin: '-3px 4px 0px 4px' }} />
+                            </Tooltip>
+                          </div>
+                        }
+                        handleDelFile={handleDelFile}
+                      />
+                    </Col>
+                  </>
+                }
+              </Row>
+            </Form>
+          </div>
+        </Scrollbars>
+        <div className='dialogFooter' style={{ margin: 0, padding: '16px 12px' }}>
+          <Button
+            type="primary"
+            className="dialogPrimary"
+            onClick={handleSubmit}
+          >
+            提交
+          </Button>
+        </div>
+      </div>
+    </div>
   )
 }
 

--
Gitblit v1.8.0