แก้ฟิลเตอร์
This commit is contained in:
parent
698d03ce00
commit
c7a8374784
26 changed files with 626 additions and 532 deletions
|
|
@ -7,13 +7,14 @@ import { useCounterMixin } from "@/stores/mixin";
|
|||
|
||||
const type = ref<string>("");
|
||||
const mixin = useCounterMixin();
|
||||
const { date2Thai } = mixin;
|
||||
const { date2Thai,onSearchDataTable } = mixin;
|
||||
const modal = defineModel<boolean>("modal", { required: true });
|
||||
const title = defineModel<string>("title", { required: true });
|
||||
|
||||
const filter = ref<string>("");
|
||||
|
||||
const rows = defineModel<any>("rows");
|
||||
const rowsData = defineModel<any>("rowsData");
|
||||
const columns = defineModel<QTableProps["columns"]>("columns");
|
||||
const visibleColumns = defineModel<string[]>("visibleColumns");
|
||||
|
||||
|
|
@ -49,6 +50,14 @@ function statusLeave(val: string) {
|
|||
}
|
||||
}
|
||||
|
||||
function onSearch() {
|
||||
rows.value = onSearchDataTable(
|
||||
filter.value,
|
||||
rowsData.value,
|
||||
columns.value ? columns.value : []
|
||||
);
|
||||
}
|
||||
|
||||
watch(
|
||||
() => modal.value,
|
||||
(n) => {
|
||||
|
|
@ -75,20 +84,10 @@ watch(
|
|||
dense
|
||||
v-model="filter"
|
||||
label="ค้นหา"
|
||||
@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>
|
||||
</div>
|
||||
|
|
@ -99,7 +98,6 @@ watch(
|
|||
outlined
|
||||
emit-value
|
||||
map-options
|
||||
|
||||
options-dense
|
||||
option-value="name"
|
||||
v-model="visibleColumns"
|
||||
|
|
@ -117,7 +115,6 @@ watch(
|
|||
virtual-scroll
|
||||
:rows="rows"
|
||||
:columns="columns"
|
||||
:filter="filter"
|
||||
:rows-per-page-options="[10, 25, 50, 100]"
|
||||
:visible-columns="visibleColumns"
|
||||
:virtual-scroll-sticky-size-start="48"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue