From 1d11e683a5d9d4798598670c8a88330e642419c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BE=99=E8=BF=90=E6=A8=A1?= <1724894114@qq.com> Date: Sat, 13 Jul 2024 18:05:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=BC=E5=87=BA=E7=BB=84?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/scExport/index.vue | 20 ++++++-------------- src/views/setting/company/index.vue | 2 +- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/components/scExport/index.vue b/src/components/scExport/index.vue index c41751c..2145d2f 100644 --- a/src/components/scExport/index.vue +++ b/src/components/scExport/index.vue @@ -56,20 +56,12 @@ export default { } }, down(item){ - const blob = new Blob([item.file_url]); - let fileName = item.type_desc+".xlsx"; - if ('download' in document.createElement('a')) { // 非IE下载 - let eLink = document.createElement('a'); - eLink.download = fileName - eLink.style.display = 'none'; - eLink.href = URL.createObjectURL(blob); - document.body.appendChild(eLink); - eLink.click(); - URL.revokeObjectURL(eLink.href); // 释放URL 对象 - document.body.removeChild(eLink); - } else { // IE10+下载 - navigator.msSaveBlob(blob, fileName); - } + const link = document.createElement('a'); + link.href = item.file_url; + link.setAttribute('download', ''); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); }, exportClick(){ if(this.exportVisible){ diff --git a/src/views/setting/company/index.vue b/src/views/setting/company/index.vue index a2d9976..f2a57e0 100644 --- a/src/views/setting/company/index.vue +++ b/src/views/setting/company/index.vue @@ -218,7 +218,7 @@ export default { }, 500); }, async exportData() { - const res = await this.$API.system.company.export.post(); + const res = await this.$API.system.company.export.post(this.params); if(res.code == 200){ this.$message.success('开始导出'); }