From 26feb2bf1db145d0aa040021d1fad3f78a1f90cf Mon Sep 17 00:00:00 2001 From: puriphatt Date: Thu, 5 Sep 2024 17:01:58 +0700 Subject: [PATCH] refactor(04): hide q-fab btn if group inactive --- src/pages/04_product-service/MainPage.vue | 28 ++--------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/src/pages/04_product-service/MainPage.vue b/src/pages/04_product-service/MainPage.vue index 9a8bb60f..d021257f 100644 --- a/src/pages/04_product-service/MainPage.vue +++ b/src/pages/04_product-service/MainPage.vue @@ -731,8 +731,6 @@ async function triggerChangeStatus( .then(resolve) .catch(reject); } - - currentNoAction.value = handleStatus(); }, cancel: () => {}, }); @@ -1280,7 +1278,6 @@ function cloneData() { }); } -const currentStatusList = ref([]); async function enterGroup( id: string, name: string, @@ -1293,7 +1290,7 @@ async function enterGroup( pathGroupName.value = name; currentIdType.value = ''; currentIdGrop.value = id; - currentStatusList.value.push(status); + currentNoAction.value = status === 'INACTIVE'; pathTypeName.value = name; await fetchListOfService(); await fetchListOfProduct(); @@ -1336,18 +1333,6 @@ async function enterNext(type: 'service' | 'product') { flowStore.rotate(); } -function handleStatus() { - let tempValue = false; - - currentStatusList.value.forEach((item) => { - if (item === 'INACTIVE') { - tempValue = true; - } - }); - - return tempValue; -} - function handleHold(node: ProductGroup & { type: string }) { if ($q.screen.gt.xs) return; holdDialog.value = true; @@ -1391,7 +1376,6 @@ watch( currentIdGrop.value = ''; currentIdType.value = ''; filterStat.value = []; - currentStatusList.value = []; }, }, ]; @@ -1413,8 +1397,6 @@ watch( currentIdType.value = ''; filterStat.value = []; productMode.value = 'group'; - - currentStatusList.value.splice(1); expandedTree.value.pop(); utilsStore.currentTitle.path.pop(); } @@ -1471,8 +1453,7 @@ watch( }, ); -watch([currentStatusList, productMode], async () => { - currentNoAction.value = handleStatus(); +watch(productMode, async () => { if (productMode.value === 'group') { await calculateStats(); } @@ -1621,7 +1602,6 @@ watch([currentStatusList, productMode], async () => { expandedTree = expandedTree.filter((i) => v.id !== i); currentIdGrop = ''; currentIdType = ''; - currentStatusList = []; productMode = 'group'; return; } @@ -1693,9 +1673,6 @@ watch([currentStatusList, productMode], async () => { async (v: (typeof treeProductTypeAndGroup)[number]) => { if (v.type === 'group') { await triggerChangeStatus(v.id, v.status, v.type); - - currentStatusList[0] = - v.status === 'INACTIVE' ? 'ACTIVE' : 'INACTIVE'; } } " @@ -2079,7 +2056,6 @@ watch([currentStatusList, productMode], async () => { :id="`enter-${props.row.name}`" :for="`enter-${props.row.name}`" :is-disabled="props.row.status === 'INACTIVE'" - :no-action="handleStatus()" :color=" { type: $q.dark.isActive