forked from gzzfw/frontEnd/gzDyh

zhangyongtian
2024-09-13 621a3268a8c2cebf899e3ba824c49a1513cb619b
gz-customerSystem/src/views/register/eventFlow/component/Examine.jsx
@@ -5,6 +5,8 @@
import ArcoUpload from '@/components/ArcoUpload';
import { Scrollbars } from "react-custom-scrollbars";
import * as $$ from '@/utils/utility';
import { getOffset, getSize } from '@/utils/utility';
import { useNavigate } from 'react-router-dom';
const RadioGroup = Radio.Group;
const FormItem = Form.Item;
@@ -21,18 +23,17 @@
  return $$.ax.request({ url: url, type: 'post', 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 } });
  return $$.ax.request({ url: `fileInfo/deleteFileById`, type: 'get', service: 'sys', data: { id } });
}
export default function Examine(props) {
  const navigate = useNavigate();
  const formRef = useRef();
  const scrollRef = useRef(null);
  const [infoData, setInfoData] = useState({});
  const [id, setId] = useState();
  const [height, setHeight] = useState(500);
  const mainFlag = props.type == 'htsh' ? 'return' : 'appear'
  const options = [
    {
@@ -51,16 +52,25 @@
  useEffect(() => {
    getInfoData()
    getAppId()
  }, [props.type])
  //获取id
  const getAppId = async () => {
    const res = await getId()
    if (res.type) {
      setId(res.data)
  useEffect(() => {
    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 - 74)
  };
  //回显数据
  const getInfoData = async () => {
@@ -69,6 +79,7 @@
    })
    if (res.type) {
      setInfoData(res.data || {})
      setId(res.data.id)
    }
  }
@@ -92,6 +103,7 @@
    const res = await submit(props.type, data)
    if (res.type) {
      $$.infoSuccess({ content: '提交成功!' });
      navigate('/mediate/visit/visitWorkBench')
    }
  }
@@ -118,12 +130,19 @@
            <Col span={24}>
              <div><div className="title-text">附件材料</div></div>
              <div style={{ color: '#1A6FB8' }}>
                <img src={link} alt="" className="title-file" />{infoData?.file || '-'}
                {infoData?.fileInfoList?.map(res => {
                  return res.fileList.map((result, resIndex) => {
                    return <a href="your-link-here.html" target="_blank">
                      <img src={link} alt="" className="title-file" />{result.name}
                      {resIndex !== res.fileList.length - 1 && <>,</>}
                    </a>
                  })
                }) || '-'}
              </div>
            </Col>
            <Col span={24}>
              <div><div className="title-text">申请时间</div></div>
              <div>{infoData[mainFlag + 'Time'] || '-'}</div>
              <div>{$$.myTimeFormat(infoData[mainFlag + 'Time'], 'YYYY-MM-DD HH:mm') || '-'}</div>
            </Col>
            <Col span={24}>
              <div><div className="title-text">申请人</div></div>
@@ -136,7 +155,7 @@
          </Row>
        </div>
        <div className='whiteBox' style={{ marginTop: '8px' }}>
          <Scrollbars style={{ height: 'calc(100vh - 577px)' }} autoHide>
          <Scrollbars style={{ height: height + 'px' }} autoHide ref={scrollRef}>
            <Space size='small'>
              <div className='MediationInfo-subTitle' style={{ marginTop: '-8px' }}></div><h5>审核</h5>
            </Space>
@@ -179,7 +198,7 @@
                      options={options}
                      onChange={(value) => {
                        const obj = options.find(item => item.value === value)
                        formRef.current.setFieldValue('audit_content', obj.label)
                        formRef.current.setFieldValue('auditContent', obj.label)
                      }}
                    >
                    </RadioGroup>
@@ -188,7 +207,7 @@
                <Col span={24}>
                  <FormItem
                    label=' '
                    field='audit_content'
                    field='auditContent'
                    rules={[{ required: true, message: '理由不能为空' }]}
                  >
                    <TextArea