diff --git a/src/modules/05_placement/components/probation/FormEvaluation/Template2Format2.vue b/src/modules/05_placement/components/probation/FormEvaluation/Template2Format2.vue index 5d3f4402a..b8943442f 100644 --- a/src/modules/05_placement/components/probation/FormEvaluation/Template2Format2.vue +++ b/src/modules/05_placement/components/probation/FormEvaluation/Template2Format2.vue @@ -6,6 +6,9 @@ import { useQuasar } from "quasar"; import { useRoute, useRouter } from "vue-router"; import { useCounterMixin } from "@/stores/mixin"; import { useProbationDataStore } from "@/modules/05_placement/storeProbation"; + +import genReport from "@/plugins/genreport"; + const probationStore = useProbationDataStore(); const { fecthdataAssign } = probationStore; @@ -59,35 +62,26 @@ const fecthAssign = async (id: string) => { hideLoader(); }); }; -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); -}; const FileDownload = async (type: string) => { let numTab = evaluate.value.find((e: any) => e.no === dataArrayNumber.value); showLoader(); await http - .get(config.API.reportEvaluateChairman(type, numTab.id), { - responseType: "blob", - }) + .get(config.API.reportEvaluateChairman(type, numTab.id)) .then(async (res) => { - downloadFile( - res, - `แบบประเมินผล(คณะกรรมการ)_${probationStore.person.name}_ครั้งที่${numTab.no}.${type}` + const data = res.data.result; + await genReport( + data, + `แบบประเมินผล(คณะกรรมการ)_${probationStore.person.name}_ครั้งที่${numTab.no}`, + type ); + hideLoader(); }) .catch(async (e) => { messageError($q, JSON.parse(await e.response.data.text())); - }) - .finally(() => { hideLoader(); - }); + }) + .finally(() => {}); }; const addData = () => { router.push( @@ -134,7 +128,13 @@ const changeTab = (tabVal: string) => {
- +