From 05c4521aff7ccb9a71e8a66b6e142999c08cec4b Mon Sep 17 00:00:00 2001 From: Net <93821485+somnetsak123@users.noreply.github.com> Date: Mon, 1 Jul 2024 11:53:33 +0700 Subject: [PATCH] =?UTF-8?q?fix:=20=E0=B9=81=E0=B8=81=E0=B9=89=20=20layout?= =?UTF-8?q?=20=E0=B8=82=E0=B8=AD=E0=B8=87=20=20=E0=B9=81=E0=B8=9A=E0=B9=88?= =?UTF-8?q?=E0=B8=87=E0=B8=AB=E0=B8=99=E0=B9=89=E0=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/03_customer-management/MainPage.vue | 81 ++++++++++--------- 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/src/pages/03_customer-management/MainPage.vue b/src/pages/03_customer-management/MainPage.vue index 2746124e..08dd8eb9 100644 --- a/src/pages/03_customer-management/MainPage.vue +++ b/src/pages/03_customer-management/MainPage.vue @@ -30,6 +30,7 @@ import InfoForm from 'src/components/02_personnel-management/InfoForm.vue'; import CustomerInfoComponent from 'src/components/03_customer-management/CustomerInfoComponent.vue'; import NoData from 'components/NoData.vue'; import HistoryEditComponent from 'src/components/03_customer-management/HistoryEditComponent.vue'; +import PaginationComponent from 'src/components/PaginationComponent.vue'; import { CustomerCreate, @@ -245,11 +246,10 @@ const branch = ref(); const currentPageCustomer = ref(1); const maxPageCustomer = ref(1); -const pageSizeCustomer = ref(30); +const pageSize = ref(10); const currentPageEmployee = ref(1); const maxPageEmployee = ref(1); -const pageSizeEmployee = ref(30); const currentBranchId = ref(''); const currentCustomerName = ref(''); @@ -683,7 +683,7 @@ async function fetchListCustomer() { const resultList = await fetchList({ includeBranch: true, page: currentPageCustomer.value, - pageSize: pageSizeCustomer.value, + pageSize: pageSize.value, status: currentStatus.value === 'All' ? undefined @@ -695,9 +695,7 @@ async function fetchListCustomer() { if (resultList) { currentPageCustomer.value = resultList.page; - maxPageCustomer.value = Math.ceil( - resultList.total / pageSizeCustomer.value, - ); + maxPageCustomer.value = Math.ceil(resultList.total / pageSize.value); listCustomer.value = resultList.result; } @@ -705,8 +703,8 @@ async function fetchListCustomer() { async function fetchListEmployee() { const resultListEmployee = await employeeStore.fetchList({ - page: currentPageCustomer.value, - pageSize: pageSizeCustomer.value, + page: currentPageEmployee.value, + pageSize: pageSize.value, status: currentStatus.value === 'All' ? undefined @@ -718,7 +716,7 @@ async function fetchListEmployee() { }); if (resultListEmployee) { maxPageEmployee.value = Math.ceil( - resultListEmployee.total / pageSizeEmployee.value, + resultListEmployee.total / pageSize.value, ); listEmployee.value = resultListEmployee.result; } @@ -752,7 +750,7 @@ async function onSubmitEdit(id: string) { personName: formData.value.personName, }; - if(tempValue.status === 'CREATED') delete tempValue['status'] + if (tempValue.status === 'CREATED') delete tempValue['status']; await editById(id, tempValue); infoDrawer.value = false; @@ -1088,7 +1086,7 @@ onMounted(async () => { const resultList = await fetchList({ includeBranch: true, page: 1, - pageSize: pageSizeCustomer.value, + pageSize: pageSize.value, }); if (resultStats) { @@ -1107,9 +1105,7 @@ onMounted(async () => { if (resultList) { currentPageCustomer.value = resultList.page; - maxPageCustomer.value = Math.ceil( - resultList.total / pageSizeCustomer.value, - ); + maxPageCustomer.value = Math.ceil(resultList.total / pageSize.value); listCustomer.value = resultList.result; } @@ -1123,12 +1119,12 @@ onMounted(async () => { const resultListEmployee = await employeeStore.fetchList({ page: 1, - pageSize: pageSizeEmployee.value, + pageSize: pageSize.value, }); if (resultListEmployee) { maxPageEmployee.value = Math.ceil( - resultListEmployee.total / pageSizeEmployee.value, + resultListEmployee.total / pageSize.value, ); listEmployee.value = resultListEmployee.result; } @@ -1142,14 +1138,6 @@ watch(locale, () => { }; }); -watch(currentPageCustomer, async () => { - await fetchListCustomer(); -}); - -watch(currentPageEmployee, async () => { - await fetchListEmployee(); -}); - watch(fieldSelectedCustomer, async () => { let resultList; @@ -1549,14 +1537,22 @@ watch([inputSearch, currentStatus], async () => { /> -
- +
+ {{ + $t('recordsPage', { + resultcurrentPage: listCustomer.length, + total: statsCustomerType.PERS + statsCustomerType.CORP, + }) + }} +
+
@@ -1608,14 +1604,19 @@ watch([inputSearch, currentStatus], async () => { @toggle-status="(id, status) => toggleStatusEmployee(id, status)" /> -
- +
+ {{ + $t('recordsPage', { + resultcurrentPage: listEmployee.length, + total: statsEmployee, + }) + }} +
+