From cfcb66a874ac7d78d0957698485abd55fc8cbbc0 Mon Sep 17 00:00:00 2001 From: oat_dev Date: Tue, 26 Mar 2024 16:21:55 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=97=E0=B8=B0=E0=B9=80=E0=B8=9A=E0=B8=B5?= =?UTF-8?q?=E0=B8=A2=E0=B8=99=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B8=A7=E0=B8=B1?= =?UTF-8?q?=E0=B8=95=E0=B8=B4:=20q-select=20=E0=B9=80=E0=B8=9E=E0=B8=B4?= =?UTF-8?q?=E0=B9=88=E0=B8=A1API=E0=B8=81=E0=B8=B1=E0=B8=9Afilter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GovernmentInformation/02_Discipline.vue | 1 + .../PersonalInformation/05_Education.vue | 67 ++++++++++++++++--- 2 files changed, 60 insertions(+), 8 deletions(-) diff --git a/src/modules/04_registryNew/components/detail/GovernmentInformation/02_Discipline.vue b/src/modules/04_registryNew/components/detail/GovernmentInformation/02_Discipline.vue index 52eea8817..974e81f78 100644 --- a/src/modules/04_registryNew/components/detail/GovernmentInformation/02_Discipline.vue +++ b/src/modules/04_registryNew/components/detail/GovernmentInformation/02_Discipline.vue @@ -673,6 +673,7 @@ onMounted(async () => { :options="Ops.levelOptions" option-value="id" use-input + clearable input-debounce="0" @filter="(inputValue:string, doneFn:Function) => filterSelector(inputValue, doneFn,'levelOptions' diff --git a/src/modules/04_registryNew/components/detail/PersonalInformation/05_Education.vue b/src/modules/04_registryNew/components/detail/PersonalInformation/05_Education.vue index 06d4d0512..63f7f0120 100644 --- a/src/modules/04_registryNew/components/detail/PersonalInformation/05_Education.vue +++ b/src/modules/04_registryNew/components/detail/PersonalInformation/05_Education.vue @@ -210,6 +210,13 @@ const educationOption = ref([ { label: "ไม่ใช่", value: false }, ]); +const educationOptionFilter = ref([ + { label: "ใช่", value: true }, + { label: "ไม่ใช่", value: false }, +]); + +let educationLevelOption: any = []; + const historyDialog = ref(false); const educationData = reactive({ isDate: isDate.value === "false" ? false : true, @@ -291,6 +298,20 @@ async function onSubmit() { ); } +function filterSelector(val: string, update: Function, refData: string) { + switch (refData) { + case "options": + update(() => { + educationOption.value = educationOptionFilter.value.filter( + (v: any) => v.label.indexOf(val) > -1 + ); + }); + break; + default: + break; + } +} + function clearForm() { isDate.value = "false"; educationData.educationLevel = ""; @@ -350,7 +371,23 @@ async function fetchData(id: string) { .get(config.API.profileNewEducationByProfileId(id)) .then(async (res) => { rows.value = res.data.result; - console.log(rows.value); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); +} + +async function fetchEducationLevel() { + showLoader(); + await http + .get(config.API.orgEducationLevel) + .then(async (res) => { + res.data.result.map((r: any) => { + educationLevelOption.push(r.name); + }); }) .catch((err) => { messageError($q, err); @@ -433,6 +470,7 @@ function deleteData(idData: string) { onMounted(async () => { await fetchData(id.value); + fetchEducationLevel(); }); @@ -619,7 +657,6 @@ onMounted(async () => {
- {{ console.log(props) }}
ระดับการศึกษา
{{ props.cols[0].value }}
สถานศึกษา
@@ -714,14 +751,22 @@ onMounted(async () => {
-
@@ -981,11 +1026,17 @@ onMounted(async () => { dense emit-value map-options + clearable bg-color="white" v-model="educationData.isEducation" :options="educationOption" option-value="value" option-label="label" + input-debounce="0" + use-input + @filter="(inputValue:string, + doneFn:Function) => filterSelector(inputValue, doneFn,'options' + ) " :rules="[ (val) => val !== null || `${'กรุณาเลือกวุฒิการศึกษาในตำแหน่ง'}`,