From d464b1fcbbcde2026c06313b96fce329f596ce17 Mon Sep 17 00:00:00 2001 From: Net <93821485+somnetsak123@users.noreply.github.com> Date: Wed, 26 Jun 2024 13:11:03 +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=E0=B8=82=E0=B8=AD=E0=B8=87?= =?UTF-8?q?=20=20=E0=B8=81=E0=B8=A5=E0=B8=B8=E0=B9=88=E0=B8=A1=20=E0=B9=81?= =?UTF-8?q?=E0=B8=A5=E0=B8=B0=20=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B9=80?= =?UTF-8?q?=E0=B8=A0=E0=B8=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/04_product-service/MainPage.vue | 56 +++++++++++++++++------ src/stores/product-service/index.ts | 9 +++- 2 files changed, 51 insertions(+), 14 deletions(-) diff --git a/src/pages/04_product-service/MainPage.vue b/src/pages/04_product-service/MainPage.vue index cd7d5f4c..21e2cfb2 100644 --- a/src/pages/04_product-service/MainPage.vue +++ b/src/pages/04_product-service/MainPage.vue @@ -190,32 +190,35 @@ const serviceTab = [ const workItems = ref([]); const workNameRef = ref(); +const selectProduct = ref([]); +const currentWorkIndex = ref(0); const currentServiceTab = ref('serviceInformation'); const propertiesDialog = ref(false); -const selectProduct = ref([]); - -const currentWorkIndex = ref(0); - const totalProduct = ref(0); const totalService = ref(0); const totalProductAndService = ref(0); -const currentPage = ref(1); -const maxPage = ref(1); -const pageSize = ref(30); +// แบ่งหน้า +const currentPageGroup = ref(1); +const maxPageGroup = ref(1); +const pageSizeGroup = ref(2); +const currentPageType = ref(1); +const maxPageType = ref(1); +const pageSizeType = ref(2); +// เก็บ id ที่เข้ามา const currentId = ref(''); const currentIdType = ref(''); const currentIdService = ref(''); const currentIdProduct = ref(''); +const currentStatus = ref('All'); + const resultSearchGroup = ref(); const resultSearchType = ref<(ProductGroup & { productGroupId: string })[]>(); -const currentStatus = ref('All'); - const inputFile = (() => { const element = document.createElement('input'); element.type = 'file'; @@ -308,6 +311,8 @@ async function featchStatsProduct() { async function fetchListType() { const res = await fetchListProductServiceType({ + page: currentPageType.value, + pageSize: pageSizeType.value, productGroupId: currentId.value, status: currentStatus.value === 'All' @@ -318,12 +323,16 @@ async function fetchListType() { }); if (res) { + currentPageType.value = res.page; + maxPageType.value = Math.ceil(res.total / pageSizeType.value); productType.value = res.result; } } async function fetchListGroups() { const res = await fetchListProductService({ + page: currentPageGroup.value, + pageSize: pageSizeGroup.value, status: currentStatus.value === 'All' ? undefined @@ -333,6 +342,8 @@ async function fetchListGroups() { }); if (res) { + currentPageGroup.value = res.page; + maxPageGroup.value = Math.ceil(res.total / pageSizeGroup.value); productGroup.value = res.result; } } @@ -891,6 +902,14 @@ watch(currentStatus, async () => { await fetchListType(); } }); + +watch(currentPageGroup, async () => { + await fetchListGroups(); +}); + +watch(currentPageType, async () => { + await fetchListType(); +});