fix: แก้ id ซ้ำกัน

This commit is contained in:
Net 2024-06-17 12:57:57 +07:00
parent 555ece125c
commit ad18731a8c
2 changed files with 17 additions and 10 deletions

View file

@ -16,6 +16,7 @@ defineProps<{
separator?: boolean; separator?: boolean;
employee?: boolean; employee?: boolean;
disabledRule?: boolean; disabledRule?: boolean;
id?: number;
}>(); }>();
const adrressStore = useAddressStore(); const adrressStore = useAddressStore();
@ -115,7 +116,7 @@ watch(districtId, fetchSubDistrict);
</div> </div>
<div class="col-9 row q-col-gutter-md"> <div class="col-9 row q-col-gutter-md">
<q-input <q-input
for="input-address" :for="`${id !== undefined ? `input-address-${id}` : 'input-address'}`"
:dense="dense" :dense="dense"
:outlined="readonly ? false : outlined" :outlined="readonly ? false : outlined"
:readonly="readonly || sameWithEmployer" :readonly="readonly || sameWithEmployer"
@ -136,7 +137,7 @@ watch(districtId, fetchSubDistrict);
" "
/> />
<q-select <q-select
id="select-province" :id="`${id ? `select-province-${id}` : 'select-province'}`"
:dense="dense" :dense="dense"
:readonly="readonly || sameWithEmployer" :readonly="readonly || sameWithEmployer"
:outlined="readonly ? false : outlined" :outlined="readonly ? false : outlined"
@ -163,8 +164,9 @@ watch(districtId, fetchSubDistrict);
" "
@update:model-value="districtId = subDistrictId = zipCode = null" @update:model-value="districtId = subDistrictId = zipCode = null"
/> />
<q-select <q-select
id="select-district" :id="`${id ? `select-district-${id}` : 'select-district'}`"
:dense="dense" :dense="dense"
:readonly="readonly || sameWithEmployer" :readonly="readonly || sameWithEmployer"
:outlined="readonly ? false : outlined" :outlined="readonly ? false : outlined"
@ -192,7 +194,7 @@ watch(districtId, fetchSubDistrict);
@update:model-value="subDistrictId = zipCode = null" @update:model-value="subDistrictId = zipCode = null"
/> />
<q-select <q-select
id="select-sub-district" :id="`${id ? `select-sub-district-${id}` : 'select-sub-district'}`"
:dense="dense" :dense="dense"
:readonly="readonly || sameWithEmployer" :readonly="readonly || sameWithEmployer"
:outlined="readonly ? false : outlined" :outlined="readonly ? false : outlined"
@ -220,7 +222,7 @@ watch(districtId, fetchSubDistrict);
@update:model-value="(v: string) => selectSubDistrict(v)" @update:model-value="(v: string) => selectSubDistrict(v)"
/> />
<q-input <q-input
for="input-zip-code" :for="`${id ? `input-zip-code-${id}` : 'input-zip-code'}`"
:dense="dense" :dense="dense"
:outlined="readonly ? false : outlined" :outlined="readonly ? false : outlined"
:borderless="readonly" :borderless="readonly"
@ -235,7 +237,7 @@ watch(districtId, fetchSubDistrict);
</div> </div>
<div class="col-9 row q-col-gutter-md"> <div class="col-9 row q-col-gutter-md">
<q-input <q-input
for="input-address-en" :for="`${id ? `input-address-en-${id}` : 'input-address-en'}`"
:dense="dense" :dense="dense"
:readonly="readonly || sameWithEmployer" :readonly="readonly || sameWithEmployer"
:outlined="readonly ? false : outlined" :outlined="readonly ? false : outlined"
@ -256,7 +258,7 @@ watch(districtId, fetchSubDistrict);
" "
/> />
<q-select <q-select
id="select-province-en" :id="`${id ? `select-province-en-${id}` : 'select-province-en'}`"
hide-bottom-space hide-bottom-space
:dense="dense" :dense="dense"
:readonly="readonly || sameWithEmployer" :readonly="readonly || sameWithEmployer"
@ -284,7 +286,7 @@ watch(districtId, fetchSubDistrict);
@update:model-value="districtId = subDistrictId = zipCode = null" @update:model-value="districtId = subDistrictId = zipCode = null"
/> />
<q-select <q-select
id="select-district-en" :id="`${id ? `select-district-en-${id}` : 'select-district-en'}`"
hide-bottom-space hide-bottom-space
:dense="dense" :dense="dense"
:readonly="readonly || sameWithEmployer" :readonly="readonly || sameWithEmployer"
@ -312,7 +314,7 @@ watch(districtId, fetchSubDistrict);
@update:model-value="subDistrictId = zipCode = null" @update:model-value="subDistrictId = zipCode = null"
/> />
<q-select <q-select
id="select-sub-district-en" :id="`${id ? `select-sub-district-en-${id}` : 'select-sub-district-en'}`"
hide-bottom-space hide-bottom-space
:dense="dense" :dense="dense"
:readonly="readonly || sameWithEmployer" :readonly="readonly || sameWithEmployer"
@ -341,7 +343,7 @@ watch(districtId, fetchSubDistrict);
/> />
<q-input <q-input
hide-bottom-space hide-bottom-space
for="input-zip-code" :for="`${id ? `input-zip-code-${id}` : 'input-zip-code'}`"
:dense="dense" :dense="dense"
:outlined="readonly ? false : outlined" :outlined="readonly ? false : outlined"
:borderless="readonly" :borderless="readonly"

View file

@ -1667,6 +1667,7 @@ watch(currentStatus, async () => {
> >
<template #address> <template #address>
<FormAddress <FormAddress
:id="indexTab"
v-if=" v-if="
indexTab !== undefined && formData.customerBranch?.[indexTab] indexTab !== undefined && formData.customerBranch?.[indexTab]
" "
@ -1944,6 +1945,7 @@ watch(currentStatus, async () => {
> >
<template #address> <template #address>
<FormAddress <FormAddress
:id="indexTab"
v-if=" v-if="
indexTab !== undefined && formData.customerBranch?.[indexTab] indexTab !== undefined && formData.customerBranch?.[indexTab]
" "
@ -2070,6 +2072,7 @@ watch(currentStatus, async () => {
> >
<template #address> <template #address>
<FormAddress <FormAddress
:id="indexTab"
v-if=" v-if="
indexTab !== undefined && formData.customerBranch?.[indexTab] indexTab !== undefined && formData.customerBranch?.[indexTab]
" "
@ -2241,6 +2244,7 @@ watch(currentStatus, async () => {
> >
<template #address> <template #address>
<FormAddress <FormAddress
:id="indexTab"
v-if=" v-if="
indexTab !== undefined && indexTab !== undefined &&
formData.customerBranch?.[indexTab] formData.customerBranch?.[indexTab]
@ -2431,6 +2435,7 @@ watch(currentStatus, async () => {
> >
<template #address> <template #address>
<FormAddress <FormAddress
:id="indexTab"
v-if=" v-if="
indexTab !== undefined && indexTab !== undefined &&
formData.customerBranch?.[indexTab] formData.customerBranch?.[indexTab]