ปรับ รายการบันทึกเวียนแจ้งการถึงแก่กรรม

This commit is contained in:
STW_TTTY\stwtt 2024-08-16 15:40:06 +07:00
parent 911bed1148
commit 7e26314cb6
4 changed files with 11 additions and 88 deletions

View file

@ -14,12 +14,14 @@ import CardProfile from "@/components/CardProfile.vue";
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
import { checkPermission } from "@/utils/permissions";
import genReport from "@/plugins/genreport";
/**use*/
const $q = useQuasar();
const router = useRouter();
const route = useRoute();
const checkRoutePermisson = ref<boolean>(route.name == "deceased-detailOnly");
const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError, date2Thai } = mixin;
const fullName = ref<string>("");
@ -64,17 +66,6 @@ const nextPage = (page: string) => {
window.open(page, "_blank");
};
//downloadFile
const downloadFile = (response: any, filename: string) => {
const link = document.createElement("a");
var fileName = filename;
link.href = window.URL.createObjectURL(new Blob([response.data]));
link.setAttribute("download", fileName);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
};
/**
* งก ดาวโหลด
* @param type typeของรายละเอยด
@ -82,13 +73,13 @@ const downloadFile = (response: any, filename: string) => {
const fileDownload = async (type: string) => {
showLoader();
await http
.get(config.API.DeceasedReport(type, profileId.value), {
responseType: "blob",
})
.get(config.API.DeceasedReport(type, profileId.value))
.then((res) => {
downloadFile(
res,
`รายละเอียดบันทึกเวียนแจ้งการถึงแก่กรรม-${fullName.value}.${type}`
const data = res.data.result;
genReport(
data,
`รายละเอียดบันทึกเวียนแจ้งการถึงแก่กรรม-${fullName.value}`,
type
);
})
.catch(async (e) => {
@ -191,7 +182,7 @@ const fileDownload = async (type: string) => {
</div>
</div>
<div class="col-12" v-if="!checkRoutePermisson">
<div class="col-12" v-if="checkPermission($route)?.attrIsUpdate">
<div class="row">
<q-space />
<q-btn