Merge branch 'develop' into dev
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m30s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m30s
This commit is contained in:
commit
b845cdaeab
1 changed files with 7 additions and 13 deletions
|
|
@ -2,6 +2,7 @@ import axios from "axios";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
import { downloadBlobFile } from "@/modules/10_registry/utils/downloadFile";
|
||||||
|
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const { showLoader, hideLoader } = mixin;
|
const { showLoader, hideLoader } = mixin;
|
||||||
|
|
@ -19,7 +20,7 @@ async function genReport(data: any, fileName: string, type: string = "docx") {
|
||||||
},
|
},
|
||||||
responseType: "arraybuffer",
|
responseType: "arraybuffer",
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then(async (res) => {
|
||||||
const responseData = res.data;
|
const responseData = res.data;
|
||||||
if (responseData) {
|
if (responseData) {
|
||||||
const mimeType =
|
const mimeType =
|
||||||
|
|
@ -31,18 +32,11 @@ async function genReport(data: any, fileName: string, type: string = "docx") {
|
||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
|
|
||||||
const baseName = fileName.trim();
|
const baseName = fileName.trim();
|
||||||
const extension = type === "docx" ? "docx" : "pdf";
|
// const extension = type === "docx" ? "docx" : "pdf";
|
||||||
|
await downloadBlobFile({
|
||||||
const link = document.createElement("a");
|
downloadUrl: url,
|
||||||
link.href = url;
|
fileName: baseName,
|
||||||
link.download = `${baseName}.${extension}`;
|
});
|
||||||
document.body.appendChild(link);
|
|
||||||
link.click();
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
document.body.removeChild(link);
|
|
||||||
URL.revokeObjectURL(url);
|
|
||||||
}, 100);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue