From 750eb03795c425925fe3065948db5630ca70e381 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Mon, 13 Jan 2025 14:56:02 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89download=20=E0=B9=84?= =?UTF-8?q?=E0=B8=9F=E0=B8=A5=E0=B9=8C=20=E0=B8=88=E0=B8=B1=E0=B8=94?= =?UTF-8?q?=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=A3=E0=B8=B2=E0=B8=8A=E0=B8=B7?= =?UTF-8?q?=E0=B9=88=E0=B8=AD=E0=B8=84=E0=B8=B1=E0=B8=94=E0=B9=80=E0=B8=A5?= =?UTF-8?q?=E0=B8=B7=E0=B8=AD=E0=B8=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/TableCandidate.vue | 43 ++++++++----------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/src/modules/03_recruiting/components/TableCandidate.vue b/src/modules/03_recruiting/components/TableCandidate.vue index b40de116d..aab9cc439 100644 --- a/src/modules/03_recruiting/components/TableCandidate.vue +++ b/src/modules/03_recruiting/components/TableCandidate.vue @@ -2,6 +2,8 @@ import { ref, useAttrs, watch } from "vue"; import { checkPermission } from "@/utils/permissions"; import { useRoute, useRouter } from "vue-router"; +import genReport from "@/plugins/genreport"; +import genReportXLSX from "@/plugins/genreportxlsx"; import { useCounterMixin } from "@/stores/mixin"; import http from "@/plugins/http"; @@ -15,6 +17,7 @@ const $q = useQuasar(); const mixin = useCounterMixin(); const { dateToISO, success, modalError, dialogMessage } = mixin; +const detailReport = ref(); const attrs = ref(useAttrs()); const table = ref(null); const files = ref([]); @@ -250,12 +253,10 @@ async function uploadDataPoint() { async function downloadFile() { showLoader(); await http - .get(config.API.periodExamDownload(examId.value), { - responseType: "blob", - }) + .get(config.API.periodExamDownload(examId.value)) .then((res) => { - const data = res.data; - downloadFilePDF(data, `Candidate__${dateToISO(new Date())}.xlsx`); + const data = res.data.result; + genReportXLSX(data, data.reportName); }) .catch(async (e) => { messageError($q, JSON.parse(await e.response.data.text())); @@ -268,12 +269,10 @@ async function downloadFile() { async function downloadFileDetail() { showLoader(); await http - .get(config.API.periodExamDownloadDetail(examId.value), { - responseType: "blob", - }) + .get(config.API.periodExamDownloadDetail(examId.value)) .then((res) => { - const data = res.data; - downloadFilePDF(data, `Candidate_Detail_${dateToISO(new Date())}.xlsx`); + const data = res.data.result; + genReportXLSX(data, data.reportName); }) .catch(async (e) => { messageError($q, JSON.parse(await e.response.data.text())); @@ -344,23 +343,15 @@ function resetFilter() { async function downloadFileDashboard() { showLoader(); await http - .put( - config.API.periodExamDownloadDashboard(examId.value), - { - dateStart: dateToISO(dateFilter.value[0]), - dateEnd: dateToISO(dateFilter.value[1]), - responseType: "blob", - }, - { - responseType: "blob", - } - ) + .put(config.API.periodExamDownloadDashboard(examId.value), { + dateStart: dateToISO(dateFilter.value[0]), + dateEnd: dateToISO(dateFilter.value[1]), + responseType: "blob", + }) .then((res) => { - const data = res.data; - downloadFilePDF( - data, - `Candidate_Dashboard_${dateToISO(new Date())}.xlsx` - ); + const data = res.data.result; + data.reportName = `Candidate_Dashboard_${dateToISO(new Date())}`; + genReportXLSX(data, data.reportName); }) .catch(async (e) => { messageError($q, JSON.parse(await e.response.data.text()));