ทะเบียนประวัติ: ปรับโค้ด+แก้บัค

This commit is contained in:
oat_dev 2024-03-28 14:22:43 +07:00
parent a8018dc6a9
commit 8269eb8e3c
2 changed files with 6 additions and 21 deletions

View file

@ -21,6 +21,7 @@ const {
} = mixin; } = mixin;
const store = useProfileDataStore(); const store = useProfileDataStore();
const { fetchPerson, filterSelector } = store;
const route = useRoute(); const route = useRoute();
const id = ref<string>(route.params.id.toString()); const id = ref<string>(route.params.id.toString());
const dialog = ref<boolean>(false); const dialog = ref<boolean>(false);
@ -121,7 +122,6 @@ async function fetchHistoryData(id: string) {
await http await http
.get(config.API.profileNewFamilyHisByFamilyId(id)) .get(config.API.profileNewFamilyHisByFamilyId(id))
.then(async (res) => { .then(async (res) => {
console.log(res.data.result);
historyRows.value = res.data.result; historyRows.value = res.data.result;
}) })
.catch((err) => { .catch((err) => {
@ -243,23 +243,8 @@ onMounted(async () => {
) { ) {
await fetchPerson(); await fetchPerson();
} }
prefixFilter.value = store.Ops.prefixOps;
await fetchData(id.value); await fetchData(id.value);
}); });
function filterSelector(val: string, update: Function, refData: string) {
switch (refData) {
case "prefixOps":
update(() => {
store.Ops.prefixOps = prefixFilter.value.filter(
(v: any) => v.name.indexOf(val) > -1
);
});
break;
default:
break;
}
}
</script> </script>
<template> <template>
@ -800,9 +785,9 @@ function filterSelector(val: string, update: Function, refData: string) {
:options="store.Ops.prefixOps" :options="store.Ops.prefixOps"
option-label="name" option-label="name"
option-value="name" option-value="name"
@filter="(inputValue:string, @filter="(inputValue: any,
doneFn:Function) => filterSelector(inputValue, doneFn,'prefixOps' doneFn: Function) => filterSelector(inputValue, doneFn, 'prefixOps'
) " )"
/> />
</div> </div>
<div class="col"> <div class="col">

View file

@ -215,7 +215,7 @@ const educationOptionFilter = ref([
{ label: "ไม่ใช่", value: false }, { label: "ไม่ใช่", value: false },
]); ]);
const educationLevelOption = ref([]); const educationLevelOption = ref<any>([]);
const educationLevelOptionFilter = ref([]); const educationLevelOptionFilter = ref([]);
const historyDialog = ref<boolean>(false); const historyDialog = ref<boolean>(false);
@ -1044,7 +1044,7 @@ onMounted(async () => {
bg-color="white" bg-color="white"
v-model="educationData.isEducation" v-model="educationData.isEducation"
:options="educationOption" :options="educationOption"
option-value="label" option-value="value"
option-label="label" option-label="label"
input-debounce="0" input-debounce="0"
use-input use-input