From 1c0bb2817007566179ada20ae740018ba6a9615a Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期四, 17 十一月 2022 17:40:16 +0800
Subject: [PATCH] Merge branch 'master' of http://42.193.1.25:9521/r/sccg_ui

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

diff --git a/src/utils/helper.js b/src/utils/helper.js
index e29e5e6..621af9a 100644
--- a/src/utils/helper.js
+++ b/src/utils/helper.js
@@ -2,7 +2,7 @@
 // 娣辨嫹璐�
 export function deepClone(obj) {
     let objClone = Array.isArray(obj) ? [] : {};
-    if (obj && typeof obj === 'object' && obj != null) {
+    if (obj && typeof obj === 'object') {
         for (let key in obj) {
             if (obj.hasOwnProperty(key)) {
                 if (obj[key] && typeof obj[key] === 'object') {
@@ -49,18 +49,18 @@
 // 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: 'application/octet-stream' });
+    const fileName = res.contentDisposition.split(`''`)[1];
     if (window.navigator && window.navigator.msSaveBlob) {
-        navigator.msSaveBlob(blob, `${new Date().getTime()}`);
+        window.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.href = window.URL.createObjectURL(blob);
+        link.download = decodeURI(fileName);
         document.body.appendChild(link);
         link.click();
-        URL.revokeObjectURL(link.href);
+        window.URL.revokeObjectURL(link.href);
         document.body.removeChild(link);
     }
 }

--
Gitblit v1.8.0