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 || '';
|
||||
resetFormData = structuredClone(defaultFormData);
|
||||
resetFormData.registeredBranchId = branchStore.currentMyBranch?.id || '';
|
||||
state.value.editCustomerId = '';
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -80,6 +81,10 @@ export const useCustomerForm = defineStore('form-customer', () => {
|
|||
resetFormData.registeredBranchId = branchStore.currentMyBranch?.id || '';
|
||||
}
|
||||
|
||||
if (state.value.dialogType === 'create') {
|
||||
state.value.editCustomerId = '';
|
||||
}
|
||||
|
||||
currentFormData.value = structuredClone(resetFormData);
|
||||
}
|
||||
|
||||
|
|
@ -103,6 +108,7 @@ export const useCustomerForm = defineStore('form-customer', () => {
|
|||
resetFormData.personName = data.personName;
|
||||
resetFormData.taxNo = data.taxNo;
|
||||
resetFormData.image = null;
|
||||
|
||||
resetFormData.customerBranch = data.branch.map((v) => ({
|
||||
id: v.id,
|
||||
code: v.code,
|
||||
|
|
@ -173,9 +179,13 @@ export const useCustomerForm = defineStore('form-customer', () => {
|
|||
|
||||
async function submitForm() {
|
||||
if (state.value.saveMode === 'customer') {
|
||||
await submitFormCustomer().then(() => {
|
||||
state.value.dialogModal = false;
|
||||
});
|
||||
const _data = await submitFormCustomer();
|
||||
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