From 832db7c582a5bfaa270c3f55e8b25f057c0d9bab Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Thu, 13 Feb 2025 22:10:05 +0700 Subject: [PATCH 1/3] updated --- .../07_insignia/views/06_ReportMain.vue | 104 ++++++++++++++++-- 1 file changed, 95 insertions(+), 9 deletions(-) diff --git a/src/modules/07_insignia/views/06_ReportMain.vue b/src/modules/07_insignia/views/06_ReportMain.vue index af628457b..5e4857469 100644 --- a/src/modules/07_insignia/views/06_ReportMain.vue +++ b/src/modules/07_insignia/views/06_ReportMain.vue @@ -110,6 +110,30 @@ async function fecthlistRound() { }); } +const roundId2 = ref(""); +const roundOtionMain2 = ref([]); +const roundOtion2 = ref([]); +/** ฟังก์ชันคึงข้อมูลรอบการเสนอขอ note*/ +async function fecthlistRound2() { + showLoader(); + await http + .get(config.API.noteround(), { params: { path: "RECORD" } }) + .then((res: any) => { + roundOtionMain2.value = res.data.result.map((e: any) => ({ + id: e.id, + year: e.year, + name: e.name, + })); + roundOtion2.value = roundOtionMain2.value; + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); +} + /** * function ค้นหาข้อมูลใน option * @param val คำค้นหา @@ -163,7 +187,13 @@ async function onUpdateFilter() { name: "รายงานแสดงรายชื่อลูกจ้างประจำที่ได้รับ/ไม่ได้รับ การจ่ายใบกำกับฯ เครื่องราชอิสริยาภรณที่ได้รับพระราชทาน (ลูกจ้าง)", }; } - if (typeReport.value && roundId.value && nodeId.value) { + if ( + (typeReport.value.val === "report1" || + typeReport.value.val === "report2" || + typeReport.value.val === "report3") && + (roundId.value || roundId2.value) && + nodeId.value + ) { isLoadPDF.value = true; pdfSrc.value = undefined; @@ -180,13 +210,34 @@ async function onUpdateFilter() { .then(async (res) => { const data = await res.data.result; detailReport.value = data; - const type = - typeReport.value.val === "report4" || - typeReport.value.val === "report5" || - typeReport.value.val === "report6" - ? "xlsx" - : "docx"; - await fetchDocumentTemplate(data, type); + + await fetchDocumentTemplate(data, "docx"); + }) + .catch(async (e) => { + messageError($q, JSON.parse(await e.response.data.text())); + }) + .finally(() => { + isLoadPDF.value = false; + }); + } else if (roundId2.value && nodeId.value) { + isLoadPDF.value = true; + pdfSrc.value = undefined; + + await http + .post( + config.API.reportInsigniaNew + + `/${typeReport.value.val}/${employeeClass.value}`, + { + roundId: roundId2.value, + node: nodeLevel.value, + nodeId: nodeId.value, + } + ) + .then(async (res) => { + const data = await res.data.result; + detailReport.value = data; + + await fetchDocumentTemplate(data, "xlsx"); }) .catch(async (e) => { messageError($q, JSON.parse(await e.response.data.text())); @@ -251,7 +302,7 @@ function downloadReport(type: string) { } onMounted(async () => { - await Promise.all([fetchDataTree(), fecthlistRound()]); + await Promise.all([fetchDataTree(), fecthlistRound(), fecthlistRound2()]); }); @@ -342,6 +393,12 @@ onMounted(async () => {
{ + + + +
From a87e0bd01563063c6282e5ce2d131571c53bbbb1 Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Thu, 13 Feb 2025 22:48:05 +0700 Subject: [PATCH 2/3] fixing report insignia --- .../07_insignia/views/06_ReportMain.vue | 34 ++++++++++++++++--- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/src/modules/07_insignia/views/06_ReportMain.vue b/src/modules/07_insignia/views/06_ReportMain.vue index 5e4857469..5f090531a 100644 --- a/src/modules/07_insignia/views/06_ReportMain.vue +++ b/src/modules/07_insignia/views/06_ReportMain.vue @@ -290,12 +290,14 @@ function backPage() { } } -function downloadReport(type: string) { +function downloadReport(type: string, download: "docx" | "" | "xlsx" = "") { const fileName = optionReport.value.find((e) => e.id === typeReport.value.id)?.name || ""; - if (type === "xlsx") { + if (type === "xlsx" && download === "") { genReportXLSX(detailReport.value, fileName, type); + } else if (type === "pdf" && download === "xlsx") { + genReportXLSX(detailReport.value, fileName, "pdf"); } else { genReport(detailReport.value, fileName, type); } @@ -335,20 +337,42 @@ onMounted(async () => { flat round :loading="isLoadPDF" - :disable="!nodeId || !employeeClass || !roundId" + :disable="!nodeId || !employeeClass || (!roundId && !roundId2)" color="primary" icon="download" v-if="checkPermission($route)?.attrIsGet" > - + ไฟล์ .pdf - + From c0c2b53532c78ec8dafee5c2fbdfce2a37aaa73b Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Fri, 14 Feb 2025 17:30:21 +0700 Subject: [PATCH 3/3] fix --- src/modules/21_report/views/05_reportSalary.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/21_report/views/05_reportSalary.vue b/src/modules/21_report/views/05_reportSalary.vue index 39d75df21..45611bd43 100644 --- a/src/modules/21_report/views/05_reportSalary.vue +++ b/src/modules/21_report/views/05_reportSalary.vue @@ -152,10 +152,11 @@ function fetchReportPDF() { async function fetchDataReportUnified( reportCode: string, - employeeClass: string, + employeeClass: string ) { isLoadFilePdf.value = true; - pdfSrc.value = undefined + pdfSrc.value = undefined; + page.value = 1; const isHalfYearReport = (id: string) => ["go1", "go2", "go2-01", "emp-08", "emp2-08"].includes(id);