From 4641a877cd6a94e4d35dca7f7f14bc1443e2d2ad Mon Sep 17 00:00:00 2001 From: luobisheng <727299681@qq.com> Date: 星期二, 29 十一月 2022 17:59:55 +0800 Subject: [PATCH] 上传处置类型修改 --- src/utils/helper.js | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/utils/helper.js b/src/utils/helper.js index e29e5e6..d79cabf 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); } } @@ -122,8 +122,8 @@ } export const EVENT_SOURCE = [ - { label: '瑙嗛', value: 1 }, - { label: '鎵嬪姩绛夌骇', value: 2 } + { label: '瑙嗛鎶撴媿', value: 1 }, + { label: '鎵嬪姩鐧昏', value: 2 } ] export const CATEGOTY = [ -- Gitblit v1.8.0