แก้ฟิลเตอร์

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

@ -1,20 +1,26 @@
<script setup lang="ts">
import { ref, watchEffect, watch, type PropType } from "vue";
import { useCounterMixin } from "@/stores/mixin";
/** importType*/
import type { QTableProps } from "quasar";
import type { Meeting } from "@/modules/12_evaluatePersonal/interface/index/Main";
import type { Meetings } from "@/modules/12_evaluatePersonal/interface/response/Main";
/** importComponents*/
import DialogHeader from "@/components/DialogHeader.vue";
const mixin = useCounterMixin();
const { onSearchDataTable } = mixin;
const filterKeyword = defineModel<string>("filterKeyword", { required: true });
const rows = defineModel<Meetings[]>("rows", { required: true });
const rowsData = defineModel<Meetings[]>("rowsData", { required: true });
/** รับ props มาจากหน้าหลัก */
const props = defineProps({
Modal: Boolean,
clickClose: Function,
getData: Function,
rows2: Array,
filterKeyword2: String,
filterTable: {
type: String,
default: "",
@ -149,6 +155,14 @@ function updateProp(newPagination: number, page: number) {
emit("update:pagination", newPagination, page);
}
function onSearch() {
rows.value = onSearchDataTable(
filterKeyword.value,
rowsData.value,
columns.value ? columns.value : []
);
}
/** เช็คค่า props.Modal === true */
watchEffect(() => {
if (props.Modal === true) {
@ -188,10 +202,10 @@ watch(
dense
class="col-12 q-mb-sm"
debounce="300"
:model-value="filterKeyword2"
@update:model-value="updateInput"
:model-value="filterKeyword"
placeholder="ค้นหารายการประชุม"
style="max-width: 100%"
@keydown.enter="onSearch"
>
<template v-slot:append>
<q-icon name="search" />
@ -200,8 +214,7 @@ watch(
<d-table
:columns="columns"
:rows="rows2"
:filter="filterKeyword2?.trim()"
:rows="rows"
row-key="id"
selection="multiple"
v-model:selected="selected"