From 06c4496d3117bf14ea431f02558ad7d74dee774d Mon Sep 17 00:00:00 2001 From: licp <lichunping@guanfang.com.cn> Date: 星期四, 26 十二月 2024 14:33:09 +0800 Subject: [PATCH] 人员测试联调 --- src/components/tool/file-preview.vue | 28 +++++++++++++++++++++++----- 1 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/components/tool/file-preview.vue b/src/components/tool/file-preview.vue index 6b4d9a8..a0123c0 100644 --- a/src/components/tool/file-preview.vue +++ b/src/components/tool/file-preview.vue @@ -4,14 +4,14 @@ <img :src="fileUrl" alt="Image Preview" /> </div> <div v-if="isPdf"> - <object :data="fileUrl" type="application/pdf" width="100%" height="600px"> + <object :data="fileUrl" type="application/pdf" width="100%" height="750px"> <p>鎮ㄧ殑娴忚鍣ㄤ笉鏀寔 PDF 棰勮銆�<a :href="fileUrl">涓嬭浇 PDF 鏂囦欢</a></p> </object> </div> <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); @@ -129,6 +137,7 @@ renderedHandler() { console.log("娓叉煋瀹屾垚") this.isDocShow = true + this.resetStyle() }, errorHandler() { console.log("娓叉煋澶辫触") @@ -146,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, @@ -155,7 +165,6 @@ return obj }) this.csvList = arr - console.log(4444,this.csvList) }).catch( err => { console.log(err) }) @@ -197,6 +206,15 @@ } return result }, + resetStyle(){ + const elements = document.querySelectorAll('[style*="pt"]'); + for (const element of elements) { + const style = element.getAttribute('style'); + if (!!style) { + element.setAttribute('style', style.replace(/pt/g, 'px')); + } + } + }, } } </script> -- Gitblit v1.9.3