From 9d72c1b5dc2ff3b016a5fea5b679b1d17280738c Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Tue, 14 Jan 2025 09:33:58 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=E0=B9=82?= =?UTF-8?q?=E0=B8=AB=E0=B8=A5=E0=B8=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../03_recruiting/views/01_compete/Period.vue | 24 +++++++++++---- .../views/02_qualify/DisablePeriod.vue | 29 +++++++++++++++++-- 2 files changed, 45 insertions(+), 8 deletions(-) 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(() => {}); } /**