From 42ad61a075d8a3c32949d83bf40acc53b2da25b1 Mon Sep 17 00:00:00 2001
From: zhangyongtian <1181606322@qq.com>
Date: Fri, 13 Sep 2024 20:53:35 +0800
Subject: [PATCH] fix: 修改预览的文件回显bug
---
gz-customerSystem/src/views/register/visit/component/visitorRegister.jsx | 72 +++++++++++++++--------------------
1 files changed, 31 insertions(+), 41 deletions(-)
diff --git a/gz-customerSystem/src/views/register/visit/component/visitorRegister.jsx b/gz-customerSystem/src/views/register/visit/component/visitorRegister.jsx
index 0a883e8..25853bf 100644
--- a/gz-customerSystem/src/views/register/visit/component/visitorRegister.jsx
+++ b/gz-customerSystem/src/views/register/visit/component/visitorRegister.jsx
@@ -26,6 +26,7 @@
const [addVisabled, setAddVisabled] = useState(false);//添加当事人弹窗控制
const [fakeData, setFakeData] = useState([]);//当事人信息数据
const [scanFile, setScanFile] = useState(false);
+ const [ocrText, setOcrText] = useState('');
const [mapView, setMapView] = useState(false);
const [visible, setVisible] = useState(false);
@@ -49,32 +50,7 @@
}, [fakeData])
useEffect(() => {
- setFakeData(props.partyList?.map(item => {
- const fileInfoList = item.fileInfoList
- let file = [];//身份证明材料、企业登记材料
- let file1 = [];//法人、机构身份证明材料、代理人授权委托书
- if (fileInfoList && fileInfoList.length != 0) {
- fileInfoList.forEach(item => {
- if (item.ownerType == '22_00018-202' || item.ownerType == '22_00018-203') {
- file.push({
- name: item.fileList[0].trueName,
- uid: item.fileList[0].id,
- })
- }
- if (item.ownerType == '22_00018-204' || item.ownerType == '22_00018-207') {
- file1.push({
- name: item.fileList[0].trueName,
- uid: item.fileList[0].id,
- })
- }
- })
- }
- return {
- ...item,
- file,
- file1
- }
- }) || [])
+ setFakeData(props.partyList || [])
}, [props.partyList])
//获取当前时间
@@ -101,7 +77,7 @@
const handleConfirm = (scanContent) => {
// 处理确认逻辑
- props.formRef.current.setFieldValue('caseDes', scanContent)
+ props.formRef.current.setFieldValue(ocrText, scanContent)
setScanFile(false);
console.log(scanContent, 'scanContent')
@@ -182,6 +158,7 @@
initialValues={{
caseLevel: 3,
visitTime: getFormattedDateTime(),
+ occurTime: getFormattedDateTime(),
majorStatus: 0,
}}//默认值
>
@@ -275,22 +252,27 @@
</FormItem>
</Col>
<Col span={8}>
- <FormItem label='问题属地' field='myQuesAddress'>
+ <FormItem
+ label={(<div style={{ display: 'flex' }}>问题属地<div className="must">必填</div></div>)}
+ field='myQuesAddress'
+ rules={[{ message: '请选择问题属地', required: true }]}
+ >
<Cascader
placeholder='请选择'
options={$$.locationOption()}
showSearch
onChange={(value, option) => {
if (option) {
+ console.log(option)
props.formRef.current.setFieldsValue({
- queProv: option[0].value,
- queProvName: option[0].label,
- queCity: option[1].value,
- queCityName: option[1].label,
- queArea: option[2].value,
- queAreaName: option[2].label,
- queRoad: option[3] && option[3].value || '',
- queRoadName: option[3] && option[3].label || '',
+ // queProv: option[0].value,
+ // queProvName: option[0].label,
+ // queCity: option[1].value,
+ // queCityName: option[1].label,
+ queArea: option[0].value,
+ queAreaName: option[0].label,
+ queRoad: option[1] && option[1].value || '',
+ queRoadName: option[1] && option[1].label || '',
})
} else {
//清除数据
@@ -330,7 +312,7 @@
</Tooltip>
<div className="must" style={{ marginLeft: '4px' }}>必填</div>
<img src={scan} alt="" style={{ marginRight: '-2px', marginLeft: '8px' }} />
- <div style={{ marginLeft: '8px', color: '#1A6FB8', fontSize: '14px', cursor: 'pointer' }} onClick={() => setScanFile(true)}>识别上传材料</div>
+ <div style={{ marginLeft: '8px', color: '#1A6FB8', fontSize: '14px', cursor: 'pointer' }} onClick={() => { setScanFile(true); setOcrText('caseDes') }}>识别材料</div>
</div>
}
field='caseDes'
@@ -354,7 +336,7 @@
</Tooltip> */}
<div className="must">必填</div>
<img src={scan} alt="" style={{ marginRight: '-2px', marginLeft: '8px' }} />
- <div style={{ marginLeft: '8px', color: '#1A6FB8', fontSize: '14px', cursor: 'pointer' }} onClick={() => setScanFile(true)}>识别上传材料</div>
+ <div style={{ marginLeft: '8px', color: '#1A6FB8', fontSize: '14px', cursor: 'pointer' }} onClick={() => { setScanFile(true); setOcrText('caseClaim') }}>识别材料</div>
</div>
}
field='caseClaim'
@@ -384,14 +366,22 @@
</div>
</Row>
- </Form>
+ </Form >
<Col span={24} style={{ display: 'flex', alignItems: 'center', marginBottom: '8px', marginTop: '20px' }}>
<Space size='small'>
<div className='MediationInfo-subTitle' style={{ marginTop: '-9px' }}></div><h4>事件材料</h4>
</Space>
</Col>
- <FileTable mainId={props.mainId} fileInfoList={props.fileInfoList} isReview={false}/>
-
+ <div style={{ marginBottom: '65px' }}>
+ <FileTable
+ mainId={props.mainId}
+ fileInfoList={props.fileInfoList}
+ isReview={false}
+ handleSaveList={(list) => {
+ props.formRef.current.setFieldValue('fileInfoList', list)
+ }}
+ />
+ </div>
<DocumentScanner
visible={scanFile}
onConfirm={handleConfirm}
--
Gitblit v1.8.0