diff --git a/src/pages/04_product-service/MainPage.vue b/src/pages/04_product-service/MainPage.vue index 7ebe8400..b54cab1f 100644 --- a/src/pages/04_product-service/MainPage.vue +++ b/src/pages/04_product-service/MainPage.vue @@ -71,10 +71,10 @@ const optionStore = useOptionStore(); const { fetchStatsProductGroup, - fetchListProductService, - createProductService, - editProductService, - deleteProductService, + fetchProductGroup, + createProductGroup, + editProductGroup, + deleteProductGroup, fetchStatsProduct, fetchListProduct, @@ -561,7 +561,7 @@ async function fetchListOfOptionBranch() { } async function fetchListGroups() { - const res = await fetchListProductService({ + const res = await fetchProductGroup({ page: currentPageGroup.value, pageSize: pageSizeGroup.value, query: !!inputSearch.value ? inputSearch.value : undefined, @@ -688,7 +688,7 @@ async function toggleStatusService(id: string, status: Status) { } async function toggleStatusGroup(id: string, status: Status) { - const res = await editProductService(id, { + const res = await editProductGroup(id, { status: status === 'INACTIVE' ? 'ACTIVE' : 'INACTIVE', }); if (res) currentStatusGroupType.value = res.status; @@ -806,7 +806,7 @@ async function deleteProductById(productId?: string) { if (editByTree.value !== undefined) { if (editByTree.value === 'group') { // Product Group - const res = await deleteProductService( + const res = await deleteProductGroup( productId ?? currentIdGrop.value, ); if (res) { @@ -821,7 +821,7 @@ async function deleteProductById(productId?: string) { } else { if (productMode.value === 'group') { // Product Group - const res = await deleteProductService( + const res = await deleteProductGroup( productId ?? currentIdGrop.value, ); if (res) { @@ -1154,10 +1154,10 @@ async function submitProduct(notClose = false) { async function submitGroup() { if (drawerInfo.value) { if (currentIdGropTree.value) - await editProductService(currentIdGropTree.value, formDataGroup.value); - else await editProductService(currentIdGrop.value, formDataGroup.value); + await editProductGroup(currentIdGropTree.value, formDataGroup.value); + else await editProductGroup(currentIdGrop.value, formDataGroup.value); } else { - const res = await createProductService(formDataGroup.value); + const res = await createProductGroup(formDataGroup.value); if (res) { allStat.value[0].count = allStat.value[0].count + 1; @@ -4152,7 +4152,12 @@ watch( v-if="!infoServiceEdit" id="btn-info-basic-edit" icon-only - @click="infoServiceEdit = true" + @click=" + () => { + infoServiceEdit = true; + serviceTreeView = false; + } + " type="button" /> ([]); async function assignToProductServiceList() { - const ret = await productServiceStore.fetchListProductService({ + const ret = await productServiceStore.fetchProductGroup({ page: 1, pageSize: 9999, }); diff --git a/src/stores/product-service/index.ts b/src/stores/product-service/index.ts index 64593eba..133dab72 100644 --- a/src/stores/product-service/index.ts +++ b/src/stores/product-service/index.ts @@ -45,7 +45,7 @@ const useProductServiceStore = defineStore('api-product-service', () => { } } - async function fetchListProductServiceById(groupId: string) { + async function fetchProductGroupById(groupId: string) { const res = await api.get(`/product-group/${groupId}`); if (!res) return false; @@ -55,7 +55,7 @@ const useProductServiceStore = defineStore('api-product-service', () => { } } - async function fetchListProductService(opts?: { + async function fetchProductGroup(opts?: { page?: number; pageSize?: number; query?: string; @@ -86,7 +86,7 @@ const useProductServiceStore = defineStore('api-product-service', () => { return false; } - async function createProductService(data: ProductGroupCreate) { + async function createProductGroup(data: ProductGroupCreate) { const { code, ...payload } = data; const res = await api.post('/product-group', { @@ -102,7 +102,7 @@ const useProductServiceStore = defineStore('api-product-service', () => { return false; } - async function editProductService( + async function editProductGroup( groupId: string, data: Partial, ) { @@ -121,7 +121,7 @@ const useProductServiceStore = defineStore('api-product-service', () => { return false; } - async function deleteProductService(groupId: string) { + async function deleteProductGroup(groupId: string) { const res = await api.delete(`/product-group/${groupId}`); if (!res) return false; @@ -626,11 +626,11 @@ const useProductServiceStore = defineStore('api-product-service', () => { workNameItems, fetchStatsProductGroup, - fetchListProductServiceById, - fetchListProductService, - createProductService, - editProductService, - deleteProductService, + fetchProductGroupById, + fetchProductGroup, + createProductGroup, + editProductGroup, + deleteProductGroup, fetchStatsProduct, fetchListProduct,