From 6735d42d12e784817656d20868c2e42b5d2c201f Mon Sep 17 00:00:00 2001 From: ludc Date: 星期四, 27 七月 2023 18:01:50 +0800 Subject: [PATCH] 提交代码 --- Source/UBCS-WEB/src/components/Master/MasterTransfer.vue | 34 +++++++++++++++++++++------------- Source/UBCS-WEB/vue.config.js | 4 ++-- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/Source/UBCS-WEB/src/components/Master/MasterTransfer.vue b/Source/UBCS-WEB/src/components/Master/MasterTransfer.vue index fe85e28..dab8951 100644 --- a/Source/UBCS-WEB/src/components/Master/MasterTransfer.vue +++ b/Source/UBCS-WEB/src/components/Master/MasterTransfer.vue @@ -27,6 +27,7 @@ <script> import {exportCode} from '@/api/GetItem' +import func from "@/util/func"; export default { name: "MasterTransfer", props:['visible','tableHeadData','codeClassifyOid','tableData','selectRow'], @@ -133,21 +134,28 @@ }) exportCode({codeClassifyOid:this.codeClassifyOid,'conditionMap[oid]':ids,...exportArr}).then(res=>{ console.log('res',res) - const filename = '涓嬭浇.xlsx'; // 涓嬭浇鐨勬枃浠跺悕 - let blob = new Blob([res.data], { - type: res.data.type + ";charset=utf-8", - }); - let src = window.URL.createObjectURL(blob); - if (src) { - let link = document.createElement("a"); - link.style.display = "none"; - link.href = src; - link.setAttribute("download", "鏂囦欢鍚嶅瓧.xls"); - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); //涓嬭浇瀹屾垚绉婚櫎鍏冪礌 + 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瀵硅薄 } + + // let src = window.URL.createObjectURL(blob); + // if (src) { + // let link = document.createElement("a"); + // link.style.display = "none"; + // link.href = src; + // link.setAttribute("download", "鏂囦欢鍚嶅瓧.xls"); + // document.body.appendChild(link); + // link.click(); + // document.body.removeChild(link); //涓嬭浇瀹屾垚绉婚櫎鍏冪礌 + // window.URL.revokeObjectURL(src); //閲婃斁鎺塨lob瀵硅薄 + // } }) } }; diff --git a/Source/UBCS-WEB/vue.config.js b/Source/UBCS-WEB/vue.config.js index 433ecc0..54a1f5d 100644 --- a/Source/UBCS-WEB/vue.config.js +++ b/Source/UBCS-WEB/vue.config.js @@ -26,9 +26,9 @@ proxy: { '/api': { //鏈湴鏈嶅姟鎺ュ彛鍦板潃 - // target: 'http://localhost:37000', + target: 'http://localhost:37000', // target: 'http://192.168.1.51:37000', - target: 'http://dev.vci-tech.com:37000', + // target: 'http://dev.vci-tech.com:37000', // target: 'http://192.168.1.104:37000', // target: 'http://192.168.1.63:37000', // target: 'http://192.168.3.7:37000', -- Gitblit v1.9.3