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",