fix(04): group tree action

This commit is contained in:
puriphatt 2024-08-21 11:00:46 +07:00
parent 3c30d70246
commit 2da804f17e

View file

@ -466,6 +466,7 @@ const currentIdGrop = ref<string>('');
const currentIdType = ref<string>(''); const currentIdType = ref<string>('');
const currentIdService = ref<string>(''); const currentIdService = ref<string>('');
const currentIdProduct = ref<string>(''); const currentIdProduct = ref<string>('');
const currentIdGropTree = ref<string>('');
const currentStatusGroupType = ref<Status>('CREATED'); const currentStatusGroupType = ref<Status>('CREATED');
const currentIdGroupType = ref(''); const currentIdGroupType = ref('');
@ -1144,7 +1145,9 @@ async function submitProduct() {
async function submitGroup() { async function submitGroup() {
if (drawerInfo.value) { 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 { } else {
const res = await createProductService(formDataGroup.value); const res = await createProductService(formDataGroup.value);
@ -1153,6 +1156,7 @@ async function submitGroup() {
} }
} }
currentIdGropTree.value = '';
drawerInfo.value = false; drawerInfo.value = false;
await fetchListGroups(); await fetchListGroups();
clearFormGroup(); clearFormGroup();
@ -1587,7 +1591,7 @@ watch(
clearFormGroup(); clearFormGroup();
assignFormDataGroup(v); assignFormDataGroup(v);
isEdit = false; isEdit = false;
currentIdGrop = v.id; currentIdGropTree = v.id;
drawerInfo = true; drawerInfo = true;
} }
} }
@ -1606,8 +1610,7 @@ watch(
clearFormGroup(); clearFormGroup();
assignFormDataGroup(v); assignFormDataGroup(v);
isEdit = true; isEdit = true;
currentIdGrop = v.id; currentIdGropTree = v.id;
drawerInfo = true; drawerInfo = true;
} }
} }