refactor: reset form
This commit is contained in:
parent
937f7cbad4
commit
1a1f2cb9f3
2 changed files with 7 additions and 0 deletions
|
|
@ -663,6 +663,7 @@ watch(
|
|||
async () => {
|
||||
await fetchList();
|
||||
customerBranchFormState.dialogModal = false;
|
||||
customerBranchFormStore.resetForm();
|
||||
flowStore.rotate();
|
||||
}
|
||||
"
|
||||
|
|
|
|||
|
|
@ -527,6 +527,11 @@ export const useCustomerBranchForm = defineStore('form-customer-branch', () => {
|
|||
currentFormData.value = structuredClone(resetFormData);
|
||||
}
|
||||
|
||||
function resetForm() {
|
||||
resetFormData = structuredClone(defaultFormData);
|
||||
currentFormData.value = structuredClone(resetFormData);
|
||||
}
|
||||
|
||||
function isFormDataDifferent() {
|
||||
return (
|
||||
JSON.stringify(resetFormData) !== JSON.stringify(currentFormData.value)
|
||||
|
|
@ -574,6 +579,7 @@ export const useCustomerBranchForm = defineStore('form-customer-branch', () => {
|
|||
initForm,
|
||||
isFormDataDifferent,
|
||||
submitForm,
|
||||
resetForm,
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue