ทะเบียนประวัติ: แก้ q-selectให้พิมพ์ค้นได้

This commit is contained in:
oat_dev 2024-03-27 11:13:20 +07:00
parent a0bc93b208
commit 954321ab9c

View file

@ -215,7 +215,8 @@ const educationOptionFilter = ref([
{ label: "ไม่ใช่", value: false }, { label: "ไม่ใช่", value: false },
]); ]);
let educationLevelOption: any = []; const educationLevelOption = ref([]);
const educationLevelOptionFilter = ref([]);
const historyDialog = ref<boolean>(false); const historyDialog = ref<boolean>(false);
const educationData = reactive<RequestItemsObject>({ const educationData = reactive<RequestItemsObject>({
@ -300,13 +301,20 @@ async function onSubmit() {
function filterSelector(val: string, update: Function, refData: string) { function filterSelector(val: string, update: Function, refData: string) {
switch (refData) { switch (refData) {
case "options": case "educationOption":
update(() => { update(() => {
educationOption.value = educationOptionFilter.value.filter( educationOption.value = educationOptionFilter.value.filter(
(v: any) => v.label.indexOf(val) > -1 (v: any) => v.label.indexOf(val) > -1
); );
}); });
break; break;
case "educationLevelOption":
update(() => {
educationLevelOption.value = educationLevelOptionFilter.value.filter(
(v: any) => v.label.indexOf(val) > -1
);
});
break;
default: default:
break; break;
} }
@ -386,8 +394,13 @@ async function fetchEducationLevel() {
.get(config.API.orgEducationLevel) .get(config.API.orgEducationLevel)
.then(async (res) => { .then(async (res) => {
res.data.result.map((r: any) => { res.data.result.map((r: any) => {
educationLevelOption.push(r.name); educationLevelOption.value.push({
value: r.id,
label: r.name,
});
}); });
educationLevelOptionFilter.value = educationLevelOption.value;
console.log(educationLevelOptionFilter.value);
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -755,6 +768,8 @@ onMounted(async () => {
outlined outlined
dense dense
emit-value emit-value
option-value="label"
option-label="label"
map-options map-options
bg-color="white" bg-color="white"
v-model="educationData.educationLevel" v-model="educationData.educationLevel"
@ -762,7 +777,7 @@ onMounted(async () => {
input-debounce="0" input-debounce="0"
use-input use-input
@filter="(inputValue:string, @filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'options' doneFn:Function) => filterSelector(inputValue, doneFn,'educationLevelOption'
) " ) "
:rules="[(val) => !!val || `${'กรุณาเลือกระดับการศึกษา'}`]" :rules="[(val) => !!val || `${'กรุณาเลือกระดับการศึกษา'}`]"
label="ระดับการศึกษา" label="ระดับการศึกษา"
@ -1030,12 +1045,12 @@ onMounted(async () => {
bg-color="white" bg-color="white"
v-model="educationData.isEducation" v-model="educationData.isEducation"
:options="educationOption" :options="educationOption"
option-value="value" option-value="label"
option-label="label" option-label="label"
input-debounce="0" input-debounce="0"
use-input use-input
@filter="(inputValue:string, @filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'options' doneFn:Function) => filterSelector(inputValue, doneFn,'educationOption'
) " ) "
:rules="[ :rules="[
(val) => (val) =>