From f4b758ab3231144d00451aaee2898003acf5d8ba Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Tue, 4 Feb 2025 14:17:33 +0700 Subject: [PATCH] fix report salary --- src/api/09_leave/api.leave.ts | 2 ++ .../components/04_salaryLists/Dashboard.vue | 10 +++---- .../components/04_salaryLists/TabMain.vue | 19 +++++++++----- .../13_salary/views/04_salaryLists.vue | 26 ++++--------------- 4 files changed, 22 insertions(+), 35 deletions(-) diff --git a/src/api/09_leave/api.leave.ts b/src/api/09_leave/api.leave.ts index 120aca326..6fc2d10a2 100644 --- a/src/api/09_leave/api.leave.ts +++ b/src/api/09_leave/api.leave.ts @@ -45,5 +45,7 @@ export default { leaveReportTimeLate: (type: string) => `${leaveReport}/late/${type}`, leaveReportLeaveday: (type: string) => `${leaveReport}/leaveday/${type}`, + leaveReportLeavedayRetire: () => `${leaveReport}/leavedayRetire`, + leaveReportLeave2: (type: string) => `${leaveReport}/leave2/${type}`, }; diff --git a/src/modules/13_salary/components/04_salaryLists/Dashboard.vue b/src/modules/13_salary/components/04_salaryLists/Dashboard.vue index 9dde8731d..eeacc9b21 100644 --- a/src/modules/13_salary/components/04_salaryLists/Dashboard.vue +++ b/src/modules/13_salary/components/04_salaryLists/Dashboard.vue @@ -15,12 +15,11 @@ import type { } from "@/modules/13_salary/interface/index/Main"; import type { ResSalaryOrg } from "@/modules/13_salary/interface/response/SalaryList"; -/** importStore*/ - /** use*/ const $q = useQuasar(); const store = useSalaryListSDataStore(); -const { messageError, showLoader, hideLoader,onSearchDataTable } = useCounterMixin(); +const { messageError, showLoader, hideLoader, onSearchDataTable } = + useCounterMixin(); /** props*/ const props = defineProps({ @@ -389,9 +388,7 @@ const columns = computed(() => { return columnsss; }); -/** - * function fetch ข้อมูลสถิติ - */ +/** function fetch ข้อมูลสถิติ*/ async function fetchDataDashboard() { showLoader(); const formData = { @@ -561,7 +558,6 @@ watch([() => props?.snapShot, () => props.roundFilter], () => { map-options :options="columns" option-value="name" - style="min-width: 140px" /> diff --git a/src/modules/13_salary/components/04_salaryLists/TabMain.vue b/src/modules/13_salary/components/04_salaryLists/TabMain.vue index 2acee0243..b606e5192 100644 --- a/src/modules/13_salary/components/04_salaryLists/TabMain.vue +++ b/src/modules/13_salary/components/04_salaryLists/TabMain.vue @@ -311,7 +311,7 @@ function fetchDataPeriodNew() { function onClickDownload(data: DataOption, type: string = "xlsx") { showLoader(); - if (data.id === "go1" || data.id === "go2") { + if (data.id === "go1" || data.id === "go2" || data.id === "go2-01") { const formData = { type: "HAFT", startDate: @@ -323,12 +323,17 @@ function onClickDownload(data: DataOption, type: string = "xlsx") { ? `${props?.roundFilter?.year}-03-31` : `${props?.roundFilter?.year}-09-30`, nodeId: props.rootId, + isRetirement: data.id === "go2-01" ? true : undefined, }; + const pathApi = + data.id === "go2-01" + ? config.API.leaveReportLeavedayRetire() + : config.API.leaveReportLeaveday("officer"); http - .post(config.API.leaveReportLeaveday("officer"), formData) - .then((res) => { + .post(pathApi, formData) + .then(async (res) => { const dataList = res.data.result; - genReportXLSX(dataList, data.name); + await genReportXLSX(dataList, data.name); }) .catch((e) => { messageError($q, e); @@ -358,9 +363,9 @@ function onClickDownload(data: DataOption, type: string = "xlsx") { const finalUrl = isGovernmentId ? `${url}/${store.tabGroup}` : url; http .get(finalUrl) - .then((res) => { + .then(async (res) => { const dataList = res.data.result; - genReportXLSX(dataList, data.name, type); + await genReportXLSX(dataList, data.name, type); }) .catch((e) => { messageError($q, e); @@ -383,7 +388,7 @@ onMounted(() => { const isRetire = ref(false); const updateIsShowRetire = async () => { - isRetire.value = await !isRetire.value; + isRetire.value = !isRetire.value; fetchDataPeriodNew(); }; diff --git a/src/modules/13_salary/views/04_salaryLists.vue b/src/modules/13_salary/views/04_salaryLists.vue index 763e300b8..360136b2f 100644 --- a/src/modules/13_salary/views/04_salaryLists.vue +++ b/src/modules/13_salary/views/04_salaryLists.vue @@ -69,14 +69,6 @@ const titleCommand = computed(() => { break; } return `ปีงบประมาณ ${year.value + 543} รอบการขึ้นเงินเดือน ${txt}`; - - // return `ปีงบประมาณ ${year.value + 543} รอบการขึ้นเงินเดือน ${ - // roundFilter.value?.shortCode === "SPECIAL" - // ? roundFilter.value?.name - // ? roundFilter.value?.name - // : "" - // : `1 ${roundFilter.value?.name ? roundFilter.value?.name : ""}` - // } `; }); /** @@ -140,6 +132,7 @@ async function getRound() { /** * function เรียกรอบ + * @param code value รอบเงินเดือน */ async function getSnap(code: string) { snapOptions.value = @@ -287,9 +280,7 @@ async function fetchSalalyPeriod( } } -/** - * function เปลี่ยนรอบการขั้นเงินเดือน - */ +/** function เปลี่ยนรอบการขั้นเงินเดือน*/ async function onChangeRound() { // เก็บสถานะการปิดรอบในตัวแปร isClosedRound เพื่อใช้ในการเช็ค store.isClosedRound = roundFilter.value.isClose; @@ -309,11 +300,8 @@ async function onChangeRound() { } } -/** - * function เปลี่ยนรอบ - */ +/** function เปลี่ยนรอบ*/ async function onChangeSnap() { - // agencyFilter.value = ""; if (agencyFilter.value && roundFilter.value.id && snapFilter.value) { await fetchSalalyPeriod( agencyFilter.value, @@ -323,9 +311,7 @@ async function onChangeSnap() { } } -/** - * function เปลี่ยนหน่วยงาน - */ +/** function เปลี่ยนหน่วยงาน*/ async function onChangeAgency() { store.rootId = agencyFilter.value; if ( @@ -341,9 +327,7 @@ async function onChangeAgency() { } } -/** - * function fetch PeriodQuota - */ +/** function fetch PeriodQuota*/ function getQuota() { http .get(config.API.salaryListPeriodQuota(store.groupId))