From 3326977aa58fedbac88d3c009eac06c33020db0d Mon Sep 17 00:00:00 2001
From: zhangyongtian <1181606322@qq.com>
Date: Sun, 08 Sep 2024 15:29:01 +0800
Subject: [PATCH] feat: 当事人文件回显

---
 gz-customerSystem/src/views/register/matterDetail/index.jsx              |   30 +++++++++
 gz-customerSystem/src/views/register/visit/component/applyDialog.jsx     |   13 ++-
 gz-customerSystem/src/components/ArcoUpload/index.jsx                    |   31 +++++++++-
 gz-customerSystem/src/views/register/eventFlow/component/BackModel.jsx   |    2 
 gz-customerSystem/src/components/personCard/DetailDialog.jsx             |   28 ++------
 gz-customerSystem/src/views/register/visit/component/agentDialog.jsx     |    8 +-
 gz-customerSystem/src/views/register/visit/component/visitorRegister.jsx |   34 ++++++++++
 gz-customerSystem/src/api/appUrl.js                                      |    4 
 gz-customerSystem/src/views/register/visit/index.jsx                     |   10 ++-
 9 files changed, 117 insertions(+), 43 deletions(-)

diff --git a/gz-customerSystem/src/api/appUrl.js b/gz-customerSystem/src/api/appUrl.js
index 7e3192e..548b48f 100644
--- a/gz-customerSystem/src/api/appUrl.js
+++ b/gz-customerSystem/src/api/appUrl.js
@@ -10,11 +10,11 @@
 export const debug = {
   // web服务
   // baseUrl: 'http://gz.hugeinfo.com.cn',
-  baseUrl: "http://fydddb.natappfree.cc",
+  baseUrl: "http://sbv8tf.natappfree.cc",
   // baseUrl: 'http://mdqgnh.natappfree.cc',
 
   // 附件服务
-  fileUrl: "http://fydddb.natappfree.cc",
+  fileUrl: "http://sbv8tf.natappfree.cc",
   // fileUrl: 'http://gz.hugeinfo.com.cn',
 
   // 文件查看url 后面接附件编号
diff --git a/gz-customerSystem/src/components/ArcoUpload/index.jsx b/gz-customerSystem/src/components/ArcoUpload/index.jsx
index b440f36..7f87aa1 100644
--- a/gz-customerSystem/src/components/ArcoUpload/index.jsx
+++ b/gz-customerSystem/src/components/ArcoUpload/index.jsx
@@ -23,6 +23,7 @@
  * label *, // form的label名
  * editData *, // 编辑回显数据
  * handleDelFile *,//删除文件接口
+ * ownerType,//用于回显文件
  */
 
 export default function ArcoUpload(props) {
@@ -36,8 +37,22 @@
 
   useEffect(() => {
     if (props.editData) {
-      console.log(props.editData[props.field]);
-      setMyFileList(props.editData[props.field])
+      if(props.editData[props.field]) {
+        //新增的时候有file数据,可以这样子回显
+        setMyFileList(props.editData[props.field])
+      } else {
+        //编辑的时候,文件统一放在filInfoList了,需要设置ownerType获取到该材料文件回显
+        const fileInfoList = props.editData.fileInfoList
+        if(fileInfoList && fileInfoList.length != 0) {
+          let file = [];
+          fileInfoList.forEach(item => {
+            if(item.ownerType == props.ownerType)  {
+              file.push(item.fileList[0])
+            }
+          })
+          setMyFileList(file)
+        }
+      }
     }
   }, [props.editData])
 
@@ -60,7 +75,8 @@
           }}
           headers={{ Authorization: $$.getSessionStorage('customerSystemToken') }}
           onChange={(fileList, file) => {
-            const { status, response } = file
+            const { status, response, uid } = file
+            console.log(fileList, file);
             //因为字节upLoad组件有bug,不能区分添加文件还是删除文件,所以用这种办法来判断是不是删除
             const isDel = myFileList && myFileList.length > fileList.length
             //上传失败
@@ -79,7 +95,14 @@
             }
             //删除文件
             if (isDel && props.handleDelFile) {
-              props.handleDelFile(response.data[0].id)
+              if(response) {
+                //删除的是新提交的
+                props.handleDelFile(response.data[0].id)
+              } else {
+                //删除的是回显的文件
+                props.handleDelFile(uid)
+              }
+              
             }
             handleFileListChange(fileList);
             setMyFileList(fileList)
diff --git a/gz-customerSystem/src/components/personCard/DetailDialog.jsx b/gz-customerSystem/src/components/personCard/DetailDialog.jsx
index 5c6877a..183501d 100644
--- a/gz-customerSystem/src/components/personCard/DetailDialog.jsx
+++ b/gz-customerSystem/src/components/personCard/DetailDialog.jsx
@@ -124,17 +124,13 @@
     [
       {
         label: '登记企业材料',
-        value: <a href="your-link-here.html" target="_blank">
-          <img src={link} alt="" className="title-file" />广东好又多餐饮有限公司营业执照.pdf
-        </a>,
+        value: '',
         isFile: true,
         field: 'file',
       },
       {
         label: '法定代表人身份证明材料',
-        value: <a href="your-link-here.html" target="_blank">
-          <img src={link} alt="" className="title-file" />江照月个人身份.pdf
-        </a>,
+        value: '',
         isFile: true,
         field: 'file1',
       },
@@ -189,17 +185,13 @@
     [
       {
         label: '机构登记材料',
-        value: <a href="your-link-here.html" target="_blank">
-          <img src={link} alt="" className="title-file" />广东好又多餐饮有限公司营业执照.pdf
-        </a>,
+        value: '',
         isFile: true,
         field: 'file',
       },
       {
         label: '机构代表人身份证明材料',
-        value: <a href="your-link-here.html" target="_blank">
-          <img src={link} alt="" className="title-file" />江照月个人身份.pdf
-        </a>,
+        value: '',
         isFile: true,
         field: 'file1',
       },
@@ -290,17 +282,13 @@
     [
       {
         label: '身份证明材料',
-        value: <a href="your-link-here.html" target="_blank">
-          <img src={link} alt="" className="title-file" />广东好又多餐饮有限公司营业执照.pdf
-        </a>,
+        value: '',
         isFile: true,
         field: 'file',
       },
       {
         label: '代理人授权委托书',
-        value: <a href="your-link-here.html" target="_blank">
-          <img src={link} alt="" className="title-file" />江照月个人身份.pdf
-        </a>,
+        value: '',
         isFile: true,
         field: 'file1',
       },
@@ -394,9 +382,9 @@
         }
       </table>
       {/* 重复来访重点人员 */}
-      <div style={{ width: 'calc(100% - 9px)', background: '#f2f3f5', marginBottom: '20px', padding: '12px' }}>
+      {/* <div style={{ width: 'calc(100% - 9px)', background: '#f2f3f5', marginBottom: '20px', padding: '12px' }}>
         <KeyVisits />
-      </div>
+      </div> */}
     </div>
   )
 }
diff --git a/gz-customerSystem/src/views/register/eventFlow/component/BackModel.jsx b/gz-customerSystem/src/views/register/eventFlow/component/BackModel.jsx
index f677318..66f9761 100644
--- a/gz-customerSystem/src/views/register/eventFlow/component/BackModel.jsx
+++ b/gz-customerSystem/src/views/register/eventFlow/component/BackModel.jsx
@@ -134,7 +134,7 @@
             <Col span={24} className="doubleFile">
               <ArcoUpload
                 params={{
-                  action: `${appUrl.fileUrl}/${appUrl.sys}/api/web/fileInfo/upload?mainId=${props.caseId}&ownerId=${id}&ownerType=22_00018-520`,
+                  action: `${appUrl.fileUrl}/${appUrl.sys}/api/web/fileInfo/upload?mainId=${props.caseId}&ownerId=${id}&ownerType=22_00018-510`,
                 }}
                 field='file'
                 label='附件材料'
diff --git a/gz-customerSystem/src/views/register/matterDetail/index.jsx b/gz-customerSystem/src/views/register/matterDetail/index.jsx
index 18e733b..293f2fb 100644
--- a/gz-customerSystem/src/views/register/matterDetail/index.jsx
+++ b/gz-customerSystem/src/views/register/matterDetail/index.jsx
@@ -121,7 +121,7 @@
 
     // 更多数据...
   ];
-  
+
   useEffect(() => {
     console.log(props);
     getCaseInfo(props.caseId)
@@ -133,12 +133,38 @@
 
     if (res.type) {
       let data = res.data
+      const partyList = data.personList.concat(data.agentList)
       setInfoData({
         ...data,
         questionName: data.queProvName === null ? '-' : data.queProvName + '/' + data.queCityName + '/' + data.queAreaName + '/' + data.queRoadName + '/' + data.queVillageName,
         caseType: data.caseTypeFirstName === null ? '-' : data.caseTypeFirstName + '/' + data.caseTypeName
       })
-      setFakeData(data.personList.concat(data.agentList))
+      setFakeData(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
+        }
+      }))
     }
 
   }
diff --git a/gz-customerSystem/src/views/register/visit/component/agentDialog.jsx b/gz-customerSystem/src/views/register/visit/component/agentDialog.jsx
index 5329deb..2f1bc3c 100644
--- a/gz-customerSystem/src/views/register/visit/component/agentDialog.jsx
+++ b/gz-customerSystem/src/views/register/visit/component/agentDialog.jsx
@@ -131,16 +131,18 @@
                     label='身份证明材料'
                     editData={props.editData}
                     handleDelFile={handleDelFile}
+                    ownerType='22_00018-202'
                   />
                 </Col>
                 <Col span={24} className="doubleFile">
                   <ArcoUpload
                     params={{
-                      action: `${appUrl.fileUrl}/${appUrl.sys}/api/web/fileInfo/upload?mainId=${props.mainId}&ownerId=${id}&ownerType=22_00018-202`,
+                      action: `${appUrl.fileUrl}/${appUrl.sys}/api/web/fileInfo/upload?mainId=${props.mainId}&ownerId=${id}&ownerType=22_00018-207`,
                     }}
                     field='file1'
                     label='代理人委托书'
                     editData={props.editData}
+                    ownerType='22_00018-207'
                   />
                 </Col>
                 <Col span={12}>
@@ -318,9 +320,9 @@
         </Row>
 
         {/* 重复来访重点人员 */}
-        <div style={{ width: 'calc(100% - 9px)', background: '#f2f3f5', marginBottom: '20px', padding: '12px' }}>
+        {/* <div style={{ width: 'calc(100% - 9px)', background: '#f2f3f5', marginBottom: '20px', padding: '12px' }}>
           <KeyVisits />
-        </div>
+        </div> */}
       </Scrollbars>
       <div className='dialogFooter'>
         <Button
diff --git a/gz-customerSystem/src/views/register/visit/component/applyDialog.jsx b/gz-customerSystem/src/views/register/visit/component/applyDialog.jsx
index 68546ba..121fed4 100644
--- a/gz-customerSystem/src/views/register/visit/component/applyDialog.jsx
+++ b/gz-customerSystem/src/views/register/visit/component/applyDialog.jsx
@@ -41,6 +41,7 @@
 
   useEffect(() => {
     if (props.editData) {
+      console.log(props.editData);
       //编辑
       formRef.current.setFieldsValue({
         ...props.editData
@@ -108,6 +109,7 @@
               label='身份证明材料'
               editData={props.editData}
               handleDelFile={handleDelFile}
+              ownerType='22_00018-202'
             />
           </Col>
           <Col span={12}>
@@ -238,23 +240,25 @@
           <Col span={24} className="doubleFile">
             <ArcoUpload
               params={{
-                action: `${appUrl.fileUrl}/${appUrl.sys}/api/web/fileInfo/upload?mainId=${props.mainId}&ownerId=${id}&ownerType=22_00018-202`,
+                action: `${appUrl.fileUrl}/${appUrl.sys}/api/web/fileInfo/upload?mainId=${props.mainId}&ownerId=${id}&ownerType=22_00018-203`,
               }}
               field='file'
               label={isLegal ? '企业登记材料' : '机构登记材料'}
               editData={props.editData}
               handleDelFile={handleDelFile}
+              ownerType='22_00018-203'
             />
           </Col>
           <Col span={24} className="doubleFile">
             <ArcoUpload
               params={{
-                action: `${appUrl.fileUrl}/${appUrl.sys}/api/web/fileInfo/upload?mainId=${props.mainId}&ownerId=${id}&ownerType=22_00018-202`,
+                action: `${appUrl.fileUrl}/${appUrl.sys}/api/web/fileInfo/upload?mainId=${props.mainId}&ownerId=${id}&ownerType=22_00018-204`,
               }}
               field='file1'
               label={isLegal ? '法定代表人身份证明材料' : '机构代表人身份证明材料'}
               editData={props.editData}
               handleDelFile={handleDelFile}
+              ownerType='22_00018-204'
             />
           </Col>
           <Col span={12}>
@@ -328,7 +332,6 @@
       formRef.current.validate(undefined, (errors, values) => {
         if (!errors) {
           const fieldValue = formRef.current.getFields()
-          console.log(fieldValue);
           if (props.editData) {
             props.handleAddParty({
               ...fieldValue
@@ -393,9 +396,9 @@
         </Row>
 
         {/* 重复来访重点人员 */}
-        <div style={{ width: 'calc(100% - 9px)', background: '#f2f3f5', marginBottom: '20px', padding: '12px' }}>
+        {/* <div style={{ width: 'calc(100% - 9px)', background: '#f2f3f5', marginBottom: '20px', padding: '12px' }}>
           <KeyVisits />
-        </div>
+        </div> */}
       </Scrollbars>
       <div className='dialogFooter'>
         <Button
diff --git a/gz-customerSystem/src/views/register/visit/component/visitorRegister.jsx b/gz-customerSystem/src/views/register/visit/component/visitorRegister.jsx
index 40078ea..82cf116 100644
--- a/gz-customerSystem/src/views/register/visit/component/visitorRegister.jsx
+++ b/gz-customerSystem/src/views/register/visit/component/visitorRegister.jsx
@@ -48,6 +48,36 @@
     }
   }, [fakeData])
 
+  useEffect(() => {
+    console.log(props.partyList);
+    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
+      }
+    }))
+  }, [props.partyList])
+
   //获取当前时间
   const getFormattedDateTime = () => {
     let now = new Date();
@@ -85,7 +115,7 @@
 
   //添加当事人
   const handleAddParty = (value, isEdit) => {
-    console.log(value, isEdit);
+    console.log(value);
     if (isEdit) {
       //编辑
       const newList = fakeData.map(item => {
@@ -361,7 +391,7 @@
           <div className='MediationInfo-subTitle' style={{ marginTop: '-9px' }}></div><h4>事件材料</h4>
         </Space>
       </Col>
-      <FileTable mainId={props.mainId}/>
+      <FileTable mainId={props.mainId} />
 
       <DocumentScanner
         visible={scanFile}
diff --git a/gz-customerSystem/src/views/register/visit/index.jsx b/gz-customerSystem/src/views/register/visit/index.jsx
index c32fc7c..11ad52f 100644
--- a/gz-customerSystem/src/views/register/visit/index.jsx
+++ b/gz-customerSystem/src/views/register/visit/index.jsx
@@ -33,7 +33,7 @@
 }
 
 function getDetailData(id) {
-	return $$.ax.request({ url: `/casedraftInfo/getCasedraftInfo?id=${id}`, type: 'get', service: 'mediate' });
+	return $$.ax.request({ url: `casedraftInfo/getCasedraftInfo?id=${id}`, type: 'get', service: 'mediate' });
 }
 
 
@@ -44,6 +44,7 @@
 	const [isReview, setIsReview] = useState(false);//预览页面控制
 	const [current, setCurrent] = useState(1);
 	const [id, setId] = useState();
+	const [partyList, setPartyList] = useState([]);//当事人信息,用于子组件回显
 
 	useEffect(() => {
 		if (routeData.id) {
@@ -59,14 +60,15 @@
 	const getDeatil = async (id) => {
 		const res = await getDetailData(id)
 		if (res.type) {
-			console.log(res);
 			const { agentList, personList, ...rest } = res.data
+			const parList = agentList.concat(personList)
 			formRef.current.setFieldsValue({
 				...rest,
-				fakeData: agentList.concat(personList),
+				fakeData: parList,
 				myCaseType: [rest.caseTypeFirst, rest.caseType],
 				myQuesAddress: rest.queRoad ? [rest.queProv, rest.queCity, rest.queArea, rest.queRoad] : undefined
 			})
+			setPartyList(parList)
 		}
 	}
 
@@ -187,7 +189,7 @@
 						</Steps>
 					</div>
 					<Preview style={{ display: isReview ? '' : 'none' }} data={formRef?.current?.getFields()} />
-					<VisitorRegister formRef={formRef} style={{ display: isReview ? 'none' : '' }} mainId={id} />
+					<VisitorRegister formRef={formRef} style={{ display: isReview ? 'none' : '' }} mainId={id} partyList={partyList} />
 					<div className="dataSync-excel">
 						<Space size="large" style={{ margin: '4px 14px' }}>
 							<Button type="primary" style={{ backgroundColor: '#1A6FB8' }} onClick={handleSave} >保存</Button>

--
Gitblit v1.8.0