Karsa 6 months ago
parent
commit
75f3c60f77
1 changed files with 21 additions and 4 deletions
  1. 21 4
      src/views/externalReport/Preview.vue

+ 21 - 4
src/views/externalReport/Preview.vue

@@ -18,13 +18,30 @@ const fileLen = computed(() => {
     return reportInfo.value?.AttachmentList.length
 })
 
+const totalSize = computed(() => {
+    let size = 0;
+    if(attachmentsList.value.length) {
+        attachmentsList.value.forEach(item => {
+            size +=item.FileSize
+        })
+    }
+    return size
+})
+
 // 获取报告详情
-let reportInfo=ref(null)
+const reportInfo=ref(null)
+const attachmentsList = ref([])
 async function getReportDetail(){
     const res=await reportExternalInterface.getDocDetail({ OutsideReportId: Number(route.query.id) })
     if(res.Ret===200){
         reportInfo.value=res.Data
         document.title=res.Data.Title
+        attachmentsList.value = res.Data.AttachmentList 
+            ? res.Data.AttachmentList.map(item => ({
+                ...item,
+                FileSize: parseInt((item.FileSize||0)/1024)
+            }))
+            : []
     }
 }
 getReportDetail()
@@ -96,15 +113,15 @@ function getFileIcon(name) {
             <div class="attachments-wrapper">
                 <div>
                     <svg-icon name="link_ico" size="20px"></svg-icon>
-                    附件{{fileLen}}个(10MB)
+                    附件{{fileLen}}个({{totalSize}}KB)
                 </div>
 
                 <ul class="list-cont">
-                    <li class="item" v-for="(item,index) in reportInfo.AttachmentList" :key="index" @click="handlePreviewAttachment(item)">
+                    <li class="item" v-for="(item,index) in attachmentsList" :key="index" @click="handlePreviewAttachment(item)">
                         <svg-icon class="file-ico" :name="getFileIcon(item.Title)"></svg-icon>
                         <div class="right-info">
                             <p class="van-ellipsis file-name">{{item.Title}}</p>
-                            <span style="color:#999">5.0MB</span>
+                            <span style="color:#999">{{item.FileSize}}KB</span>
                         </div>
                     </li>
                 </ul>