fix: reset edit id still not reset
This commit is contained in:
parent
a86bcf4786
commit
7c3a3d6a99
1 changed files with 13 additions and 3 deletions
|
|
@ -73,6 +73,7 @@ export const useCustomerForm = defineStore('form-customer', () => {
|
||||||
branchStore.currentMyBranch?.id || '';
|
branchStore.currentMyBranch?.id || '';
|
||||||
resetFormData = structuredClone(defaultFormData);
|
resetFormData = structuredClone(defaultFormData);
|
||||||
resetFormData.registeredBranchId = branchStore.currentMyBranch?.id || '';
|
resetFormData.registeredBranchId = branchStore.currentMyBranch?.id || '';
|
||||||
|
state.value.editCustomerId = '';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -80,6 +81,10 @@ export const useCustomerForm = defineStore('form-customer', () => {
|
||||||
resetFormData.registeredBranchId = branchStore.currentMyBranch?.id || '';
|
resetFormData.registeredBranchId = branchStore.currentMyBranch?.id || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (state.value.dialogType === 'create') {
|
||||||
|
state.value.editCustomerId = '';
|
||||||
|
}
|
||||||
|
|
||||||
currentFormData.value = structuredClone(resetFormData);
|
currentFormData.value = structuredClone(resetFormData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -103,6 +108,7 @@ export const useCustomerForm = defineStore('form-customer', () => {
|
||||||
resetFormData.personName = data.personName;
|
resetFormData.personName = data.personName;
|
||||||
resetFormData.taxNo = data.taxNo;
|
resetFormData.taxNo = data.taxNo;
|
||||||
resetFormData.image = null;
|
resetFormData.image = null;
|
||||||
|
|
||||||
resetFormData.customerBranch = data.branch.map((v) => ({
|
resetFormData.customerBranch = data.branch.map((v) => ({
|
||||||
id: v.id,
|
id: v.id,
|
||||||
code: v.code,
|
code: v.code,
|
||||||
|
|
@ -173,9 +179,13 @@ export const useCustomerForm = defineStore('form-customer', () => {
|
||||||
|
|
||||||
async function submitForm() {
|
async function submitForm() {
|
||||||
if (state.value.saveMode === 'customer') {
|
if (state.value.saveMode === 'customer') {
|
||||||
await submitFormCustomer().then(() => {
|
const _data = await submitFormCustomer();
|
||||||
state.value.dialogModal = false;
|
if (_data) {
|
||||||
});
|
await assignFormData(_data.id);
|
||||||
|
state.value.dialogType = 'edit';
|
||||||
|
state.value.editReadonly = true;
|
||||||
|
state.value.editCustomerId = _data.id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue