diff --git a/src/modules/09_leave/components/1_Work/DialogReport.vue b/src/modules/09_leave/components/1_Work/DialogReport.vue index 8c7acf537..cb670d2a6 100644 --- a/src/modules/09_leave/components/1_Work/DialogReport.vue +++ b/src/modules/09_leave/components/1_Work/DialogReport.vue @@ -38,10 +38,10 @@ const props = defineProps({ }); const loadingBtn = ref(true); -const filterType = ref("daily"); +const filterType = ref("DAY"); const filterTypeMain = ref([ - { id: "daily", name: "รายวัน" }, - { id: "monthly", name: "รายเดือน" }, + { id: "DAY", name: "รายวัน" }, + { id: "MONTH", name: "รายเดือน" }, ]); const filterTypeOption = ref(filterTypeMain.value); const date = ref(new Date()); @@ -54,9 +54,9 @@ const detailReport = ref(); /** function อัปเดทรายงานสถิติการลา*/ async function updateFilterType() { - filterType.value === "daily" + filterType.value === "DAY" ? updateDte() - : filterType.value === "monthly" + : filterType.value === "MONTH" ? updateMonth() : false; } @@ -66,6 +66,7 @@ async function updateDte() { const body = { startDate: dateToISO(date.value), endDate: dateToISO(date.value), + type: filterType.value, }; fetchReportTimeRecords(body); } @@ -80,6 +81,7 @@ async function updateMonth() { const body = { startDate: dateToISO(firstDay), endDate: dateToISO(lastDay), + type: filterType.value, }; fetchReportTimeRecords(body); } @@ -133,7 +135,7 @@ async function genReportXLSX(data: any) { }, responseType: "blob", }) - .then(async (res) => { + .then((res) => { const blob = new Blob([res.data]); downloadReport(blob, "xlsx"); }) @@ -165,7 +167,7 @@ function monthYearThai(val: DataDateMonthObject) { watch( () => props.modal, () => { - filterType.value = "daily"; + filterType.value = "DAY"; date.value = new Date(); props.modal && updateFilterType(); } @@ -192,11 +194,11 @@ watch( map-options option-label="name" option-value="id" - use-input @update:model-value="updateFilterType" @filter="(inputValue: any, doneFn: Function) => filterFnOptions(inputValue, doneFn,)" - >