forked from gzzfw/frontEnd/gzDyh

liuwh
2024-09-09 e92ddbcdc1cb990de02621bccfa62cc067afd3b9
gz-customerSystem/src/views/register/closingReview/component/ReviewExamine.jsx
New file
@@ -0,0 +1,269 @@
import React, { useRef, useState, useEffect } from 'react'
import { Row, Col, Space } from 'antd';
import { link, register } from '@/assets/images';
import { Form, Input, Button, Radio } from '@arco-design/web-react';
import ArcoUpload from '@/components/ArcoUpload';
import { Scrollbars } from "react-custom-scrollbars";
import ReviewProgress from './ReviewProgress';
import * as $$ from '@/utils/utility';
const RadioGroup = Radio.Group;
const FormItem = Form.Item;
const TextArea = Input.TextArea;
const appUrl = $$.appUrl;
function getData(data) {
  return $$.ax.request({ url: `caseTask/getWindupApplyInfo`, type: 'get', service: 'mediate', data });
}
function getId() {
  return $$.ax.request({ url: `caseUtils/getNewTimeId`, type: 'get', service: 'utils' });
}
function delFile(id) {
  return $$.ax.request({ url: `fileInfo/deleteFileById`, type: 'delete', service: 'sys', data: { id } });
}
function submit(data) {
  return $$.ax.request({ url: `caseTask/windupAudit`, type: 'post', service: 'mediate', data });
}
function getListCaseFlow(data) {
  return $$.ax.request({ url: `caseTask/listCaseFlow`, type: 'get', service: 'mediate', data });
}
export default function ReviewExamine(props) {
  const formRef = useRef();
  const [result, setResult] = useState()
  const [infoData, setInfoData] = useState({});
  const [id, setId] = useState();
  const [progressData, setProgressData] = useState({})
  const options = [
    {
      label: '材料不完整',
      value: '1'
    },
    {
      label: '办理流程有问题',
      value: '2'
    },
    {
      label: '当事人不满意调解结果',
      value: '3'
    },
    {
      label: '其他',
      value: '4'
    },
  ]
  useEffect(() => {
    getInfoData()
    getAppId()
    getProData()
  }, [])
  //获取id
  const getAppId = async () => {
    const res = await getId()
    if (res.type) {
      setId(res.data)
    }
  }
  //回显数据
  const getInfoData = async () => {
    const res = await getData({ caseTaskId: props.caseTaskId })
    if (res.type) {
      setInfoData(res.data || {})
    }
  }
  //获取流程信息
  const getProData = async () => {
    const res = await getListCaseFlow({
      caseId: props.caseId
    })
    if (res.type) {
      setProgressData(res.data)
    }
  }
  const handleSubmit = () => {
    if (formRef.current) {
      formRef.current.validate(undefined, (errors, values) => {
        if (!errors) {
          const { file, myNoUp, ...rest } = formRef.current.getFields()
          requestSubmit({
            id,
            caseId: props.caseId,
            caseTaskId: props.caseTaskId,
            ...rest
          })
        }
      })
    }
  }
  const requestSubmit = async (data) => {
    const res = await submit(data)
    if (res.type) {
      $$.infoSuccess({ content: '提交成功!' });
    }
  }
  //删除文件
  const handleDelFile = async (id) => {
    const res = await delFile(id)
    if (res.type) {
      $$.infoSuccess({ content: '删除成功!' });
    }
  }
  return (
    <div className='dataSync'>
      <div className='dataSync-noBackTabPage'>
        <Scrollbars style={{ height: '100%' }} autoHide>
          <div className='whiteBox'>
            <Space size='small'>
              <div className='MediationInfo-subTitle' style={{ marginTop: '-8px' }}></div><h5>结案申请</h5>
            </Space>
            <Row gutter={[16, 16]}>
              <Col span={24}>
                <div><div className="title-text">化解结果</div></div>
                <div style={{ color: infoData.mediResult == '22_00025-1' ? '#00B42A' : '#F53F3F' }}>{infoData?.mediResultName || '-'}</div>
              </Col>
              <Col span={24}>
                <div><div className="title-text">无法化解理由</div></div>
                <div>{infoData?.failReason || '-'}</div>
              </Col>
              <Col span={24}>
                <div><div className="title-text">结案意见</div></div>
                <div>{infoData?.windupContent || '-'}</div>
              </Col>
              {/* <Col span={24}>
                <div><div className="title-text">是否转诉讼案件</div></div>
                <div>{infoData?.isProceeding || '-'}</div>
              </Col>
              <Col span={24}>
                <div><div className="title-text">诉讼案号</div></div>
                <div>{infoData?.proceeding || '-'}</div>
              </Col> */}
              <Col span={24}>
                <div><div className="title-text">申请时间</div></div>
                <div>{infoData?.applyTime || '-'}</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>
              </Col>
            </Row>
          </div>
          <div style={{ display: 'flex', marginTop: '8px' }}>
            <div className='whiteBox' style={{ flex: 1, marginRight: '8px' }}>
              <Space size='small'>
                <div className='MediationInfo-subTitle' style={{ marginTop: '-8px' }}></div><h5>审核</h5>
              </Space>
              <Form
                ref={formRef}
                layout='vertical'
                requiredSymbol={false}
                initialValues={{
                }}//默认值
                scrollToFirstError
              >
                <Row>
                  <Col span={24}>
                    <FormItem
                      label={(<div style={{ display: 'flex' }}>审核结果</div>)}
                      field='auditResult'
                    >
                      <RadioGroup
                        direction='vertical'
                        options={$$.options.auditResult}
                        onChange={(value) => {
                          setResult(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>
                  {result === '24_00004-2' &&
                    <>
                      <Col span={24}>
                        <FormItem
                          label={(<div style={{ display: 'flex' }}>理由说明<div className="must">必填</div></div>)}
                          field='myNoUp'
                          rules={[{ required: true, message: '请选择理由说明' }]}
                        >
                          <RadioGroup
                            direction='vertical'
                            options={options}
                            onChange={(value) => {
                              const obj = options.find(item => item.value === value)
                              formRef.current.setFieldValue('audit_content', obj.label)
                            }}
                          >
                          </RadioGroup>
                        </FormItem>
                      </Col>
                      <Col span={24}>
                        <FormItem
                          label=' '
                          field='audit_content'
                          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-514`,
                          }}
                          field='file'
                          label='附件材料'
                          handleDelFile={handleDelFile}
                        />
                      </Col>
                    </>
                  }
                </Row>
              </Form>
              <div className='dialogFooter'>
                <Button
                  type="primary"
                  className="dialogPrimary"
                  onClick={handleSubmit}
                >
                  提交
                </Button>
              </div>
            </div>
            {
              (infoData.caseLevel === 1 || infoData.caseLevel === 2) &&
              <div className='whiteBox' style={{ width: '400px' }}>
                <Space size='small'>
                  <div className='MediationInfo-subTitle' style={{ marginTop: '-8px' }}></div><h5>审核进度</h5>
                </Space>
                <ReviewProgress progressData={progressData} />
              </div>
            }
          </div>
        </Scrollbars>
      </div>
    </div>
  )
}