From 68f41dad70cc9c90b87258d91300576d7f5682e7 Mon Sep 17 00:00:00 2001 From: liuwh <964324856@qq.com> Date: Sat, 14 Sep 2024 15:58:38 +0800 Subject: [PATCH] Merge branch 'master' of http://120.79.193.119:9090/r/gzzfw/frontEnd/gzDyh into master --- gz-customerSystem/src/views/register/eventFlow/component/Examine.jsx | 220 ++++++++++++++++++++++++++++++++----------------------- 1 files changed, 128 insertions(+), 92 deletions(-) diff --git a/gz-customerSystem/src/views/register/eventFlow/component/Examine.jsx b/gz-customerSystem/src/views/register/eventFlow/component/Examine.jsx index a93a3b7..c0b35ae 100644 --- a/gz-customerSystem/src/views/register/eventFlow/component/Examine.jsx +++ b/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,19 @@ 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: '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 [agreeRadio, setAgreeRadio] = useState(); + const [reasonRadio, setReasonRadio] = useState(); const mainFlag = props.type == 'htsh' ? 'return' : 'appear' const options = [ { @@ -51,16 +54,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 - 80) + }; //回显数据 const getInfoData = async () => { @@ -69,6 +81,7 @@ }) if (res.type) { setInfoData(res.data || {}) + setId(res.data.id) } } @@ -92,6 +105,7 @@ const res = await submit(props.type, data) if (res.type) { $$.infoSuccess({ content: '提交成功!' }); + navigate('/mediate/visit/visitWorkBench') } } @@ -105,38 +119,45 @@ return ( <div className='dataSync'> - <div className='dataSync-noBackTabPage'> - <div className='whiteBox'> - <Space size='small'> - <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' }}> - <img src={link} alt="" className="title-file" />{infoData?.file || '-'} - </div> - </Col> - <Col span={24}> - <div><div className="title-text">申请时间</div></div> - <div>{infoData[mainFlag + 'Time'] || '-'}</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' style={{ marginTop: '8px' }}> - <Scrollbars style={{ height: 'calc(100vh - 577px)' }} autoHide> + <div className='dataSync-noBackTabPage' style={{ background: '#fff' }}> + <Scrollbars style={{ height: height + 'px' }} autoHide ref={scrollRef}> + <div className='whiteBox'> + <Space size='small'> + <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.name} + {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' style={{ borderTop: '8px solid #f0f2f5' }}> <Space size='small'> <div className='MediationInfo-subTitle' style={{ marginTop: '-8px' }}></div><h5>审核</h5> </Space> @@ -145,6 +166,8 @@ layout='vertical' requiredSymbol={false} initialValues={{ + auditResult: '24_00004-1', + auditResultName: "同意" }}//默认值 scrollToFirstError > @@ -158,6 +181,7 @@ 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) @@ -168,59 +192,71 @@ /> </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('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=${props.type == 'htsh' ? '22_00018-511' : '22_00018-513'}`, - }} - field='file' - label='附件材料' - handleDelFile={handleDelFile} - /> - </Col> + {agreeRadio == '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) => { + setReasonRadio(value) + if (value !== '2') { + const obj = options.find(item => item.value === value) + formRef.current.setFieldValue('auditContent', obj.label) + } else { + formRef.current.setFieldValue('auditContent', '') + } + }} + > + </RadioGroup> + </FormItem> + </Col> + { + reasonRadio === '2' && <Col span={24}> + <FormItem + label=' ' + field='auditContent' + rules={[{ required: true, message: '理由不能为空' }]} + > + <TextArea + autoSize={{ minRows: 4, maxRows: 8 }} + placeholder={`请填写不同意${props.type === 'htsh' ? '回退' : '上报'}的具体理由`} + /> + </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> + </Scrollbars> + <div className='dialogFooter' style={{ margin: 0, padding: '16px 12px' }}> + <Button + type="primary" + className="dialogPrimary" + onClick={handleSubmit} + > + 提交 + </Button> + <Button type='secondary' onClick={() => navigate(-1)}>返回上级页面</Button> </div> </div> - </div> + </div > ) } -- Gitblit v1.8.0