แก้ฟิลเตอร์

This commit is contained in:
setthawutttty 2024-12-10 11:44:02 +07:00
parent 8a609fa120
commit 6ea0bc8fb6
9 changed files with 134 additions and 54 deletions

View file

@ -12,7 +12,8 @@ import { useCounterMixin } from "@/stores/mixin";
const $q = useQuasar();
const store = useSalaryEmployeeListSDataStore();
const { messageError, showLoader, hideLoader } = useCounterMixin();
const { messageError, showLoader, hideLoader, onSearchDataTable } =
useCounterMixin();
const props = defineProps({
year: Number,
@ -131,6 +132,7 @@ const itemsCard = computed(() => {
});
const rows = ref<any[]>([]);
const rowsData = ref<any[]>([]);
const columnsAPR = ref<QTableProps["columns"]>([
{
name: "org",
@ -410,6 +412,7 @@ function fetchDataDashboard() {
itemsCardSpeciel.value[2].total = quota.totalBackup;
rows.value = res.data.result.salaryOrg;
rowsData.value = res.data.result.salaryOrg;
})
.catch((err) => {
messageError($q, err);
@ -418,6 +421,15 @@ function fetchDataDashboard() {
hideLoader();
});
}
function onSearch() {
rows.value = onSearchDataTable(
filter.value,
rowsData.value,
columns.value ? columns.value : []
);
}
onMounted(() => {
fetchDataDashboard();
});
@ -479,6 +491,7 @@ watch([() => props?.snapShot, () => props.roundFilter], () => {
v-model="filter"
placeholder="ค้นหา"
outlined
@keydown.enter="onSearch"
>
<template v-slot:append>
<q-icon name="search" />
@ -495,7 +508,6 @@ watch([() => props?.snapShot, () => props.roundFilter], () => {
map-options
:options="columns"
option-value="name"
style="min-width: 140px"
/>
</div>