refactor: make control from outside
This commit is contained in:
parent
dc578316af
commit
6454f8ebe1
1 changed files with 6 additions and 5 deletions
|
|
@ -1,6 +1,9 @@
|
|||
import { ref, toRaw, watch } from 'vue';
|
||||
import { defineStore } from 'pinia';
|
||||
import { CustomerCreate } from 'src/stores/customer/types';
|
||||
import {
|
||||
CustomerBranchCreate,
|
||||
CustomerCreate,
|
||||
} from 'src/stores/customer/types';
|
||||
import { Employee, EmployeeCreate } from 'src/stores/employee/types';
|
||||
|
||||
import useMyBranch from 'src/stores/my-branch';
|
||||
|
|
@ -66,7 +69,6 @@ export const useCustomerForm = defineStore('form-customer', () => {
|
|||
|
||||
function resetForm(clean = false) {
|
||||
state.value.branchIndex = -1;
|
||||
state.value.readonly = true;
|
||||
if (clean) {
|
||||
defaultFormData.customerType = currentFormData.value.customerType;
|
||||
currentFormData.value = structuredClone(defaultFormData);
|
||||
|
|
@ -85,14 +87,13 @@ export const useCustomerForm = defineStore('form-customer', () => {
|
|||
if (state.value.dialogType === 'create') {
|
||||
state.value.editCustomerId = '';
|
||||
}
|
||||
if (state.value.dialogType === 'edit') {
|
||||
state.value.dialogType = 'info';
|
||||
}
|
||||
|
||||
currentFormData.value = structuredClone(resetFormData);
|
||||
}
|
||||
|
||||
async function assignFormData(id?: string) {
|
||||
state.value.readonly = true;
|
||||
|
||||
if (!id) {
|
||||
resetFormData = structuredClone(defaultFormData);
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue