Commit 0e265a18 by sunxiwang

二维码批量下载

1 parent 5bbeadf1
...@@ -139,8 +139,9 @@ export function downloadBatch(ids) { ...@@ -139,8 +139,9 @@ export function downloadBatch(ids) {
params: { params: {
ids, ids,
}, },
responseType: 'blob'
}) })
return process.env.VUE_APP_BASE_API + service + '/downloadBatch/?ids=' + ids //return process.env.VUE_APP_BASE_API + service + '/downloadBatch/?ids=' + ids
} }
/** /**
......
...@@ -140,10 +140,19 @@ export default { ...@@ -140,10 +140,19 @@ export default {
type: 'warning', type: 'warning',
}) })
.then(() => { .then(() => {
downloadBatch(this.ids + '') return downloadBatch(this.ids + '')
// window.open(downloadBatch(this.ids)) // window.open(downloadBatch(this.ids))
}) }).then((res) =>{
.catch(function() {}) if (res!=null) {
let blob = new Blob([res], {type: 'application/zip'});
let url = window.URL.createObjectURL(blob);
const link = document.createElement('a'); // 创建a标签
link.href = url;
link.download = '批量员工活码.zip'; // 重命名文件
link.click();
URL.revokeObjectURL(url); // 释放内存
}
}).catch(function() {})
}, },
}, },
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!