From a848beb1bfbd04c0768e752170499d0dd8c47635 Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Tue, 5 Nov 2024 09:45:43 +0700 Subject: [PATCH] refactor: correct the typo --- src/pages/04_product-service/MainPage.vue | 52 +++++++++++------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/pages/04_product-service/MainPage.vue b/src/pages/04_product-service/MainPage.vue index ea06d88b..2482ac39 100644 --- a/src/pages/04_product-service/MainPage.vue +++ b/src/pages/04_product-service/MainPage.vue @@ -494,7 +494,7 @@ const totalGroup = ref(0); const total = ref(0); // เก็บ id ที่เข้ามา -const currentIdGrop = ref(''); +const currentIdGroup = ref(''); const currentIdType = ref(''); const currentIdService = ref(''); const currentIdProduct = ref(''); @@ -628,7 +628,7 @@ async function fetchListOfProduct() { : currentStatus.value === 'ACTIVE' ? 'ACTIVE' : undefined, - productGroupId: currentIdGrop.value, + productGroupId: currentIdGroup.value, }); if (res) { @@ -661,7 +661,7 @@ async function fetchListOfService() { : currentStatus.value === 'ACTIVE' ? 'ACTIVE' : undefined, - productGroupId: currentIdGrop.value, + productGroupId: currentIdGroup.value, }); if (res) { @@ -820,7 +820,7 @@ async function deleteProductById(productId?: string) { if (editByTree.value === 'group') { // Product Group const res = await deleteProductGroup( - productId ?? currentIdGrop.value, + productId ?? currentIdGroup.value, ); if (res) { } @@ -835,7 +835,7 @@ async function deleteProductById(productId?: string) { if (productMode.value === 'group') { // Product Group const res = await deleteProductGroup( - productId ?? currentIdGrop.value, + productId ?? currentIdGroup.value, ); if (res) { } @@ -1099,12 +1099,12 @@ function assignFormDataProductServiceCreate() { async function submitService(notClose = false) { assignFormDataProductServiceCreate(); - formDataProductService.value.productGroupId = currentIdGrop.value; + formDataProductService.value.productGroupId = currentIdGroup.value; if (profileFileImg.value) formDataProductService.value.image = profileFileImg.value; if (dialogService.value) { - formDataProductService.value.productGroupId = currentIdGrop.value; + formDataProductService.value.productGroupId = currentIdGroup.value; if ( formDataProductService.value.code === '' || @@ -1145,7 +1145,7 @@ async function submitService(notClose = false) { } async function submitProduct(notClose = false) { - formDataProduct.value.productGroupId = currentIdGrop.value; + formDataProduct.value.productGroupId = currentIdGroup.value; if (profileFileImg.value) { formDataProduct.value.image = profileFileImg.value; } @@ -1190,7 +1190,7 @@ async function submitGroup() { if (drawerInfo.value) { if (currentIdGropTree.value) await editProductGroup(currentIdGropTree.value, formDataGroup.value); - else await editProductGroup(currentIdGrop.value, formDataGroup.value); + else await editProductGroup(currentIdGroup.value, formDataGroup.value); } else { const res = await createProductGroup(formDataGroup.value); @@ -1316,7 +1316,7 @@ async function calculateStats(opt?: { }) { if (opt && opt.type === 'service' && productMode.value === 'service') { const resStatsService = await fetchStatsService({ - productGroupId: currentIdGrop.value, + productGroupId: currentIdGroup.value, }); stat.value[1].count = resStatsService ?? 0; return; @@ -1324,7 +1324,7 @@ async function calculateStats(opt?: { if (opt && opt.type === 'product' && productMode.value === 'product') { const resStatsProduct = await fetchStatsProduct({ - productGroupId: currentIdGrop.value, + productGroupId: currentIdGroup.value, }); stat.value[2].count = resStatsProduct ?? 0; return; @@ -1403,7 +1403,7 @@ async function enterGroup( expandedTree.value.push(id); pathGroupName.value = name; currentIdType.value = ''; - currentIdGrop.value = id; + currentIdGroup.value = id; currentNoAction.value = status === 'INACTIVE'; pathTypeName.value = name; @@ -1477,7 +1477,7 @@ onMounted(async () => { i18n: true, handler: () => { expandedTree.value = []; - currentIdGrop.value = ''; + currentIdGroup.value = ''; productMode.value = 'group'; }, }, @@ -1503,7 +1503,7 @@ watch( handler: () => { productMode.value = 'group'; expandedTree.value = []; - currentIdGrop.value = ''; + currentIdGroup.value = ''; currentIdType.value = ''; filterStat.value = []; }, @@ -1716,17 +1716,17 @@ watch( @select=" async (v: (typeof treeProductTypeAndGroup)[number]) => { if (v.type === 'group') { - if (currentIdGrop !== v.id) { + if (currentIdGroup !== v.id) { await enterGroup(v.id, v.name, v.status); return; } - if (currentIdGrop === v.id) { + if (currentIdGroup === v.id) { expandedTree = []; filterStat = []; expandedTree = expandedTree.filter((i) => v.id !== i); - currentIdGrop = ''; + currentIdGroup = ''; currentIdType = ''; productMode = 'group'; currentNoAction = false; @@ -2116,7 +2116,7 @@ watch( clearFormGroup(); await assignFormDataGroup(props.row); isEdit = false; - currentIdGrop = props.row.id; + currentIdGroup = props.row.id; drawerInfo = true; } } @@ -2136,7 +2136,7 @@ watch( clearFormGroup(); await assignFormDataGroup(props.row); isEdit = false; - currentIdGrop = props.row.id; + currentIdGroup = props.row.id; drawerInfo = true; } } @@ -2148,7 +2148,7 @@ watch( clearFormGroup(); await assignFormDataGroup(props.row); isEdit = true; - currentIdGrop = props.row.id; + currentIdGroup = props.row.id; drawerInfo = true; } @@ -2208,7 +2208,7 @@ watch( clearFormGroup(); await assignFormDataGroup(props.row); isEdit = false; - currentIdGrop = props.row.id; + currentIdGroup = props.row.id; drawerInfo = true; } } @@ -2219,7 +2219,7 @@ watch( clearFormGroup(); await assignFormDataGroup(props.row); isEdit = true; - currentIdGrop = props.row.id; + currentIdGroup = props.row.id; drawerInfo = true; } @@ -4023,7 +4023,7 @@ watch( dense @add-product=" async (index) => { - await fetchListOfProductIsAdd(currentIdGrop); + await fetchListOfProductIsAdd(currentIdGroup); currentWorkIndex = index; selectProduct = JSON.parse( JSON.stringify(workItems[currentWorkIndex].product), @@ -4419,7 +4419,7 @@ watch( :price-display="priceDisplay" @add-product=" async (index) => { - await fetchListOfProductIsAdd(currentIdGrop); + await fetchListOfProductIsAdd(currentIdGroup); currentWorkIndex = index; selectProduct = JSON.parse( JSON.stringify(workItems[currentWorkIndex].product), @@ -4496,7 +4496,7 @@ watch( clearFormGroup(); await assignFormDataGroup(currentNode); isEdit = false; - currentIdGrop = currentNode.id; + currentIdGroup = currentNode.id; drawerInfo = true; } } @@ -4523,7 +4523,7 @@ watch( clearFormGroup(); await assignFormDataGroup(currentNode); isEdit = true; - currentIdGrop = currentNode.id; + currentIdGroup = currentNode.id; drawerInfo = true; }