แก้download ไฟล์ จัดการราชื่อคัดเลือก

This commit is contained in:
setthawutttty 2025-01-13 14:56:02 +07:00
parent 4d81344c16
commit 750eb03795

View file

@ -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<any>();
const attrs = ref<any>(useAttrs());
const table = ref<any>(null);
const files = ref<File[]>([]);
@ -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()));