From 4a11216b5f0bbcedba36535b6343d241e8d69986 Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Wed, 12 Feb 2025 10:54:00 +0700 Subject: [PATCH] updated report url --- src/modules/07_insignia/views/06_ReportMain.vue | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/modules/07_insignia/views/06_ReportMain.vue b/src/modules/07_insignia/views/06_ReportMain.vue index 09c6c7c75..2b351733c 100644 --- a/src/modules/07_insignia/views/06_ReportMain.vue +++ b/src/modules/07_insignia/views/06_ReportMain.vue @@ -154,7 +154,14 @@ async function onUpdateFilter() { .then(async (res) => { const data = await res.data.result; detailReport.value = data; - await fetchDocumentTemplate(data); + const type = + typeReport.value === "report4" || + typeReport.value === "report5" || + typeReport.value === "report6" || + typeReport.value === "report7" + ? "xlsx" + : "docx"; + await fetchDocumentTemplate(data, type); }) .catch(async (e) => { messageError($q, JSON.parse(await e.response.data.text())); @@ -169,9 +176,9 @@ async function onUpdateFilter() { * function เรียกไฟล์ PDF * @param data ข้อมูลบัญชีวันลา */ -async function fetchDocumentTemplate(data: any) { +async function fetchDocumentTemplate(data: any, type: string = "docx") { await axios - .post(`${config.API.reportTemplate}/docx`, data, { + .post(`${config.API.reportTemplate}/${type}`, data, { headers: { accept: "application/pdf", "content-Type": "application/json",