From d7ec0127b9d69022518a9eb80d0c3007b13d0848 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Wed, 15 Nov 2023 18:07:58 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=20maxPage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/09_leave/components/1_Work/Tab2.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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();