From 9fb821260af1d9d069b9ecca35b12ef3349370b0 Mon Sep 17 00:00:00 2001 From: ludc Date: 星期四, 27 七月 2023 20:11:50 +0800 Subject: [PATCH] 代码整合,前端代码打包 --- Source/UBCS-WEB/src/components/file/main.vue | 23 +++++++++++++++++++---- 1 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Source/UBCS-WEB/src/components/file/main.vue b/Source/UBCS-WEB/src/components/file/main.vue index 9866551..1aa1f8b 100644 --- a/Source/UBCS-WEB/src/components/file/main.vue +++ b/Source/UBCS-WEB/src/components/file/main.vue @@ -7,7 +7,6 @@ :before-open="beforeOpen" :permission="permissionList" v-model="form" - :height="options.height || 300" ref="crud" @row-del="rowDel" @search-change="searchChange" @@ -66,6 +65,7 @@ import {mapGetters} from "vuex"; import {dateFormat} from "@/util/date"; import {validatenull} from "@/util/validate"; +import func from "@/util/func"; export default { props: ["options","visible","ownbizOid"], @@ -88,7 +88,7 @@ hasDel:validatenull(this.options.hasDel) ? true :this.options.hasDel, hasDownload:validatenull(this.options.hasDownload) ? true :this.options.hasDownload, option: { - height:(this.options.tableHeight?this.options.tableHeight:'auto'), + height:(this.options.tableHeight?this.options.tableHeight:'200'), calcHeight: 30, tip: false, searchShow: false, @@ -381,16 +381,31 @@ let data=new FormData(); if(row && row.oid){ data.append('fileOids',row.oid) - download(data) + this.downloadFile(data); }else{ if (this.selectionList.length === 0) { this.$message.warning("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�"); return; } data.append('fileOids',this.oids) - download(data); + this.downloadFile(data); } }, + downloadFile(data){ + download(data).then(res=>{ + // console.log(res); + if(res){ + const fileNames = res.headers['content-disposition'].split(";"); + let characterSet = fileNames[2].split("filename*=")[1]; + let fileName = decodeURI(fileNames[1].split("filename=")[1],characterSet); // 涓嬭浇鐨勬枃浠跺悕 + let blob = new Blob([res.data], { + type: res.data.type + ";charset=utf-8", + }); + func.downloadFileByBlob(blob,fileName); + window.URL.revokeObjectURL(src); //閲婃斁鎺塨lob瀵硅薄 + } + }); + }, rowDel(row) { this.$confirm("纭畾灏嗛�夋嫨鏂囦欢鍒犻櫎?", { confirmButtonText: "纭畾", -- Gitblit v1.9.3