Merge branch 'develop' of github.com:Frappet/bma-ehr-frontend into develop

# Conflicts:
#	src/stores/mixin.ts
This commit is contained in:
Warunee Tamkoo 2024-08-13 11:24:14 +07:00
commit 25d9ad97aa
12 changed files with 233 additions and 75 deletions

View file

@ -1068,6 +1068,22 @@ export const useCounterMixin = defineStore("mixin", () => {
: "";
}
function downloadRenameFileByLink(link: string, fileName: string) {
fetch(link)
.then((response) => response.blob())
.then((blob) => {
const url = window.URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = fileName; // ชื่อไฟล์
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
document.body.removeChild(a);
})
.catch((error) => console.error("ดาวน์โหลดไฟล์ไม่สำเร็จ:", error));
}
return {
calAge,
date2Thai,
@ -1110,5 +1126,6 @@ export const useCounterMixin = defineStore("mixin", () => {
findPosMasterNo,
findPosMasterNoOld,
pathRegistryEmp,
downloadRenameFileByLink,
};
});