Lvtianfang
杜函宇 2 years ago
parent dd6c6d7943
commit 64eda390c6

@ -224,19 +224,29 @@ export default {
// //
babm: this.form1.babm, babm: this.form1.babm,
}; };
dchzpsj(query1).then((res) => { dchzpsj(query1)
.then((res) => {
console.log(res);
const blob = new Blob([res], { type: res.type }); const blob = new Blob([res], { type: res.type });
// blob.text().then((res11) => console.log(res11));
console.log(blob.stream());
const link = document.createElement("a"); const link = document.createElement("a");
link.href = window.URL.createObjectURL(blob); link.href = window.URL.createObjectURL(blob);
link.style.display = 'none' link.style.display = "none";
// //
link.download = this.filterTypes(this.types)+ '.xlsx' ; link.download = this.filterTypes(this.types) + ".xlsx";
link.click(); link.click();
this.loadA.close(); this.loadA.close();
this.$message({ this.$message({
type: "success", type: "success",
message: "导出成功", message: "导出成功",
}); });
})
.catch((err) => {
this.$message({
type: "info",
message: "导出失败",
});
}); });
}, },
closeDC() { closeDC() {

@ -214,6 +214,11 @@ export default {
type: "success", type: "success",
message: "导出成功", message: "导出成功",
}); });
}) .catch((err) => {
this.$message({
type: "info",
message: "导出失败",
});
}); });
}, },
closeDC() { closeDC() {

@ -213,19 +213,6 @@ export default {
this.chinaCosmetics(1); this.chinaCosmetics(1);
}, },
methods: { methods: {
// convertFileStreamToBinary(fileStream) {
// return new Promise((resolve, reject) => {
// const reader = new FileReader();
// reader.onload = function (event) {
// const binaryData = event.target.result;
// resolve(binaryData);
// };
// reader.onerror = function (event) {
// reject(event.target.error);
// };
// reader.readAsArrayBuffer(fileStream);
// });
// },
openDC() { openDC() {
this.showCK = false; this.showCK = false;
this.loadA = Loading.service({ this.loadA = Loading.service({
@ -237,13 +224,18 @@ export default {
const blob = new Blob([res], { type: res.type }); const blob = new Blob([res], { type: res.type });
const link = document.createElement("a"); const link = document.createElement("a");
link.href = window.URL.createObjectURL(blob); link.href = window.URL.createObjectURL(blob);
link.style.display = 'none' link.style.display = "none";
link.download = "药品"+ '.xlsx'; link.download = "药品" + ".xlsx";
link.click(); link.click();
this.loadA.close(); this.loadA.close();
this.$message({ this.$message({
type: "success", type: "success",
message: "导出成功", message: "导出成功",
}).catch((err) => {
this.$message({
type: "info",
message: "导出失败",
});
}); });
}); });
}, },

Loading…
Cancel
Save