export function goodsInspectionReportDwnloadZip (params) {
return axios({
url: "/warehouse-entry-server/v1/goodsInspectionReport/downloadZip",
method: "get",
params,
responseType: "blob"
})
}
handleDownloadFile() {
if (!this.$refs.dragTable.selection.length) {
this.$message.warning("请选择数据!");
} if (this.$refs.dragTable.selection.length > 1) {
this.$message.warning("请选择一条数据!");
} else {
let talbeData = this.$refs.dragTable.selection
goodsInspectionReportDwnloadZip({ id:talbeData[0].id }).then((res) => {
const { code, msg } = res.data;
const title = code === 200 ? "操作成功" : "操作失败";
const type = code === 200 ? "success" : "error";
let blob = new Blob([res.data], { type: "application/zip" });
const url = window.URL.createObjectURL(blob);
const link = window.document.createElement("a");
link.href = url;
link.download = "资质编号"+talbeData[0].typeCode+"报告压缩包.zip";
link.style.display = "none";
link.click();
URL.revokeObjectURL(url);
this.$refs.dragTable.clearSelection();
});
}
},
handledownload(api) {
api({
...this.page,
param: this.search
}).then((res) => {
const src = URL.createObjectURL(new Blob([res.data]));
const link = document.createElement("a");
link.href = src;
let filename = decodeURIComponent(
res.headers["content-disposition"].split("filename=")[1]
);
link.setAttribute("download", filename);
document.body.appendChild(link);
link.style.display = "none";
link.click();
});
},