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 () => {
|
async () => {
|
||||||
await fetchList();
|
await fetchList();
|
||||||
customerBranchFormState.dialogModal = false;
|
customerBranchFormState.dialogModal = false;
|
||||||
|
customerBranchFormStore.resetForm();
|
||||||
flowStore.rotate();
|
flowStore.rotate();
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
|
|
|
||||||
|
|
@ -527,6 +527,11 @@ export const useCustomerBranchForm = defineStore('form-customer-branch', () => {
|
||||||
currentFormData.value = structuredClone(resetFormData);
|
currentFormData.value = structuredClone(resetFormData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resetForm() {
|
||||||
|
resetFormData = structuredClone(defaultFormData);
|
||||||
|
currentFormData.value = structuredClone(resetFormData);
|
||||||
|
}
|
||||||
|
|
||||||
function isFormDataDifferent() {
|
function isFormDataDifferent() {
|
||||||
return (
|
return (
|
||||||
JSON.stringify(resetFormData) !== JSON.stringify(currentFormData.value)
|
JSON.stringify(resetFormData) !== JSON.stringify(currentFormData.value)
|
||||||
|
|
@ -574,6 +579,7 @@ export const useCustomerBranchForm = defineStore('form-customer-branch', () => {
|
||||||
initForm,
|
initForm,
|
||||||
isFormDataDifferent,
|
isFormDataDifferent,
|
||||||
submitForm,
|
submitForm,
|
||||||
|
resetForm,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue