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()));