fix: function name

This commit is contained in:
Methapon Metanipat 2024-10-15 16:13:00 +07:00
parent 29998081d4
commit 8ce8c9a977
3 changed files with 29 additions and 24 deletions

View file

@ -71,10 +71,10 @@ const optionStore = useOptionStore();
const { const {
fetchStatsProductGroup, fetchStatsProductGroup,
fetchListProductService, fetchProductGroup,
createProductService, createProductGroup,
editProductService, editProductGroup,
deleteProductService, deleteProductGroup,
fetchStatsProduct, fetchStatsProduct,
fetchListProduct, fetchListProduct,
@ -561,7 +561,7 @@ async function fetchListOfOptionBranch() {
} }
async function fetchListGroups() { async function fetchListGroups() {
const res = await fetchListProductService({ const res = await fetchProductGroup({
page: currentPageGroup.value, page: currentPageGroup.value,
pageSize: pageSizeGroup.value, pageSize: pageSizeGroup.value,
query: !!inputSearch.value ? inputSearch.value : undefined, query: !!inputSearch.value ? inputSearch.value : undefined,
@ -688,7 +688,7 @@ async function toggleStatusService(id: string, status: Status) {
} }
async function toggleStatusGroup(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', status: status === 'INACTIVE' ? 'ACTIVE' : 'INACTIVE',
}); });
if (res) currentStatusGroupType.value = res.status; if (res) currentStatusGroupType.value = res.status;
@ -806,7 +806,7 @@ async function deleteProductById(productId?: string) {
if (editByTree.value !== undefined) { if (editByTree.value !== undefined) {
if (editByTree.value === 'group') { if (editByTree.value === 'group') {
// Product Group // Product Group
const res = await deleteProductService( const res = await deleteProductGroup(
productId ?? currentIdGrop.value, productId ?? currentIdGrop.value,
); );
if (res) { if (res) {
@ -821,7 +821,7 @@ async function deleteProductById(productId?: string) {
} else { } else {
if (productMode.value === 'group') { if (productMode.value === 'group') {
// Product Group // Product Group
const res = await deleteProductService( const res = await deleteProductGroup(
productId ?? currentIdGrop.value, productId ?? currentIdGrop.value,
); );
if (res) { if (res) {
@ -1154,10 +1154,10 @@ async function submitProduct(notClose = false) {
async function submitGroup() { async function submitGroup() {
if (drawerInfo.value) { if (drawerInfo.value) {
if (currentIdGropTree.value) if (currentIdGropTree.value)
await editProductService(currentIdGropTree.value, formDataGroup.value); await editProductGroup(currentIdGropTree.value, formDataGroup.value);
else await editProductService(currentIdGrop.value, formDataGroup.value); else await editProductGroup(currentIdGrop.value, formDataGroup.value);
} else { } else {
const res = await createProductService(formDataGroup.value); const res = await createProductGroup(formDataGroup.value);
if (res) { if (res) {
allStat.value[0].count = allStat.value[0].count + 1; allStat.value[0].count = allStat.value[0].count + 1;
@ -4152,7 +4152,12 @@ watch(
v-if="!infoServiceEdit" v-if="!infoServiceEdit"
id="btn-info-basic-edit" id="btn-info-basic-edit"
icon-only icon-only
@click="infoServiceEdit = true" @click="
() => {
infoServiceEdit = true;
serviceTreeView = false;
}
"
type="button" type="button"
/> />
<DeleteButton <DeleteButton
@ -4416,7 +4421,7 @@ watch(
const res = await productServiceStore.addImageList( const res = await productServiceStore.addImageList(
v, v,
dialogProductEdit ? currentIdProduct : currentIdService, dialogProductEdit ? currentIdProduct : currentIdService,
Date.now(), Date.now().toString(),
dialogProductEdit ? 'product' : 'service', dialogProductEdit ? 'product' : 'service',
); );
await fetchImageList( await fetchImageList(

View file

@ -208,7 +208,7 @@ const productServiceList = ref<
>([]); >([]);
async function assignToProductServiceList() { async function assignToProductServiceList() {
const ret = await productServiceStore.fetchListProductService({ const ret = await productServiceStore.fetchProductGroup({
page: 1, page: 1,
pageSize: 9999, pageSize: 9999,
}); });

View file

@ -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<ProductGroup>(`/product-group/${groupId}`); const res = await api.get<ProductGroup>(`/product-group/${groupId}`);
if (!res) return false; if (!res) return false;
@ -55,7 +55,7 @@ const useProductServiceStore = defineStore('api-product-service', () => {
} }
} }
async function fetchListProductService(opts?: { async function fetchProductGroup(opts?: {
page?: number; page?: number;
pageSize?: number; pageSize?: number;
query?: string; query?: string;
@ -86,7 +86,7 @@ const useProductServiceStore = defineStore('api-product-service', () => {
return false; return false;
} }
async function createProductService(data: ProductGroupCreate) { async function createProductGroup(data: ProductGroupCreate) {
const { code, ...payload } = data; const { code, ...payload } = data;
const res = await api.post<ProductGroupCreate>('/product-group', { const res = await api.post<ProductGroupCreate>('/product-group', {
@ -102,7 +102,7 @@ const useProductServiceStore = defineStore('api-product-service', () => {
return false; return false;
} }
async function editProductService( async function editProductGroup(
groupId: string, groupId: string,
data: Partial<ProductGroupUpdate>, data: Partial<ProductGroupUpdate>,
) { ) {
@ -121,7 +121,7 @@ const useProductServiceStore = defineStore('api-product-service', () => {
return false; return false;
} }
async function deleteProductService(groupId: string) { async function deleteProductGroup(groupId: string) {
const res = await api.delete(`/product-group/${groupId}`); const res = await api.delete(`/product-group/${groupId}`);
if (!res) return false; if (!res) return false;
@ -626,11 +626,11 @@ const useProductServiceStore = defineStore('api-product-service', () => {
workNameItems, workNameItems,
fetchStatsProductGroup, fetchStatsProductGroup,
fetchListProductServiceById, fetchProductGroupById,
fetchListProductService, fetchProductGroup,
createProductService, createProductGroup,
editProductService, editProductGroup,
deleteProductService, deleteProductGroup,
fetchStatsProduct, fetchStatsProduct,
fetchListProduct, fetchListProduct,