fix(03): select province input

This commit is contained in:
puriphatt 2024-07-30 04:04:51 +00:00
parent 3b0510922b
commit e07ce319ea

View file

@ -9,6 +9,7 @@ import useAddressStore, {
import { EmployeeCheckupCreate } from 'src/stores/employee/types';
import { useI18n } from 'vue-i18n';
import { selectFilterOptionRefMod } from 'src/stores/utils';
import { QSelect } from 'quasar';
const { locale } = useI18n();
const adrressStore = useAddressStore();
@ -53,6 +54,12 @@ async function fetchProvince() {
const result = await adrressStore.fetchProvince();
if (result) addrOptions.provinceOps = result;
provinceFilter = selectFilterOptionRefMod(
ref(addrOptions.provinceOps),
provinceOptions,
'name',
);
}
function addData() {
@ -87,12 +94,11 @@ onMounted(async () => {
tab.value = 'tab0';
});
// const provinceOps = ref<Record<string, unknown>[]>([]);
// const provinceFilter = selectFilterOptionRefMod(
// addrOptions.provinceOps,
// provinceOps,
// 'label',
// );
const provinceOptions = ref<Record<string, unknown>[]>([]);
let provinceFilter: (
value: string,
update: (callbackFn: () => void, afterFn?: (ref: QSelect) => void) => void,
) => void;
const checkupTypeOptions = ref<Record<string, unknown>[]>([]);
const checkupTypeFilter = selectFilterOptionRefMod(
@ -207,7 +213,7 @@ const insuranceCompanyFilter = selectFilterOptionRefMod(
:readonly="readonly"
:options="checkupTypeOptions"
:hide-dropdown-icon="readonly"
:id="`${prefixId}-select-province`"
:id="`${prefixId}-select-checkup-type`"
:label="$t('formDialogInputCheckupType')"
@filter="checkupTypeFilter"
>
@ -239,7 +245,8 @@ const insuranceCompanyFilter = selectFilterOptionRefMod(
:label="$t('province')"
:hide-dropdown-icon="readonly"
:id="`${prefixId}-select-province`"
:options="addrOptions.provinceOps"
:options="provinceOptions"
@filter="provinceFilter"
>
<template v-slot:no-option>
<q-item>