diff --git a/src/modules/09_leave/components/1_Work/Tab2.vue b/src/modules/09_leave/components/1_Work/Tab2.vue index 22dad0a5d..f3aa9eae0 100644 --- a/src/modules/09_leave/components/1_Work/Tab2.vue +++ b/src/modules/09_leave/components/1_Work/Tab2.vue @@ -95,7 +95,7 @@ const rows = ref([]); const keyword = ref(""); const page = ref(1); const rowsPerPage = ref(5); -const maxPage = ref(7 / 3); +const maxPage = ref(1); /** เรียกข้อมูลรายการลงเวลาปฏิบัติงาน (รายการลงเวลา) */ async function fetchListLogRecord() { @@ -109,8 +109,8 @@ async function fetchListLogRecord() { }&pageSize=${rowsPerPage.value}&keyword=${keyword.value}` ) .then((res) => { - console.log(res); - let datalist: TableRows[] = res.data.result.map((e: DataResLog) => ({ + maxPage.value = Math.ceil(res.data.result.total / rowsPerPage.value); + let datalist: TableRows[] = res.data.result.data.map((e: DataResLog) => ({ id: e.id, fullName: e.fullName, checkDate: e.checkDate && date2Thai(e.checkDate), @@ -127,6 +127,7 @@ async function fetchListLogRecord() { }) .catch((err) => { console.log(err); + rows.value = []; }) .finally(() => { hideLoader();