From 996e3e343760bcfa23b55138f85abd62d6ebfb22 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期三, 25 十二月 2024 09:02:07 +0800
Subject: [PATCH] 报告预览调试

---
 src/components/tool/file-preview.vue |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/components/tool/file-preview.vue b/src/components/tool/file-preview.vue
index d95afab..84c00c0 100644
--- a/src/components/tool/file-preview.vue
+++ b/src/components/tool/file-preview.vue
@@ -11,7 +11,7 @@
     <div v-if="isDoc">
       <p v-if="!isDocShow">鏂囨。鏃犳硶鐩存帴棰勮锛岃涓嬭浇鏌ョ湅銆�</p>
       <a :href="fileUrl" v-if="!isDocShow">涓嬭浇鏂囦欢</a>
-      <vue-office-docx
+      <vue-office-docx v-else
           :src="fileUrl"
           style="height: 100vh;"
           @rendered="renderedHandler"
@@ -21,7 +21,7 @@
     <div v-if="isXls">
       <p v-if="!isDocShow">鏂囨。鏃犳硶鐩存帴棰勮锛岃涓嬭浇鏌ョ湅銆�</p>
       <a :href="fileUrl" v-if="!isDocShow">涓嬭浇鏂囦欢</a>
-      <vue-office-excel
+      <vue-office-excel v-else
         :src="fileUrl"
         :options="options"
         style="height: 100vh;"
@@ -108,7 +108,15 @@
       return /\.(doc|docx)$/i.test(this.fileUrl);
     },
     isXls(){
-      return /\.(xls|xlsx)$/i.test(this.fileUrl);
+      let state = /\.(xls|xlsx)$/i.test(this.fileUrl)
+      if(state){
+        if(/\.(xlsx)$/i.test(this.fileUrl)){
+          this.options.xls = false
+        }else{
+          this.options.xls = true
+        }
+      }
+      return state;
     },
     isZipOrRar() {
       return /\.(zip|rar)$/i.test(this.fileUrl);
@@ -147,6 +155,7 @@
             column:[]
           }
           obj.tableData = this.formatCSVToTable(m.content.replaceAll('null',' '))
+          // .replaceAll('MIN','=MIN').replaceAll('MAX','=MAX').replaceAll('AVERAGE','=AVERAGE')
           for (let item in obj.tableData[0]) {
             obj.column.push({
               label: item,
@@ -205,7 +214,7 @@
           element.setAttribute('style', style.replace(/pt/g, 'px'));
         }
       }
-    }
+    },
   }
 }
 </script>

--
Gitblit v1.9.3