html省略
download() {
let params = {
allFlag: true,
currPage: 1,
groupId: "",
ids: "",
month: "2022-06",
pageSize: 10,
posttype: "blob",
ruleId: "",
}
this.$api.exportTableexportApi(params).then((res) => {
console.log(res);
this.downloadFile(res, res.type, '排班总览数据.xlsx');
});
},
downloadFile(data, type, fileName) {
const blob = new Blob([data], { type: `application/${type};charset=utf-8` });
const downloadElement = document.createElement('a');
const href = window.URL.createObjectURL(blob);
downloadElement.href = href;
downloadElement.download = fileName;
document.body.appendChild(downloadElement);
downloadElement.click();
document.body.removeChild(downloadElement);
window.URL.revokeObjectURL(href);
},