From 13e9ddabf4ba3a89aa2a93fe8d3b35c8604c6813 Mon Sep 17 00:00:00 2001
From: luobisheng <727299681@qq.com>
Date: 星期三, 16 十一月 2022 17:51:29 +0800
Subject: [PATCH] 获取文件名字修改

---
 src/utils/helper.js |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/utils/helper.js b/src/utils/helper.js
index e29e5e6..77baab7 100644
--- a/src/utils/helper.js
+++ b/src/utils/helper.js
@@ -49,15 +49,15 @@
 // data: 鏂囦欢, contentDisposition锛氳姹傚ご涓枃浠剁殑鍚嶅瓧
 // 榛樿涓嶇敤淇敼锛岀洿鎺ュ皢杩斿洖鐨剅es浼犲叆鍗冲彲
 export function downloadFile(res) {
-    const blob = new Blob([res.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
-    const fileName = res.contentDisposition.split('=')[1];
+    const blob = new Blob([res.data], { type: '.xlsx' });
+    const fileName = res.contentDisposition.split(`''`)[1];
     if (window.navigator && window.navigator.msSaveBlob) {
-        navigator.msSaveBlob(blob, `${new Date().getTime()}`);
+        navigator.msSaveBlob(blob, fileName);
     } else {
         const link = document.createElement('a');
         link.style.display = 'none';
         link.href = URL.createObjectURL(blob);
-        link.setAttribute('download', decodeURI(`${new Date().getTime()}`));
+        link.setAttribute('download', decodeURI(fileName));
         document.body.appendChild(link);
         link.click();
         URL.revokeObjectURL(link.href);

--
Gitblit v1.8.0