From c87d35e7dc84564ad7255cdf0e1263b68c1520f9 Mon Sep 17 00:00:00 2001
From: wangting <675591594@qq.com>
Date: 星期四, 27 七月 2023 18:22:53 +0800
Subject: [PATCH] 修改loadCodeFillSeparator的key

---
 Source/UBCS-WEB/src/components/Master/MasterTransfer.vue |   47 +++++++++++++++++++++++------------------------
 1 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/Master/MasterTransfer.vue b/Source/UBCS-WEB/src/components/Master/MasterTransfer.vue
index 5af0fcb..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,31 +134,29 @@
           })
           exportCode({codeClassifyOid:this.codeClassifyOid,'conditionMap[oid]':ids,...exportArr}).then(res=>{
             console.log('res',res)
-            const filename = '涓嬭浇.xlsx'; // 涓嬭浇鐨勬枃浠跺悕
-            const blob = new Blob([res.data], { type: 'application/vnd.ms-excel' });
-            const a = document.createElement('a');
-            const url = window.URL.createObjectURL(blob);
-            a.href = url;
-            a.download = filename;
-            a.style.display = 'none';
-            document.body.appendChild(a);
-            a.click();
-            document.body.removeChild(a);
-            window.URL.revokeObjectURL(url);
-
-            // const filename = '涓嬭浇.xlsx'; // 涓嬭浇鐨勬枃浠跺悕
-            // const blob = new Blob([response.data], { type: 'application/vnd.ms-excel' });
-            //
-            // const url = window.URL.createObjectURL(blob);
-            // const link = document.createElement('a');
-            // link.href = url;
-            // link.setAttribute('download', filename);
-            // document.body.appendChild(link);
-            // link.click();
-            // document.body.removeChild(link);
-            // URL.revokeObjectURL(url);
+            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瀵硅薄
+            // }
           })
-
         }
       };
     },

--
Gitblit v1.9.3