From e5859474be58ec1191f8a75a44ce6cb8795f5ac4 Mon Sep 17 00:00:00 2001 From: Net <93821485+somnetsak123@users.noreply.github.com> Date: Thu, 27 Jun 2024 09:41:39 +0700 Subject: [PATCH] =?UTF-8?q?fix:=20=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=80?= =?UTF-8?q?=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1=20=E0=B8=AA=E0=B8=B4?= =?UTF-8?q?=E0=B8=99=E0=B8=84=E0=B9=89=E0=B8=B2=E0=B9=83=E0=B8=99=E0=B8=87?= =?UTF-8?q?=E0=B8=B2=E0=B8=99=E0=B8=AA=E0=B8=B4=E0=B8=99=E0=B8=84=E0=B9=89?= =?UTF-8?q?=E0=B8=B2=E0=B8=A1=E0=B8=B2=E0=B9=84=E0=B8=A1=E0=B9=88=E0=B8=AB?= =?UTF-8?q?=E0=B8=A1=E0=B8=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/04_product-service/MainPage.vue | 26 +++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/pages/04_product-service/MainPage.vue b/src/pages/04_product-service/MainPage.vue index a2bf0dab..d9dc9f8f 100644 --- a/src/pages/04_product-service/MainPage.vue +++ b/src/pages/04_product-service/MainPage.vue @@ -139,6 +139,7 @@ const productMode = ref<'group' | 'type' | 'service' | 'product'>('group'); const productGroup = ref(); const productType = ref(); const product = ref<(ProductList & { type: 'product' })[]>(); +const productIsAdd = ref<(ProductList & { type: 'product' })[]>(); const service = ref<(Service & { type: 'service' })[]>(); const resultSearchProduct = ref(); const productAndService = ref([]); @@ -366,6 +367,27 @@ async function fetchListGroups() { } } +async function fetchListOfProductIsAdd(productTypeId: string) { + const res = await fetchListProduct({ + status: + currentStatus.value === 'INACTIVE' + ? 'INACTIVE' + : currentStatus.value === 'ACTIVE' + ? 'ACTIVE' + : undefined, + productTypeId, + }); + + if (res) { + productIsAdd.value = res.result.map((v) => { + return { + ...v, + type: 'product', + }; + }); + } +} + async function fetchListOfProduct(productTypeId: string) { const res = await fetchListProduct({ page: currentPageProduct.value, @@ -1839,7 +1861,7 @@ watch(currentPageService, async () => { :class="`${$q.screen.gt.sm ? 'col-3 ' : $q.screen.gt.xs ? 'col-6' : 'col-12'}`" v-for="i in (!!inputSearchProductAndService ? resultSearchProduct - : product + : productIsAdd )?.filter((i) => { if (i.status === 'INACTIVE') { return false; @@ -2081,7 +2103,7 @@ watch(currentPageService, async () => { dense @addProduct=" async (index) => { - await fetchListOfProduct(currentIdType); + await fetchListOfProductIsAdd(currentIdType); currentWorkIndex = index; dialogTotalProduct = true; }