From f6efc465e8f5633313afc8da54c17988722073eb Mon Sep 17 00:00:00 2001 From: zhangyongtian <1181606322@qq.com> Date: Sat, 14 Sep 2024 15:55:07 +0800 Subject: [PATCH] fix: 审核页面逻辑调整、滚动调整 --- gz-customerSystem/src/views/register/closingReview/component/ReviewExamine.jsx | 102 +++++++++++++++++++++++++++++++++------------------ 1 files changed, 66 insertions(+), 36 deletions(-) diff --git a/gz-customerSystem/src/views/register/closingReview/component/ReviewExamine.jsx b/gz-customerSystem/src/views/register/closingReview/component/ReviewExamine.jsx index 63352ca..c5e7665 100644 --- a/gz-customerSystem/src/views/register/closingReview/component/ReviewExamine.jsx +++ b/gz-customerSystem/src/views/register/closingReview/component/ReviewExamine.jsx @@ -7,6 +7,7 @@ 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; @@ -36,10 +37,13 @@ export default function ReviewExamine(props) { const navigate = useNavigate(); const formRef = useRef(); + const scrollRef = useRef(null); const [result, setResult] = useState() const [infoData, setInfoData] = useState({}); const [id, setId] = useState(); const [progressData, setProgressData] = useState({}) + const [reasonRadio, setReasonRadio] = useState(); + const [height, setHeight] = useState(500); const options = [ { label: '材料不完整', @@ -58,26 +62,42 @@ value: '4' }, ] - console.log(props.id,'props.idprops.id') + useEffect(() => { getInfoData() - getAppId() + // getAppId() getProData() + onWindowResize() + window.addEventListener("resize", onWindowResize); + // 返回一个函数,该函数会在组件卸载前执行 + return () => { + // 组件销毁时执行 + window.removeEventListener("resize", onWindowResize); + }; }, []) - //获取id - const getAppId = async () => { - const res = await getId() - if (res.type) { - setId(res.data) + const onWindowResize = () => { + let offsetTop = 0; + if (scrollRef.current.container) { + offsetTop = getOffset(scrollRef.current.container).top; } - } + setHeight(getSize().windowH - offsetTop - 80) + }; + + //获取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 || {}) + setId(res.data.id) } } @@ -97,7 +117,7 @@ if (!errors) { const { file, myNoUp, ...rest } = formRef.current.getFields() requestSubmit({ - id: props.id, + id: id, caseId: props.caseId, caseTaskId: props.caseTaskId, ...rest @@ -125,8 +145,8 @@ return ( <div className='dataSync'> - <div className='dataSync-noBackTabPage'> - <Scrollbars style={{ height: '100%' }} 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>结案申请</h5> @@ -154,7 +174,7 @@ </Col> */} <Col span={24}> <div><div className="title-text">申请时间</div></div> - <div>{infoData?.applyTime || '-'}</div> + <div>{$$.myTimeFormat(infoData?.applyTime, 'YYYY-MM-DD HH:mm') || '-'}</div> </Col> <Col span={24}> <div><div className="title-text">申请人</div></div> @@ -166,7 +186,7 @@ </Col> </Row> </div> - <div style={{ display: 'flex', marginTop: '8px' }}> + <div style={{ display: 'flex', borderTop: '8px solid #f0f2f5' }}> <div className='whiteBox' style={{ flex: 1, marginRight: '8px' }}> <Space size='small'> <div className='MediationInfo-subTitle' style={{ marginTop: '-8px' }}></div><h5>审核</h5> @@ -176,6 +196,8 @@ layout='vertical' requiredSymbol={false} initialValues={{ + auditResult: '24_00004-1', + auditResultName: '同意' }}//默认值 scrollToFirstError > @@ -212,25 +234,32 @@ direction='vertical' options={options} onChange={(value) => { - const obj = options.find(item => item.value === value) - formRef.current.setFieldValue('audit_content', obj.label) + setReasonRadio(value) + if (value !== '4') { + const obj = options.find(item => item.value === value) + formRef.current.setFieldValue('auditContent', obj.label) + } else { + formRef.current.setFieldValue('auditResultName', '') + } }} > </RadioGroup> </FormItem> </Col> - <Col span={24}> - <FormItem - label=' ' - field='audit_content' - rules={[{ required: true, message: '理由不能为空' }]} - > - <TextArea - autoSize={{ minRows: 4, maxRows: 8 }} - placeholder='请填写回退的具体理由' - /> - </FormItem> - </Col> + { + reasonRadio === '4' && <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={{ @@ -245,15 +274,6 @@ } </Row> </Form> - <div className='dialogFooter'> - <Button - type="primary" - className="dialogPrimary" - onClick={handleSubmit} - > - 提交 - </Button> - </div> </div> { (infoData.caseLevel === 1 || infoData.caseLevel === 2) && @@ -266,6 +286,16 @@ } </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> ) -- Gitblit v1.8.0