From d91c735b2d7548e31e4b8297691d2ea5dedbffcf Mon Sep 17 00:00:00 2001 From: Net <93821485+somnetsak123@users.noreply.github.com> Date: Wed, 26 Jun 2024 13:39:38 +0700 Subject: [PATCH] =?UTF-8?q?feat:=20=E0=B9=81=E0=B8=9A=E0=B9=88=E0=B8=87?= =?UTF-8?q?=E0=B8=AB=E0=B8=99=E0=B9=89=E0=B8=B2=20=E0=B8=AA=E0=B8=B4?= =?UTF-8?q?=E0=B8=99=E0=B8=84=E0=B9=89=E0=B8=B2=20=E0=B9=81=E0=B8=A5?= =?UTF-8?q?=E0=B8=B0=20=E0=B8=9A=E0=B8=A3=E0=B8=B4=E0=B8=81=E0=B8=B2?= =?UTF-8?q?=E0=B8=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/04_product-service/MainPage.vue | 92 ++++++++++++++++++++++- 1 file changed, 90 insertions(+), 2 deletions(-) diff --git a/src/pages/04_product-service/MainPage.vue b/src/pages/04_product-service/MainPage.vue index cd7806bf..ae66ade6 100644 --- a/src/pages/04_product-service/MainPage.vue +++ b/src/pages/04_product-service/MainPage.vue @@ -207,6 +207,15 @@ const pageSizeGroup = ref(30); const currentPageType = ref(1); const maxPageType = ref(1); const pageSizeType = ref(30); +const currentPageServiceAndProduct = ref(1); +const maxPageServiceAndProduct = ref(1); +const pageSizeServiceAndProduct = ref(30); +const currentPageProduct = ref(1); +const maxPageProduct = ref(1); +const pageSizeProduct = ref(30); +const currentPageService = ref(1); +const maxPageService = ref(1); +const pageSizeService = ref(30); // เก็บ id ที่เข้ามา const currentId = ref(''); @@ -350,6 +359,8 @@ async function fetchListGroups() { async function fetchListOfProduct(productTypeId: string) { const res = await fetchListProduct({ + page: currentPageProduct.value, + pageSize: pageSizeProduct.value, status: currentStatus.value === 'INACTIVE' ? 'INACTIVE' @@ -360,6 +371,9 @@ async function fetchListOfProduct(productTypeId: string) { }); if (res) { + currentPageProduct.value = res.page; + maxPageProduct.value = Math.ceil(res.total / pageSizeProduct.value); + product.value = res.result.map((v) => { return { ...v, @@ -371,6 +385,8 @@ async function fetchListOfProduct(productTypeId: string) { async function fetchListOfService() { const res = await fetchListService({ + page: currentPageService.value, + pageSize: pageSizeService.value, status: currentStatus.value === 'INACTIVE' ? 'INACTIVE' @@ -381,6 +397,8 @@ async function fetchListOfService() { }); if (res) { + currentPageService.value = res.page; + maxPageService.value = Math.ceil(res.total / pageSizeService.value); service.value = res.result.map((v) => { return { ...v, @@ -469,6 +487,8 @@ async function toggleStatusGroup(id: string, status: Status) { async function fetchListOfProductAndService() { const res = await fetchListProductAndService({ + page: currentPageServiceAndProduct.value, + pageSize: pageSizeServiceAndProduct.value, status: currentStatus.value === 'INACTIVE' ? 'INACTIVE' @@ -482,6 +502,11 @@ async function fetchListOfProductAndService() { if (currentStatus.value === 'All') { totalProductAndService.value = res.total; } + + currentPageServiceAndProduct.value = res.page; + maxPageServiceAndProduct.value = Math.ceil( + res.total / pageSizeServiceAndProduct.value, + ); productAndService.value = res.result; } } @@ -910,6 +935,18 @@ watch(currentPageGroup, async () => { watch(currentPageType, async () => { await fetchListType(); }); + +watch(currentPageServiceAndProduct, async () => { + await fetchListOfProductAndService(); +}); + +watch(currentPageProduct, async () => { + await fetchListOfProduct(currentIdType.value); +}); + +watch(currentPageService, async () => { + await fetchListOfService(); +});