diff --git a/src/modules/03_recruiting/views/01_compete/Period.vue b/src/modules/03_recruiting/views/01_compete/Period.vue index c031056e8..0705c1ba4 100644 --- a/src/modules/03_recruiting/views/01_compete/Period.vue +++ b/src/modules/03_recruiting/views/01_compete/Period.vue @@ -196,7 +196,19 @@ async function fetchData() { * @param id รอบสอบเเข่งขัน */ function clickPassExam(id: string) { - window.open(config.API.exportPassExamList(id)); + showLoader(); + http + .get(config.API.exportPassExamList(id)) + .then((res) => { + const data = res.data.result; + data.reportName = `CandidateList`; + genReport(data, data.reportName, "pdf"); + }) + .catch(async (e) => { + messageError($q, JSON.parse(await e.response.data.text())); + hideLoader(); + }) + .finally(() => {}); } /** @@ -204,19 +216,19 @@ function clickPassExam(id: string) { * @param id รอบสอบเเข่งขัน */ function clickCandidateList(id: string) { + showLoader(); http .get(config.API.exportCandidateList(id)) .then((res) => { const data = res.data.result; - data.reportName = `CandidateList` - genReport(data, data.reportName,'pdf'); + data.reportName = `CandidateList`; + genReport(data, data.reportName, "pdf"); }) .catch(async (e) => { messageError($q, JSON.parse(await e.response.data.text())); - }) - .finally(() => { hideLoader(); - }); + }) + .finally(() => {}); } /** diff --git a/src/modules/03_recruiting/views/02_qualify/DisablePeriod.vue b/src/modules/03_recruiting/views/02_qualify/DisablePeriod.vue index 1b5a7f7bd..50f8a367a 100644 --- a/src/modules/03_recruiting/views/02_qualify/DisablePeriod.vue +++ b/src/modules/03_recruiting/views/02_qualify/DisablePeriod.vue @@ -4,6 +4,7 @@ import type { QTableProps } from "quasar"; import { onMounted, ref } from "vue"; import { useRouter } from "vue-router"; import { useQuasar } from "quasar"; +import genReport from "@/plugins/genreport"; import http from "@/plugins/http"; import config from "@/app.config"; @@ -150,12 +151,36 @@ const visibleColumnsHistory = ref([ /** ดาวน์โหลดรายชื่อผู้สอบคัดเลือกคนพิการได้ */ function clickPassExam(id: string) { - window.open(config.API.exportDisablePassExamList(id)); + showLoader(); + http + .get(config.API.exportDisablePassExamList(id)) + .then((res) => { + const data = res.data.result; + data.reportName = `CandidateList`; + genReport(data, data.reportName, "pdf"); + }) + .catch(async (e) => { + hideLoader(); + messageError($q, e); + }) + .finally(() => {}); } /** ดาวน์โหลดรายชื่อผู้มีสิทธิ์สอบ */ function clickCandidateList(id: string) { - window.open(config.API.exportDisableCandidateList(id)); + showLoader(); + http + .get(config.API.exportDisableCandidateList(id)) + .then((res) => { + const data = res.data.result; + data.reportName = `CandidateList`; + genReport(data, data.reportName, "pdf"); + }) + .catch(async (e) => { + hideLoader(); + messageError($q, e); + }) + .finally(() => {}); } /**