修改导出组件

This commit is contained in:
龙运模 2024-07-13 18:05:17 +08:00
parent 3b6d58581b
commit 1d11e683a5
2 changed files with 7 additions and 15 deletions

View File

@ -56,20 +56,12 @@ export default {
} }
}, },
down(item){ down(item){
const blob = new Blob([item.file_url]); const link = document.createElement('a');
let fileName = item.type_desc+".xlsx"; link.href = item.file_url;
if ('download' in document.createElement('a')) { // IE link.setAttribute('download', '');
let eLink = document.createElement('a'); document.body.appendChild(link);
eLink.download = fileName link.click();
eLink.style.display = 'none'; document.body.removeChild(link);
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);
}
}, },
exportClick(){ exportClick(){
if(this.exportVisible){ if(this.exportVisible){

View File

@ -218,7 +218,7 @@ export default {
}, 500); }, 500);
}, },
async exportData() { 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){ if(res.code == 200){
this.$message.success('开始导出'); this.$message.success('开始导出');
} }