From 54c7855b615a3ed0646de9289da6b4e82d66a3a6 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Fri, 29 May 2026 10:55:41 +0700 Subject: [PATCH 1/3] feat(leave): display leaveCountApproveCount --- src/modules/05_leave/interface/index/main.ts | 1 + src/modules/05_leave/views/Main.vue | 26 +++++++++++--------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/modules/05_leave/interface/index/main.ts b/src/modules/05_leave/interface/index/main.ts index 9551977..a63d65d 100644 --- a/src/modules/05_leave/interface/index/main.ts +++ b/src/modules/05_leave/interface/index/main.ts @@ -43,6 +43,7 @@ interface LeaveItem { all: number; use: number; remain: number; + leaveCountApproveCount: number; } interface MainList { diff --git a/src/modules/05_leave/views/Main.vue b/src/modules/05_leave/views/Main.vue index 4e36478..fcaca35 100644 --- a/src/modules/05_leave/views/Main.vue +++ b/src/modules/05_leave/views/Main.vue @@ -141,12 +141,14 @@ async function fetchStatsTable() { value: el.leaveLimit > 0 ? Math.round( - (Number(el.leaveCountApprove) / Number(el.leaveLimit)) * 100 + (Number(el.leaveCountApprove) / Number(el.leaveLimit)) * + 100, ) : 0, all: Number(el.leaveLimit), use: el.leaveCountApprove, remain: Number(el.leaveLimit) - Number(el.leaveCountApprove), + leaveCountApproveCount: el.leaveCountApproveCount, })); }); stat.forEach((item) => itemPie.value.push(...item)); @@ -254,7 +256,7 @@ onMounted(async () => {
- ลาพักผ่อน + {{ item.text }}
@@ -262,17 +264,19 @@ onMounted(async () => {
ได้รับ - {{ item.all }} + {{ item.all }} วัน
ใช้ไป - {{ item.use }} + {{ item.use }} วัน
คงเหลือ - {{ item.remain }} + {{ item.remain }} วัน
@@ -294,11 +298,11 @@ onMounted(async () => { flat class="shadow-0 col-12 fit row items-center q-px-lg" > -
ลาป่วย
+
{{ item.text }}
ใช้ไป - {{ item.use }} - + {{ item.use }} วัน + ({{ item.leaveCountApproveCount }} ครั้ง)
@@ -317,11 +321,11 @@ onMounted(async () => { flat class="shadow-0 col-12 fit row items-center q-px-lg" > -
ลากิจส่วนตัว
+
{{ item.text }}
ใช้ไป - {{ item.use }} - + {{ item.use }} วัน + ({{ item.leaveCountApproveCount }} ครั้ง)
From 650de029f361be2cd37d0954e1f7c1b5a97743bd Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Fri, 29 May 2026 11:35:50 +0700 Subject: [PATCH 2/3] feat(leave): DownloadFile form leave --- .../05_leave/components/DialogDetail.vue | 147 ++++++++++++++++-- 1 file changed, 135 insertions(+), 12 deletions(-) diff --git a/src/modules/05_leave/components/DialogDetail.vue b/src/modules/05_leave/components/DialogDetail.vue index 3333374..7874515 100644 --- a/src/modules/05_leave/components/DialogDetail.vue +++ b/src/modules/05_leave/components/DialogDetail.vue @@ -6,7 +6,7 @@ import http from "@/plugins/http"; import config from "@/app.config"; import { useCounterMixin } from "@/stores/mixin"; import { useLeaveStore } from "@/modules/05_leave/store"; -import { useDataStore } from "@/stores/data"; +import genReport from "@/plugins/genreport"; /** import type*/ import type { @@ -16,8 +16,6 @@ import type { FromCancelDetail, } from "@/modules/05_leave/interface/response/leave"; -import DialogHeader from "@/components/DialogHeader.vue"; -import Workflow from "@/components/Workflow/Main.vue"; import FormLeave from "@/modules/05_leave/components/formDetail/01_SickForm.vue"; import FormChildbirth from "@/modules/05_leave/components/formDetail/04_HelpWifeBirthForm.vue"; import FormHoliday from "@/modules/05_leave/components/formDetail/05_VacationForm.vue"; @@ -33,7 +31,6 @@ import FormCancel from "@/modules/05_leave/components/formDetail/formCancel.vue" const $q = useQuasar(); const dataStore = useLeaveStore(); -const mainStore = useDataStore(); const { convertStatud } = dataStore; const mixin = useCounterMixin(); const { @@ -411,6 +408,28 @@ async function onSubmit() { }); } +/** + * ฟังก์ชันดาวน์โหลดไฟล์ + * @param id รหัสการลา + * @param fileName ชื่อไฟล์ + * @param type ประเภทไฟล์ + */ +async function onClickDownloadFile(id: string, fileName: string, type: string) { + showLoader(); + await http + .get(config.API.leaveReport(id)) + .then(async (res) => { + const data = res.data.result; + await genReport(data, fileName, type); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); +} + /**** ตรวจสอบว่ามีการส่งข้อมูลเข้ามาแล้วเปิด modal */ watch( () => props.modal, @@ -434,10 +453,62 @@ watch( v-if="props.leaveStatus != 'DELETE'" style="width: 900px; max-width: 80vw" > - + + + {{ ` ${titleMain} ${titleName}` }} + + ดาวน์โหลดไฟล์ + + + + + + + ไฟล์ .DOCX + + + + + + ไฟล์ .pdf + + + + + + + @@ -580,10 +651,62 @@ watch( - + + + {{ ` ${titleMainCancle} ${titleName}` }} + + ดาวน์โหลดไฟล์ + + + + + + + ไฟล์ .DOCX + + + + + + ไฟล์ .pdf + + + + + + + From a0f0443a55a0f5fb6d4d543d856285264cf7a682 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Fri, 29 May 2026 13:55:05 +0700 Subject: [PATCH 3/3] refactor: downloadBlobFile with direct blob download logic --- src/plugins/genreport.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/plugins/genreport.ts b/src/plugins/genreport.ts index 19e2856..500dca4 100644 --- a/src/plugins/genreport.ts +++ b/src/plugins/genreport.ts @@ -2,7 +2,6 @@ import axios from "axios"; import config from "@/app.config"; import { useCounterMixin } from "@/stores/mixin"; -import { downloadBlobFile } from "@/modules/10_registry/utils/downloadFile"; const mixin = useCounterMixin(); const { showLoader, hideLoader } = mixin; @@ -32,11 +31,16 @@ async function genReport(data: any, fileName: string, type: string = "docx") { const url = URL.createObjectURL(blob); const baseName = fileName.trim(); - // const extension = type === "docx" ? "docx" : "pdf"; - await downloadBlobFile({ - downloadUrl: url, - fileName: baseName, - }); + const extension = type === "docx" ? "docx" : "pdf"; + const link = document.createElement("a"); + link.href = url; + link.download = `${baseName}.${extension}`; + document.body.appendChild(link); + link.click(); + setTimeout(() => { + document.body.removeChild(link); + URL.revokeObjectURL(url); + }, 100); } }) .catch((err) => {