import React, { useRef, useState, useEffect } from 'react'
|
import { Row, Col, Space } from 'antd';
|
import { register } from '@/assets/images';
|
import { Form, Input, Button, Radio, Message } from '@arco-design/web-react';
|
import { Scrollbars } from "react-custom-scrollbars";
|
import ReviewProgress from './ReviewProgress';
|
import * as $$ from '@/utils/utility';
|
import { useNavigate } from 'react-router-dom';
|
import { getOffset, getSize } from '@/utils/utility';
|
|
const RadioGroup = Radio.Group;
|
const FormItem = Form.Item;
|
const TextArea = Input.TextArea;
|
|
function getData(data) {
|
return $$.ax.request({ url: `rmtj/getApplyInfo`, type: 'get', service: 'mediate', data });
|
}
|
|
function submit(data) {
|
return $$.ax.request({ url: `rmtj/batchEndAudit`, type: 'post', service: 'mediate', data });
|
}
|
|
export default function ReviewExamine(props) {
|
const navigate = useNavigate();
|
const formRef = useRef();
|
const scrollRef = useRef(null);
|
const [result, setResult] = useState()
|
const [infoData, setInfoData] = useState({});
|
const [height, setHeight] = useState(500);
|
|
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({ applyId: props.applyId })
|
if (res.type) {
|
setInfoData(res.data || {})
|
}
|
}
|
|
const handleSubmit = () => {
|
if (formRef.current) {
|
formRef.current.validate(undefined, (errors, values) => {
|
if (!errors) {
|
const data = formRef.current.getFields()
|
requestSubmit({
|
applyIdList: [props.applyId],
|
...data
|
})
|
}
|
})
|
}
|
}
|
|
const requestSubmit = async (data) => {
|
const res = await submit(data)
|
if (res.type) {
|
Message.success({
|
content: <div className='myMessageBox'>
|
<div className='messageTop'>案件转入中</div>
|
<div className='messageBottom'>案件正在转入人民调解系统,这个过程可能需要几分钟,请耐心等待</div>
|
</div>,
|
showIcon: true,
|
className: 'acro-myMessage',
|
position: 'bottom',
|
duration: 5000,
|
})
|
navigate(-1)
|
}
|
}
|
|
return (
|
<div className='dataSync'>
|
<div className='dataSync-noBackTabPage'>
|
<Scrollbars style={{ height: height + 'px' }} autoHide ref={scrollRef}>
|
<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>{$$.myTimeFormat(infoData?.applyTime, 'YYYY-MM-DD HH:mm') || '-'}</div>
|
</Col>
|
<Col span={24}>
|
<div><div className="title-text">申请人</div></div>
|
<div>
|
{infoData?.applyUnitName}
|
{infoData?.applyUserName}
|
<img src={register} alt="" className="title-register" />
|
</div>
|
</Col>
|
</Row>
|
</div>
|
<div style={{ display: 'flex', borderTop: '8px solid #f0f2f5', height: 'calc(100% - 160px)' }}>
|
<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={{
|
auditResult: '1',
|
auditResultName: '同意'
|
}}//默认值
|
scrollToFirstError
|
>
|
<Row>
|
<Col span={24}>
|
<FormItem
|
label={(<div style={{ display: 'flex' }}>审核结果</div>)}
|
field='auditResult'
|
>
|
<RadioGroup
|
direction='vertical'
|
options={[
|
{
|
label: '同意',
|
value: '1'
|
},
|
{
|
label: '不同意',
|
value: '2'
|
},
|
]}
|
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 === '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>
|
</>
|
}
|
</Row>
|
</Form>
|
</div>
|
<div className='whiteBox' style={{ width: '400px' }}>
|
<Space size='small'>
|
<div className='MediationInfo-subTitle' style={{ marginTop: '-8px' }}></div><h5>审核进度</h5>
|
</Space>
|
<ReviewProgress progressData={infoData.applyList || []} />
|
</div>
|
</div>
|
</Scrollbars>
|
<div className='dialogFooter' style={{ margin: 0, padding: '16px 12px', background: '#fff' }}>
|
<Button
|
type="primary"
|
className="dialogPrimary"
|
onClick={handleSubmit}
|
>
|
提交
|
</Button>
|
<Button type='secondary' onClick={() => navigate(-1)}>返回上级页面</Button>
|
</div>
|
</div>
|
</div>
|
)
|
}
|