diff --git a/src/modules/03_recruiting/views/03_editor/index.vue b/src/modules/03_recruiting/views/03_editor/index.vue index 861574658..bfe9a11b6 100644 --- a/src/modules/03_recruiting/views/03_editor/index.vue +++ b/src/modules/03_recruiting/views/03_editor/index.vue @@ -59,8 +59,11 @@ const qeditor = ref(""); const title = ref(""); const filter = ref(""); //search data table const filterAgency = ref(""); //search data table +const provinceOptionsMain = ref([]); const provinceOptions = ref([]); +const districtOptionsMain = ref([]); const districtOptions = ref([]); +const subdistrictOptionsMain = ref([]); const subdistrictOptions = ref([]); const cmsGoverment = ref([]); const cmsAgency = ref([]); @@ -570,6 +573,7 @@ async function fetchProvince() { option.push({ id: r.id.toString(), name: r.name.toString() }); }); provinceOptions.value = option; + provinceOptionsMain.value = option; }) .catch((e: any) => { messageError($q, e); @@ -595,6 +599,7 @@ async function fetchDistrict(id: string | null) { option.push({ id: r.id.toString(), name: r.name.toString() }); }); districtOptions.value = option; + districtOptionsMain.value = option; }) .catch((e: any) => { messageError($q, e); @@ -625,6 +630,7 @@ async function fetchSubDistrict(id: string | null) { }); }); subdistrictOptions.value = option; + subdistrictOptionsMain.value = option; }) .catch((e: any) => { messageError($q, e); @@ -737,6 +743,33 @@ function getClass(val: boolean) { }; } +function filterSelector(val: string, update: Function, refData: string) { + switch (refData) { + case "province": + update(() => { + provinceOptions.value = provinceOptionsMain.value.filter( + (v: DataOption) => v.name.indexOf(val) > -1 + ); + }); + break; + case "district": + update(() => { + districtOptions.value = districtOptionsMain.value.filter( + (v: DataOption) => v.name.indexOf(val) > -1 + ); + }); + break; + case "subdistrict": + update(() => { + subdistrictOptions.value = subdistrictOptionsMain.value.filter( + (v: zipCodeOption) => v.name.indexOf(val) > -1 + ); + }); + default: + break; + } +} + onMounted(async () => { await fetchData(); await fetchProvince(); @@ -1017,8 +1050,22 @@ onMounted(async () => { :options="provinceOptions" option-value="id" :label="`${'จังหวัด'}`" - @update:model-value="(value:any) => selectProvince(value)" - /> + use-input + hide-selected + fill-input + @update:model-value="(value:string) => selectProvince(value)" + @filter="(inputValue: string, + doneFn: Function) => filterSelector(inputValue, doneFn, 'province' + )" + > + +
{ :options="districtOptions" option-value="id" :label="`${'เขต / อำเภอ'}`" - @update:model-value="(value:any) => selectDistrict(value)" - /> + use-input + hide-selected + fill-input + @update:model-value="(value:string) => selectDistrict(value)" + @filter="(inputValue: string, + doneFn: Function) => filterSelector(inputValue, doneFn, 'district' + )" + > + +
{ option-label="name" :options="subdistrictOptions" option-value="id" - :label="`${'แขวง/ตำบล '}`" - @update:model-value="(value:any) => selectSubDistrict(value)" - /> + :label="`${'แขวง/ตำบล'}`" + use-input + hide-selected + fill-input + @update:model-value="(value:string) => selectSubDistrict(value)" + @filter="(inputValue: string, + doneFn: Function) => filterSelector(inputValue, doneFn, 'subdistrict' + )" + > +