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/previewTable.jsx |  153 +++++++++++++++++++++++++++++++-------------------
 1 files changed, 95 insertions(+), 58 deletions(-)

diff --git a/gz-customerSystem/src/views/register/visit/component/previewTable.jsx b/gz-customerSystem/src/views/register/visit/component/previewTable.jsx
index e9fcefc..36a8e61 100644
--- a/gz-customerSystem/src/views/register/visit/component/previewTable.jsx
+++ b/gz-customerSystem/src/views/register/visit/component/previewTable.jsx
@@ -6,6 +6,7 @@
 
 
 const ApplyDialog = ({ applyDialog }) => {
+  console.log(applyDialog, 'applyDialog');
   return (
     <>
       {
@@ -49,14 +50,19 @@
               <th bgcolor="#F7F8FA" className="table-title">身份证明材料</th>
               <td>
                 {
-                  item.fileInfoList?.map(res => {
-                    if (res.ownerType == "22_00018-202") {
-                      return res.fileList.map((result, resIndex) => {
-                        return <div style={{display: 'inline-block'}}>
-                          <PreviewImage name={result.name} src={result.showUrl} />
-                          {resIndex !== res.fileList.length - 1 && <>,</>}
-                        </div>
-                      })
+                  item.file?.map((result, resIndex) => {
+                    if (result.response) {
+                      //新上传的,前端数据
+                      const newData = result.response.data[0]
+                      return <div style={{ display: 'inline-block' }}>
+                        <PreviewImage name={newData.name} src={newData.showUrl} />
+                        {resIndex !== item.file?.length - 1 && <>,</>}
+                      </div>
+                    } else {
+                      return <div style={{ display: 'inline-block' }}>
+                        <PreviewImage name={result.name} src={result.showUrl} />
+                        {resIndex !== item.file?.length - 1 && <>,</>}
+                      </div>
                     }
                   })
                 }
@@ -74,6 +80,7 @@
 }
 
 const AgentDialog = ({ agentDialog }) => {
+  console.log(agentDialog, 'agentDialog');
   return (
     <>
       {agentDialog?.map((item, index) => (
@@ -119,14 +126,19 @@
             <th bgcolor="#F7F8FA" className="table-title">身份证明材料</th>
             <td>
               {
-                item.fileInfoList?.map(res => {
-                  if (res.ownerType == "22_00018-202") {
-                    return res.fileList?.map((result, resIndex) => {
-                      return <a href="your-link-here.html" target="_blank">
-                        <img src={link} alt="" className="title-file" />{result.trueName}
-                        {resIndex !== res.fileList.length - 1 && <>,</>}
-                      </a>
-                    })
+                item.file?.map((result, resIndex) => {
+                  if (result.response) {
+                    //新上传的,前端数据
+                    const newData = result.response.data[0]
+                    return <div style={{ display: 'inline-block' }}>
+                      <PreviewImage name={newData.name} src={newData.showUrl} />
+                      {resIndex !== item.file?.length - 1 && <>,</>}
+                    </div>
+                  } else {
+                    return <div style={{ display: 'inline-block' }}>
+                      <PreviewImage name={result.name} src={result.showUrl} />
+                      {resIndex !== item.file?.length - 1 && <>,</>}
+                    </div>
                   }
                 })
               }
@@ -134,28 +146,32 @@
             <th bgcolor="#F7F8FA" className="table-title">代理人授权委托书</th>
             <td>
               {
-                item.fileInfoList?.map(res => {
-                  if (res.ownerType == '22_00018-207') {
-                    return res.fileList.map((result, resIndex) => {
-                      return <a href="your-link-here.html" target="_blank">
-                        <img src={link} alt="" className="title-file" />{result.trueName}
-                        {resIndex !== res.fileList.length - 1 && <>,</>}
-                      </a>
-                    })
+                item.file1?.map((result, resIndex) => {
+                  if (result.response) {
+                    //新上传的,前端数据
+                    const newData = result.response.data[0]
+                    return <div style={{ display: 'inline-block' }}>
+                      <PreviewImage name={newData.name} src={newData.showUrl} />
+                      {resIndex !== item.file?.length - 1 && <>,</>}
+                    </div>
+                  } else {
+                    return <div style={{ display: 'inline-block' }}>
+                      <PreviewImage name={result.name} src={result.showUrl} />
+                      {resIndex !== item.file?.length - 1 && <>,</>}
+                    </div>
                   }
                 })
               }
             </td>
           </tr>
-
         </table>
-
       ))}
     </>
   )
 }
 
 const Respondent = ({ respondent }) => {
+  console.log(respondent, 'respondent');
   return (
     <>
       {respondent?.map((item, index) => (
@@ -182,14 +198,19 @@
             <th bgcolor="#F7F8FA" className="table-title">企业登记材料</th>
             <td>
               {
-                item.fileInfoList?.map(res => {
-                  if (res.ownerType == '22_00018-203') {
-                    return res.fileList.map((result, resIndex) => {
-                      return <a href="your-link-here.html" target="_blank">
-                        <img src={link} alt="" className="title-file" />{result.trueName}
-                        {resIndex !== res.fileList.length - 1 && <>,</>}
-                      </a>
-                    })
+                item.file?.map((result, resIndex) => {
+                  if (result.response) {
+                    //新上传的,前端数据
+                    const newData = result.response.data[0]
+                    return <div style={{ display: 'inline-block' }}>
+                      <PreviewImage name={newData.name} src={newData.showUrl} />
+                      {resIndex !== item.file?.length - 1 && <>,</>}
+                    </div>
+                  } else {
+                    return <div style={{ display: 'inline-block' }}>
+                      <PreviewImage name={result.name} src={result.showUrl} />
+                      {resIndex !== item.file?.length - 1 && <>,</>}
+                    </div>
                   }
                 })
               }
@@ -197,14 +218,19 @@
             <th bgcolor="#F7F8FA" className="table-title" >法定代表人身份证明材料</th>
             <td>
               {
-                item.fileInfoList?.map(res => {
-                  if (res.ownerType == '22_00018-204') {
-                    return res.fileList.map((result, resIndex) => {
-                      return <a href="your-link-here.html" target="_blank">
-                        <img src={link} alt="" className="title-file" />{result.trueName}
-                        {resIndex !== res.fileList.length - 1 && <>,</>}
-                      </a>
-                    })
+                item.file1?.map((result, resIndex) => {
+                  if (result.response) {
+                    //新上传的,前端数据
+                    const newData = result.response.data[0]
+                    return <div style={{ display: 'inline-block' }}>
+                      <PreviewImage name={newData.name} src={newData.showUrl} />
+                      {resIndex !== item.file?.length - 1 && <>,</>}
+                    </div>
+                  } else {
+                    return <div style={{ display: 'inline-block' }}>
+                      <PreviewImage name={result.name} src={result.showUrl} />
+                      {resIndex !== item.file?.length - 1 && <>,</>}
+                    </div>
                   }
                 })
               }
@@ -220,6 +246,7 @@
 }
 
 const Company = ({ company }) => {
+  console.log(company, 'company');
   return (
     <>
       {company?.map((item, index) => (
@@ -246,14 +273,19 @@
             <th bgcolor="#F7F8FA" className="table-title">机构登记材料</th>
             <td>
               {
-                item.fileInfoList?.map(res => {
-                  if (res.ownerType == '22_00018-203') {
-                    return res.fileList.map((result, resIndex) => {
-                      return <a href="your-link-here.html" target="_blank">
-                        <img src={link} alt="" className="title-file" />{result.trueName}
-                        {resIndex !== res.fileList.length - 1 && <>,</>}
-                      </a>
-                    })
+                item.file?.map((result, resIndex) => {
+                  if (result.response) {
+                    //新上传的,前端数据
+                    const newData = result.response.data[0]
+                    return <div style={{ display: 'inline-block' }}>
+                      <PreviewImage name={newData.name} src={newData.showUrl} />
+                      {resIndex !== item.file?.length - 1 && <>,</>}
+                    </div>
+                  } else {
+                    return <div style={{ display: 'inline-block' }}>
+                      <PreviewImage name={result.name} src={result.showUrl} />
+                      {resIndex !== item.file?.length - 1 && <>,</>}
+                    </div>
                   }
                 })
               }
@@ -261,14 +293,19 @@
             <th bgcolor="#F7F8FA" className="table-title" >机构代表人身份证明材料</th>
             <td>
               {
-                item.fileInfoList?.map(res => {
-                  if (res.ownerType == '22_00018-204') {
-                    return res.fileList.map((result, resIndex) => {
-                      return <a href="your-link-here.html" target="_blank">
-                        <img src={link} alt="" className="title-file" />{result.trueName}
-                        {resIndex !== res.fileList.length - 1 && <>,</>}
-                      </a>
-                    })
+                item.file1?.map((result, resIndex) => {
+                  if (result.response) {
+                    //新上传的,前端数据
+                    const newData = result.response.data[0]
+                    return <div style={{ display: 'inline-block' }}>
+                      <PreviewImage name={newData.name} src={newData.showUrl} />
+                      {resIndex !== item.file?.length - 1 && <>,</>}
+                    </div>
+                  } else {
+                    return <div style={{ display: 'inline-block' }}>
+                      <PreviewImage name={result.name} src={result.showUrl} />
+                      {resIndex !== item.file?.length - 1 && <>,</>}
+                    </div>
                   }
                 })
               }

--
Gitblit v1.8.0