ฟิลเตอร์ วินัย/การลา

This commit is contained in:
STW_TTTY\stwtt 2024-07-10 15:11:22 +07:00
parent f48b559686
commit fba93a9fc7
10 changed files with 289 additions and 45 deletions

View file

@ -12,7 +12,7 @@ import { useInvestigateFactStore } from "@/modules/11_discipline/store/Investiga
const dataInvestigate = useInvestigateFactStore();
const mixin = useCounterMixin();
const { messageError, showLoader, hideLoader } = mixin;
const option = ref<any[]>(dataInvestigate.statusOptions);
const $q = useQuasar(); // noti quasar
/** ค้นหาข้อมูลในตาราง */
@ -99,6 +99,20 @@ function filterFn() {
getList();
}
/**
* function นหาขอมลใน option
* @param val คำคนหา
* @param update function
*/
function filterOptionFn(val: string, update: Function) {
statusFilter.value = "";
update(() => {
option.value = dataInvestigate.statusOptions.filter(
(e: any) => e.name.search(val) !== -1
);
});
}
/**
* งขอมลจำลองไปย store
*/
@ -122,16 +136,25 @@ onMounted(async () => {
map-options
option-label="name"
option-value="id"
:options="dataInvestigate.statusOptions"
:options="option"
@update:model-value="getList()"
use-input
@filter="filterOptionFn"
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey"> ไมอม </q-item-section>
</q-item>
</template>
<template v-if="statusFilter !== 'ALL'" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="(statusFilter = 'ALL'), getList()"
@click.stop.prevent="(option = dataInvestigate.statusOptions),(statusFilter = 'ALL'), getList()"
class="cursor-pointer"
/> </template
></q-select>
>
</q-select
>
</div>
<q-space />