แก้ฟิลเตอร์

This commit is contained in:
setthawutttty 2024-12-11 13:46:33 +07:00
parent 698d03ce00
commit c7a8374784
26 changed files with 626 additions and 532 deletions

View file

@ -15,7 +15,7 @@ import DialogHeader from "@/components/DialogHeader.vue";
const $q = useQuasar();
const route = useRoute();
const { showLoader, hideLoader, messageError, dialogConfirm, success } =
const { showLoader, hideLoader, messageError, dialogConfirm, success,onSearchDataTable } =
useCounterMixin();
const evaluatorId = ref<string>(route.params.id.toString());
@ -51,6 +51,7 @@ const columns = ref<QTableProps["columns"]>([
},
]);
const rows = ref<ResEvaluator[]>([]);
const rowsData = ref<ResEvaluator[]>([]);
const filterKeyword = ref<string>("");
const modal = ref<boolean>(false);
@ -74,6 +75,7 @@ function fetchList() {
.get(config.API.kpiEvaluation + `/${props.type}/${evaluatorId.value}`)
.then((res) => {
rows.value = res.data.result;
rowsData.value = res.data.result;
})
.catch((err) => {
messageError($q, err);
@ -139,6 +141,14 @@ const pagination = ref({
rowsPerPage: 10,
});
function onSearch() {
rows.value = onSearchDataTable(
filterKeyword.value,
rowsData.value,
columns.value ? columns.value : []
);
}
onMounted(() => {
fetchList();
});
@ -165,6 +175,7 @@ onMounted(() => {
debounce="300"
v-model="filterKeyword"
placeholder="ค้นหา"
@keydown.enter="onSearch"
>
<template v-slot:append>
<q-icon name="search" />
@ -191,7 +202,6 @@ onMounted(() => {
ref="table"
:columns="columns"
:rows="rows"
:filter="filterKeyword"
row-key="id"
flat
bordered