fix: selected first branch wrong
This commit is contained in:
parent
4fcf39adb7
commit
e95078e75e
2 changed files with 4 additions and 13 deletions
|
|
@ -100,6 +100,7 @@ const telephoneNo = defineModel<string>('telephoneNo', { default: '' });
|
||||||
:for="`${prefixId}-input-source-registered-branch`"
|
:for="`${prefixId}-input-source-registered-branch`"
|
||||||
v-model:value="registeredBranchId"
|
v-model:value="registeredBranchId"
|
||||||
:label="$t('customer.form.registeredBranch')"
|
:label="$t('customer.form.registeredBranch')"
|
||||||
|
select-first-value
|
||||||
class="col-md-6"
|
class="col-md-6"
|
||||||
simple
|
simple
|
||||||
required
|
required
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { ref, toRaw, watch } from 'vue';
|
import { ref, watch } from 'vue';
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import {
|
import {
|
||||||
CustomerBranchCreate,
|
CustomerBranchCreate,
|
||||||
|
|
@ -6,7 +6,6 @@ import {
|
||||||
CustomerType,
|
CustomerType,
|
||||||
} from 'stores/customer/types';
|
} from 'stores/customer/types';
|
||||||
import { Employee, EmployeeCreate } from 'stores/employee/types';
|
import { Employee, EmployeeCreate } from 'stores/employee/types';
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
|
|
||||||
import useMyBranch from 'stores/my-branch';
|
import useMyBranch from 'stores/my-branch';
|
||||||
import useCustomerStore from 'stores/customer';
|
import useCustomerStore from 'stores/customer';
|
||||||
|
|
@ -16,10 +15,7 @@ import useFlowStore from 'stores/flow';
|
||||||
import { baseUrl } from 'src/stores/utils';
|
import { baseUrl } from 'src/stores/utils';
|
||||||
|
|
||||||
export const useCustomerForm = defineStore('form-customer', () => {
|
export const useCustomerForm = defineStore('form-customer', () => {
|
||||||
const { t } = useI18n();
|
|
||||||
|
|
||||||
const customerStore = useCustomerStore();
|
const customerStore = useCustomerStore();
|
||||||
const branchStore = useMyBranch();
|
|
||||||
|
|
||||||
const defaultFormData: CustomerCreate = {
|
const defaultFormData: CustomerCreate = {
|
||||||
// code: '',
|
// code: '',
|
||||||
|
|
@ -34,7 +30,7 @@ export const useCustomerForm = defineStore('form-customer', () => {
|
||||||
selectedImage: '',
|
selectedImage: '',
|
||||||
status: 'CREATED',
|
status: 'CREATED',
|
||||||
customerType: CustomerType.Corporate,
|
customerType: CustomerType.Corporate,
|
||||||
registeredBranchId: branchStore.currentMyBranch?.id || '',
|
registeredBranchId: '',
|
||||||
image: null,
|
image: null,
|
||||||
};
|
};
|
||||||
let resetFormData = structuredClone(defaultFormData);
|
let resetFormData = structuredClone(defaultFormData);
|
||||||
|
|
@ -103,20 +99,14 @@ export const useCustomerForm = defineStore('form-customer', () => {
|
||||||
if (clean) {
|
if (clean) {
|
||||||
defaultFormData.customerType = currentFormData.value.customerType;
|
defaultFormData.customerType = currentFormData.value.customerType;
|
||||||
currentFormData.value = structuredClone(defaultFormData);
|
currentFormData.value = structuredClone(defaultFormData);
|
||||||
currentFormData.value.registeredBranchId =
|
|
||||||
branchStore.currentMyBranch?.id || '';
|
|
||||||
resetFormData = structuredClone(defaultFormData);
|
resetFormData = structuredClone(defaultFormData);
|
||||||
resetFormData.registeredBranchId = branchStore.currentMyBranch?.id || '';
|
resetFormData.registeredBranchId = '';
|
||||||
state.value.editCustomerId = '';
|
state.value.editCustomerId = '';
|
||||||
state.value.treeFile = [];
|
state.value.treeFile = [];
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!resetFormData.registeredBranchId) {
|
|
||||||
resetFormData.registeredBranchId = branchStore.currentMyBranch?.id || '';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state.value.dialogType === 'create') {
|
if (state.value.dialogType === 'create') {
|
||||||
state.value.editCustomerId = '';
|
state.value.editCustomerId = '';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue