From 899e81654c9389785d58f9dbdf2ea7d2b2bc9082 Mon Sep 17 00:00:00 2001
From: zhangyongtian <1181606322@qq.com>
Date: Fri, 13 Sep 2024 14:55:51 +0800
Subject: [PATCH] feat: 对接流程
---
gz-customerSystem/src/views/register/eventFlow/component/Examine.jsx | 235 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 228 insertions(+), 7 deletions(-)
diff --git a/gz-customerSystem/src/views/register/eventFlow/component/Examine.jsx b/gz-customerSystem/src/views/register/eventFlow/component/Examine.jsx
index ba4f5d8..44324bc 100644
--- a/gz-customerSystem/src/views/register/eventFlow/component/Examine.jsx
+++ b/gz-customerSystem/src/views/register/eventFlow/component/Examine.jsx
@@ -1,19 +1,240 @@
-import React from 'react'
-import { Space } from 'antd';
+import React, { useRef, useEffect, useState } 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 * as $$ from '@/utils/utility';
+import { getOffset, getSize } from '@/utils/utility';
+
+const RadioGroup = Radio.Group;
+const FormItem = Form.Item;
+const TextArea = Input.TextArea;
+const appUrl = $$.appUrl;
+
+function getData(type, data) {
+ let url = type === 'htsh' ? `caseTask/getReturnApplyInfo` : `caseTask/getAppearApplyInfo`
+ return $$.ax.request({ url: url, type: 'get', service: 'mediate', data });
+}
+
+function submit(type, data) {
+ let url = type === 'htsh' ? `caseTask/returnAudit` : `caseTask/appearAudit`
+ return $$.ax.request({ url: url, type: 'post', service: 'mediate', data });
+}
+
+function delFile(id) {
+ return $$.ax.request({ url: `fileInfo/deleteFileById`, type: 'get', service: 'sys', data: { id } });
+}
export default function Examine(props) {
+ 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 = [
+ {
+ label: '回退理由不充分',
+ value: '0'
+ },
+ {
+ label: '回退延迟',
+ value: '1'
+ },
+ {
+ label: '其他',
+ value: '2'
+ },
+ ]
+
+ useEffect(() => {
+ getInfoData()
+ }, [props.type])
+
+ 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 () => {
+ const res = await getData(props.type, {
+ caseTaskId: props.caseTaskId
+ })
+ if (res.type) {
+ setInfoData(res.data || {})
+ setId(res.data.id)
+ }
+ }
+
+ 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(props.type, 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'>
<div className='whiteBox'>
<Space size='small'>
- <div className='MediationInfo-subTitle' style={{ marginTop: '-8px' }}></div><h5>回退申请</h5>
+ <div className='MediationInfo-subTitle' style={{ marginTop: '-8px' }}></div><h5>{props.type === 'htsh' ? '回退申请' : '上报申请'}</h5>
</Space>
+ <Row gutter={[16, 16]}>
+ <Col span={24}>
+ <div><div className="title-text">{props.type === 'htsh' ? '回退理由' : '上报理由'}</div></div>
+ <div>{infoData[mainFlag + 'Content'] || '-'}</div>
+ </Col>
+ <Col span={24}>
+ <div><div className="title-text">附件材料</div></div>
+ <div style={{ color: '#1A6FB8' }}>
+ {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.trueName}
+ {resIndex !== res.fileList.length - 1 && <>,</>}
+ </a>
+ })
+ }) || '-'}
+ </div>
+ </Col>
+ <Col span={24}>
+ <div><div className="title-text">申请时间</div></div>
+ <div>{$$.myTimeFormat(infoData[mainFlag + 'Time'], 'YYYY-MM-DD HH:mm') || '-'}</div>
+ </Col>
+ <Col span={24}>
+ <div><div className="title-text">申请人</div></div>
+ <div>
+ {infoData[mainFlag + 'UnitName']}
+ {infoData[mainFlag + 'UserName'] || '-'}
+ <img src={register} alt="" className="title-register" />
+ </div>
+ </Col>
+ </Row>
</div>
- <div className='whiteBox'>
- <Space size='small'>
- <div className='MediationInfo-subTitle' style={{ marginTop: '-8px' }}></div><h5>审核</h5>
- </Space>
+ <div className='whiteBox' style={{ marginTop: '8px' }}>
+ <Scrollbars style={{ height: height + 'px' }} autoHide ref={scrollRef}>
+ <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) => {
+ if (value) {
+ const data = $$.options.auditResult.find(item => item.value === value)
+ formRef.current.setFieldValue('auditResultName', data.label)
+ } else {
+ formRef.current.setFieldValue('auditResultName', '')
+ }
+ }}
+ />
+ </FormItem>
+ </Col>
+ <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('auditContent', obj.label)
+ }}
+ >
+ </RadioGroup>
+ </FormItem>
+ </Col>
+ <Col span={24}>
+ <FormItem
+ label=' '
+ 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=${props.type == 'htsh' ? '22_00018-511' : '22_00018-513'}`,
+ }}
+ field='file'
+ label='附件材料'
+ handleDelFile={handleDelFile}
+ />
+ </Col>
+ </Row>
+ </Form>
+ </Scrollbars>
+ <div className='dialogFooter'>
+ <Button
+ type="primary"
+ className="dialogPrimary"
+ onClick={handleSubmit}
+ >
+ 提交
+ </Button>
+ </div>
</div>
</div>
</div>
--
Gitblit v1.8.0