From 3e20408521d46b1086a5e77b914d04afb9630ab0 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期五, 28 七月 2023 10:37:02 +0800
Subject: [PATCH] 主题库开启编辑分类注入bug

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

diff --git a/Source/UBCS-WEB/src/components/Master/MasterTransfer.vue b/Source/UBCS-WEB/src/components/Master/MasterTransfer.vue
index 5af0fcb..7e667be 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,29 +134,28 @@
           })
           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);
+            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瀵硅薄
+            }
 
-            // 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);
+            // 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