filter ==> ข้อมูลตำแหน่งข้าราชการ ฯ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-12-12 13:48:39 +07:00
parent 6152fa3bef
commit a8576f902c
6 changed files with 52 additions and 19 deletions

View file

@ -12,10 +12,12 @@ import type { RowListForm } from "@/modules/01_metadata/interface/request/positi
import DialogAdd from "@/modules/01_metadata/components/position/DialogFormExecutive.vue";
const $q = useQuasar();
const { showLoader, hideLoader, messageError, date2Thai } = useCounterMixin();
const { showLoader, hideLoader, messageError, date2Thai, onSearchDataTable } =
useCounterMixin();
// Table
const rows = ref<RowListForm[]>([]); //
const rowsMain = ref<RowListForm[]>([]); //
const filterKeyword = ref<string>(""); //
const visibleColumns = ref<string[]>([
"no",
@ -104,6 +106,7 @@ async function getData() {
.then(async (res) => {
const data = await res.data.result;
rows.value = data;
rowsMain.value = data;
})
.catch((e) => {
messageError($q, e);
@ -130,6 +133,14 @@ function editPopUp(data: RowListForm) {
isEdit.value = true;
}
function serchDataTable() {
rows.value = onSearchDataTable(
filterKeyword.value,
rowsMain.value,
columns.value ? columns.value : []
);
}
/**
* hook ทำงานเม Components กเรยกใชงาน
*/
@ -157,12 +168,11 @@ onMounted(async () => {
<q-input
dense
outlined
clearable
v-model="filterKeyword"
placeholder="ค้นหา"
@clear="filterKeyword = ''"
@keydown.enter.pervent="serchDataTable"
>
<template v-slot:append v-if="filterKeyword === ''">
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
@ -185,7 +195,6 @@ onMounted(async () => {
ref="table"
:columns="columns"
:rows="rows"
:filter="filterKeyword"
row-key="id"
flat
bordered