From 63a6dc371c3708360ff0504f101caf841c9e400e Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Wed, 20 Mar 2024 11:31:51 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=81=E0=B8=B2?= =?UTF-8?q?=E0=B8=A3=E0=B9=80=E0=B8=A5=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=99?= =?UTF-8?q?=E0=B9=80=E0=B8=87=E0=B8=B4=E0=B8=99=E0=B9=80=E0=B8=94=E0=B8=B7?= =?UTF-8?q?=E0=B8=AD=E0=B8=99=E0=B8=82=E0=B9=89=E0=B8=B2=E0=B8=A3=E0=B8=B2?= =?UTF-8?q?=E0=B8=8A=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=AF=20=3D>=20?= =?UTF-8?q?=E0=B8=94=E0=B8=B2=E0=B8=A7=E0=B9=82=E0=B8=AB=E0=B8=A5=E0=B8=A3?= =?UTF-8?q?=E0=B8=B2=E0=B8=9A=E0=B8=87=E0=B8=B2=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/SalaryLists/TabMain.vue | 45 ++++++++++++++++--- src/modules/13_salary/views/salaryLists.vue | 1 + 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/src/modules/13_salary/components/SalaryLists/TabMain.vue b/src/modules/13_salary/components/SalaryLists/TabMain.vue index 42fd2499b..607025189 100644 --- a/src/modules/13_salary/components/SalaryLists/TabMain.vue +++ b/src/modules/13_salary/components/SalaryLists/TabMain.vue @@ -33,6 +33,7 @@ const props = defineProps({ periodLatest: { type: Object as () => DataPeriodLatest, require: true }, rootId: { type: String, require: true }, periodId: { type: String, require: true }, + roundFilter: { type: Object, require: true }, }); const total = ref(); @@ -228,9 +229,9 @@ function fetchDataQuota(id: string) { .get(config.API.salaryListPeriodQuota(id)) .then((res) => { const data = res.data.result; - + store.remaining = data.remaining; - store.statusQuota = data.status + store.statusQuota = data.status; itemsCard.value[0].total = data.total; itemsCard.value[1].total = data.fifteenPercent; itemsCard.value[2].total = data.chosen; @@ -308,12 +309,20 @@ function fetchDataPeriodNew() { } function onClickDownload(data: DataOption) { - if (props.rootId && props.periodId) { - showLoader(); + if (data.id === "gov1-06" || data.id === "gov2-06") { + const formData = { + type: "HAFT", + startDate: + data.id === "gov1-06" + ? `${props?.roundFilter?.year - 1}-10-01` + : `${props?.roundFilter?.year}-04-01`, + endDate: + data.id === "gov1-06" + ? `${props?.roundFilter?.year}-03-31` + : `${props?.roundFilter?.year}-09-30`, + }; http - .get( - config.API.salaryReportListsByid(data.id, props.rootId, props.periodId) - ) + .post(config.API.leaveReportLeaveday("officer"), formData) .then((res) => { const dataList = res.data.result; genReportXLSX(dataList, data.name); @@ -324,6 +333,28 @@ function onClickDownload(data: DataOption) { .finally(() => { hideLoader(); }); + } else { + if (props.rootId && props.periodId) { + showLoader(); + http + .get( + config.API.salaryReportListsByid( + data.id, + props.rootId, + props.periodId + ) + ) + .then((res) => { + const dataList = res.data.result; + genReportXLSX(dataList, data.name); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); + } } } diff --git a/src/modules/13_salary/views/salaryLists.vue b/src/modules/13_salary/views/salaryLists.vue index 23dfb2c5a..432b69b7a 100644 --- a/src/modules/13_salary/views/salaryLists.vue +++ b/src/modules/13_salary/views/salaryLists.vue @@ -428,6 +428,7 @@ onMounted(async () => { :periodLatest="periodLatest" :periodId="roundFilter.id" :rootId="agencyFilter" + :roundFilter="roundFilter" />