refactor: citizen missig
This commit is contained in:
parent
aa823d68aa
commit
bad389f6be
3 changed files with 23 additions and 14 deletions
|
|
@ -40,6 +40,7 @@ import {
|
|||
} from './components';
|
||||
import { formatAddress } from 'src/utils/address';
|
||||
import PaginationPageSize from 'src/components/PaginationPageSize.vue';
|
||||
import { nextTick } from 'vue';
|
||||
|
||||
const flowStore = useFlowStore();
|
||||
const customerStore = useCustomerStore();
|
||||
|
|
@ -81,6 +82,7 @@ const prop = withDefaults(
|
|||
currentCustomerName?: string;
|
||||
customerType: CustomerType;
|
||||
countEmployee?: number;
|
||||
currentCitizenId?: string;
|
||||
gender: string;
|
||||
selectedImage: string;
|
||||
}>(),
|
||||
|
|
@ -103,6 +105,7 @@ defineEmits<{
|
|||
onMounted(async () => {
|
||||
const url = window.location.href;
|
||||
const parts = url.split('/');
|
||||
|
||||
customerBranchFormState.value.currentCustomerId = parts[4];
|
||||
|
||||
await fetchList();
|
||||
|
|
@ -213,6 +216,10 @@ async function fetchList() {
|
|||
function openEmployerBranchForm(formType: 'create' | 'edit' | 'info') {
|
||||
customerBranchFormState.value.dialogType = formType;
|
||||
customerBranchFormState.value.dialogModal = true;
|
||||
nextTick(() => {
|
||||
customerBranchFormState.value.customerType = prop.customerType;
|
||||
customerBranchFormData.value.citizenId = prop.currentCitizenId;
|
||||
});
|
||||
}
|
||||
|
||||
async function fetchEmployee(opts: { branchId: string; pageSize?: number }) {
|
||||
|
|
@ -871,24 +878,24 @@ watch(
|
|||
:readonly="customerBranchFormState.dialogType === 'info'"
|
||||
outlined
|
||||
:title="$t('form.address')"
|
||||
v-model:homeCode="customerBranchFormData.homeCode"
|
||||
v-model:employmentOffice="customerBranchFormData.employmentOffice"
|
||||
v-model:employmentOfficeEN="
|
||||
v-model:home-code="customerBranchFormData.homeCode"
|
||||
v-model:employment-office="customerBranchFormData.employmentOffice"
|
||||
v-model:employment-office-en="
|
||||
customerBranchFormData.employmentOfficeEN
|
||||
"
|
||||
v-model:address="customerBranchFormData.address"
|
||||
v-model:addressEN="customerBranchFormData.addressEN"
|
||||
v-model:address-en="customerBranchFormData.addressEN"
|
||||
v-model:province-id="customerBranchFormData.provinceId"
|
||||
v-model:district-id="customerBranchFormData.districtId"
|
||||
v-model:sub-district-id="customerBranchFormData.subDistrictId"
|
||||
v-model:street="customerBranchFormData.street"
|
||||
v-model:streetEN="customerBranchFormData.streetEN"
|
||||
v-model:street-en="customerBranchFormData.streetEN"
|
||||
v-model:moo="customerBranchFormData.moo"
|
||||
v-model:mooEN="customerBranchFormData.mooEN"
|
||||
v-model:moo-en="customerBranchFormData.mooEN"
|
||||
v-model:soi="customerBranchFormData.soi"
|
||||
v-model:soiEN="customerBranchFormData.soiEN"
|
||||
:addressTitle="$t('form.address')"
|
||||
:addressTitleEN="$t('form.address', { suffix: '(EN)' })"
|
||||
v-model:soi-en="customerBranchFormData.soiEN"
|
||||
:address-title="$t('form.address')"
|
||||
:address-title-en="$t('form.address', { suffix: '(EN)' })"
|
||||
/>
|
||||
<div class="row q-col-gutter-sm q-mb-sm" id="employer-branch-contact">
|
||||
<div class="col-12 text-weight-bold text-body1 row items-center">
|
||||
|
|
|
|||
|
|
@ -1826,6 +1826,7 @@ const emptyCreateDialog = ref(false);
|
|||
? currentCustomer.branch[0]?.registerNameEN
|
||||
: currentCustomer.branch[0]?.registerName
|
||||
"
|
||||
:current-citizen-id="currentCustomer.branch[0]?.citizenId"
|
||||
:count-employee="currentCustomer._count.employee"
|
||||
:selected-image="currentCustomer.selectedImage"
|
||||
:gender="currentCustomer.branch[0]?.gender"
|
||||
|
|
|
|||
|
|
@ -443,15 +443,16 @@ export const useCustomerBranchForm = defineStore('form-customer-branch', () => {
|
|||
|
||||
let resetFormData = structuredClone(defaultFormData);
|
||||
|
||||
const currentFormData = ref<CustomerBranchCreate & { id?: string }>(
|
||||
structuredClone(defaultFormData),
|
||||
);
|
||||
const currentFormData = ref<
|
||||
CustomerBranchCreate & { id?: string; codeCustomer?: string }
|
||||
>(structuredClone(defaultFormData));
|
||||
|
||||
const state = ref<{
|
||||
dialogType: 'info' | 'create' | 'edit';
|
||||
dialogOpen: boolean;
|
||||
dialogModal: boolean;
|
||||
currentCustomerId: string;
|
||||
customerType?: 'CORP' | 'PERS';
|
||||
}>({
|
||||
dialogType: 'info',
|
||||
dialogOpen: false,
|
||||
|
|
@ -474,7 +475,6 @@ export const useCustomerBranchForm = defineStore('form-customer-branch', () => {
|
|||
resetFormData = {
|
||||
id: _data.id,
|
||||
code: _data.code,
|
||||
customerCode: '',
|
||||
provinceId: _data.provinceId,
|
||||
districtId: _data.districtId,
|
||||
subDistrictId: _data.subDistrictId,
|
||||
|
|
@ -558,7 +558,8 @@ export const useCustomerBranchForm = defineStore('form-customer-branch', () => {
|
|||
const res = await customerStore.createBranch({
|
||||
...currentFormData.value,
|
||||
citizenId:
|
||||
customerFormStore.currentFormData.customerType === 'CORP'
|
||||
(state.value.customerType ||
|
||||
customerFormStore.currentFormData.customerType) === 'CORP'
|
||||
? undefined
|
||||
: currentFormData.value.citizenId,
|
||||
customerId: state.value.currentCustomerId,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue