ฟิลเตอร์ สถานภาพ

This commit is contained in:
setthawutttty 2025-03-06 09:55:28 +07:00
parent ab4db32ac2
commit 9c72cd249d
5 changed files with 59 additions and 2 deletions

View file

@ -30,6 +30,7 @@ const querySting = reactive<QuerySting>({
page: 1, //* page: 1, //*
pageSize: 10, //* pageSize: 10, //*
keyword: leaveStore.filter.keyword, //keyword keyword: leaveStore.filter.keyword, //keyword
profileType: '', //profileType
}); });
//** API*/ //** API*/

View file

@ -33,6 +33,7 @@ const querySting = reactive<QuerySting>({
page: 1, //* page: 1, //*
pageSize: 10, //* pageSize: 10, //*
keyword: leaveStore.filter.keyword, //keyword keyword: leaveStore.filter.keyword, //keyword
profileType: '', //profileType
}); });
//** API*/ //** API*/
async function fecthLeaveList() { async function fecthLeaveList() {

View file

@ -23,6 +23,12 @@ const props = defineProps({
}); });
/** Option*/ /** Option*/
const roleMainOp = ref<DataOption[]>([
{ id: "OFFICER", name: "ข้าราชการ กทม. สามัญ" },
{ id: "EMPLOYEE", name: "ลูกจ้างประจำ กทม." },
]);
const roleOp = ref<DataOption[]>();
const optionTypeMain = ref<DataOption[]>([]); const optionTypeMain = ref<DataOption[]>([]);
const optionType = ref<DataOption[]>([]); const optionType = ref<DataOption[]>([]);
const optionStatus = ref<DataOption[]>([ const optionStatus = ref<DataOption[]>([
@ -91,6 +97,18 @@ function filterOption(val: string, update: any, name: string) {
}); });
} }
/**
* function นหาขอมลใน option
* @param val คำคนหา
* @param update function
*/
function filterOptionFn(val: string, update: Function) {
update(() => {
const data = roleMainOp.value;
roleOp.value = data.filter((e: any) => e.name.search(val) !== -1);
});
}
watch( watch(
async () => props.dataToobar, async () => props.dataToobar,
() => { () => {
@ -116,6 +134,42 @@ watch(
<template> <template>
<div class="row col-12 q-col-gutter-sm q-mb-sm"> <div class="row col-12 q-col-gutter-sm q-mb-sm">
<div class="col-xs-12 col-sm-3 col-md-2"> <div class="col-xs-12 col-sm-3 col-md-2">
<q-select
emit-value
map-options
outlined
dense
option-value="id"
option-label="name"
label="สถานภาพ"
use-input
:model-value="
querySting.profileType == '' ? 'ทั้งหมด' : querySting.profileType
"
hide-selected
fill-input
:options="roleOp"
@update:model-value="(value:any)=>(querySting.profileType = value,props.getSearch?.())"
@filter="(inputValue:string,
doneFn:Function) => filterOptionFn(inputValue,doneFn)"
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey"> ไมอม </q-item-section>
</q-item>
</template>
<template v-if="querySting.profileType !== ''" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="
(querySting.profileType = ''), props.getSearch?.()
"
class="cursor-pointer"
/>
</template>
</q-select>
</div>
<div class="col-xs-12 col-sm-3 col-md-1">
<datepicker <datepicker
menu-class-name="modalfix" menu-class-name="modalfix"
v-model="querySting.year" v-model="querySting.year"
@ -245,7 +299,7 @@ watch(
</template> </template>
</q-input> </q-input>
</div> </div>
<div class="col-xs-12 col-sm-3 col-md-2"> <div class="col-xs-12 col-sm-3 col-md-1">
<q-select <q-select
for="visibleColumns" for="visibleColumns"
v-model="leaveStore.visibleColumns" v-model="leaveStore.visibleColumns"
@ -256,7 +310,6 @@ watch(
:display-value="$q.lang.table.columns" :display-value="$q.lang.table.columns"
emit-value emit-value
map-options map-options
style="min-width: 140px"
:options="leaveStore.columns" :options="leaveStore.columns"
option-value="name" option-value="name"
/> />

View file

@ -12,6 +12,7 @@ interface QuerySting {
page: number; //*หน้า page: number; //*หน้า
pageSize: number; //*จำนวนแถวต่อหน้า pageSize: number; //*จำนวนแถวต่อหน้า
keyword: string; //keyword ค้นหา keyword: string; //keyword ค้นหา
profileType: string;
} }
interface DateFilter { interface DateFilter {

View file

@ -79,6 +79,7 @@ export const useLeavelistDataStore = defineStore("leave", () => {
async function fetchListLeaveReject(data: any[]) { async function fetchListLeaveReject(data: any[]) {
let datalist = data.map((e: FremData) => ({ let datalist = data.map((e: FremData) => ({
id: e.id, id: e.id,
profileType: e.profileType ?? '-',
leaveTypeName: e.leaveTypeName, leaveTypeName: e.leaveTypeName,
leaveTypeId: e.leaveTypeId, leaveTypeId: e.leaveTypeId,
fullName: e.fullName, fullName: e.fullName,