แก้ฟิลเตอร์

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

@ -13,6 +13,7 @@ import type { ListMain } from "@/modules/11_probation/interface/index/main";
const profileId = ref<string>("");
const rows = ref<ListMain[]>([]);
const rowsData = ref<ListMain[]>([]);
const $q = useQuasar();
const mixin = useCounterMixin();
const {
@ -22,6 +23,7 @@ const {
showLoader,
hideLoader,
date2Thai,
onSearchDataTable
} = mixin;
const filter = ref<string>("");
@ -146,6 +148,7 @@ function getList(id: string) {
.then((res) => {
const data = res.data.data;
rows.value = data;
rowsData.value = data;
})
.catch((e) => {})
.finally(() => {});
@ -166,6 +169,14 @@ function onDetail(id: string) {
router.push(`/probation/detail/${profileId.value}/${id}`);
}
function onSearch() {
rows.value = onSearchDataTable(
filter.value,
rowsData.value,
columns.value ? columns.value : []
);
}
onMounted(async () => {
await getMain();
});
@ -290,20 +301,10 @@ onMounted(async () => {
v-model="filter"
label="ค้นหา"
:style="mode ? `max-width: 200px` : `max-width: 150px`"
@keydown.enter="onSearch"
>
<template v-slot:append>
<q-icon
v-if="filter !== ''"
name="clear"
class="cursor-pointer"
@click="filter = ''"
/>
<q-icon
v-else
name="search"
class="cursor-pointer"
@click="filter = ''"
/>
<q-icon name="search" />
</template>
</q-input>
<q-select
@ -332,7 +333,6 @@ onMounted(async () => {
:rows="rows"
:columns="columns"
:grid="!$q.screen.gt.xs"
:filter="filter"
:rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumns"
:virtual-scroll-sticky-size-start="48"

View file

@ -16,10 +16,18 @@ import type {
const $q = useQuasar();
const mixin = useCounterMixin();
const { messageError, findOrgName, showLoader, hideLoader, date2Thai } = mixin;
const {
messageError,
findOrgName,
showLoader,
hideLoader,
date2Thai,
onSearchDataTable,
} = mixin;
const profileId = ref<string>("");
const rows = ref<ListMain[]>([]);
const rowsData = ref<ListMain[]>([]);
const mode = ref<boolean>($q.screen.gt.xs);
const profileImg = ref<string>("");
@ -142,6 +150,7 @@ function getList(id: string) {
.then((res) => {
const data = res.data.data;
rows.value = data;
rowsData.value = data;
})
.catch((e) => {
messageError($q, e);
@ -170,6 +179,14 @@ function onDetail(id: string) {
router.push(`/probation/detail/${profileId.value}/${id}`);
}
function onSearch() {
rows.value = onSearchDataTable(
filter.value,
rowsData.value,
columns.value ? columns.value : []
);
}
onMounted(async () => {
await getMain();
});
@ -301,20 +318,10 @@ onMounted(async () => {
v-model="filter"
label="ค้นหา"
:style="mode ? `max-width: 200px` : `max-width: 150px`"
@keydown.enter="onSearch"
>
<template v-slot:append>
<q-icon
v-if="filter !== ''"
name="clear"
class="cursor-pointer"
@click="filter = ''"
/>
<q-icon
v-else
name="search"
class="cursor-pointer"
@click="filter = ''"
/>
<q-icon name="search" />
</template>
</q-input>
<q-select
@ -325,7 +332,6 @@ onMounted(async () => {
outlined
emit-value
map-options
options-dense
option-value="name"
style="min-width: 140px"
@ -344,7 +350,6 @@ onMounted(async () => {
:rows="rows"
:columns="columns"
:grid="!$q.screen.gt.xs"
:filter="filter"
:rows-per-page-options="[10, 25, 50, 100]"
:visible-columns="visibleColumns"
:virtual-scroll-sticky-size-start="48"