From 2da804f17ea5e4f7c6d95916ab5d683a047d19a6 Mon Sep 17 00:00:00 2001 From: puriphatt Date: Wed, 21 Aug 2024 11:00:46 +0700 Subject: [PATCH] fix(04): group tree action --- src/pages/04_product-service/MainPage.vue | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/pages/04_product-service/MainPage.vue b/src/pages/04_product-service/MainPage.vue index f1d23f71..f3da8242 100644 --- a/src/pages/04_product-service/MainPage.vue +++ b/src/pages/04_product-service/MainPage.vue @@ -466,6 +466,7 @@ const currentIdGrop = ref(''); const currentIdType = ref(''); const currentIdService = ref(''); const currentIdProduct = ref(''); +const currentIdGropTree = ref(''); const currentStatusGroupType = ref('CREATED'); const currentIdGroupType = ref(''); @@ -1144,7 +1145,9 @@ async function submitProduct() { async function submitGroup() { if (drawerInfo.value) { - await editProductService(currentIdGrop.value, formDataGroup.value); + if (currentIdGropTree.value) + await editProductService(currentIdGropTree.value, formDataGroup.value); + else await editProductService(currentIdGrop.value, formDataGroup.value); } else { const res = await createProductService(formDataGroup.value); @@ -1153,6 +1156,7 @@ async function submitGroup() { } } + currentIdGropTree.value = ''; drawerInfo.value = false; await fetchListGroups(); clearFormGroup(); @@ -1587,7 +1591,7 @@ watch( clearFormGroup(); assignFormDataGroup(v); isEdit = false; - currentIdGrop = v.id; + currentIdGropTree = v.id; drawerInfo = true; } } @@ -1606,8 +1610,7 @@ watch( clearFormGroup(); assignFormDataGroup(v); isEdit = true; - currentIdGrop = v.id; - + currentIdGropTree = v.id; drawerInfo = true; } }