แก้ฟิลเตอร์
This commit is contained in:
parent
8a609fa120
commit
6ea0bc8fb6
9 changed files with 134 additions and 54 deletions
|
|
@ -1,22 +1,30 @@
|
|||
<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 { directorType } from "@/modules/11_discipline/interface/index/Main";
|
||||
import type { Directors } from "@/modules/12_evaluatePersonal/interface/response/Main";
|
||||
|
||||
/** importComponents*/
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const { onSearchDataTable } = mixin;
|
||||
const selected = ref<directorType[]>([]);
|
||||
|
||||
const rows = defineModel<Directors[]>("rows", { required: true });
|
||||
const rowsData = defineModel<Directors[]>("rowsData", { required: true });
|
||||
const filterKeyword2 = defineModel<string>("filterKeyword2", {
|
||||
required: true,
|
||||
});
|
||||
|
||||
/** รับ props มาจากหน้าหลัก */
|
||||
const props = defineProps({
|
||||
Modal: Boolean,
|
||||
clickClose: Function,
|
||||
getData: Function,
|
||||
rows2: Array,
|
||||
filterKeyword2: String,
|
||||
filterTable: {
|
||||
type: String,
|
||||
default: "",
|
||||
|
|
@ -145,6 +153,14 @@ function updateProp(newPagination: number, page: number) {
|
|||
emit("update:pagination", newPagination, page);
|
||||
}
|
||||
|
||||
function onSearch() {
|
||||
rows.value = onSearchDataTable(
|
||||
filterKeyword2.value,
|
||||
rowsData.value,
|
||||
columns2.value ? columns2.value : []
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* เช็คค่า props.Modal === true
|
||||
*/
|
||||
|
|
@ -187,9 +203,9 @@ watch(
|
|||
class="col-12 q-mb-sm"
|
||||
debounce="300"
|
||||
:model-value="filterKeyword2"
|
||||
@update:model-value="updateInput"
|
||||
placeholder="ค้นหารายชื่อ"
|
||||
style="max-width: 100%"
|
||||
@keydown.enter="onSearch"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon name="search" />
|
||||
|
|
@ -198,8 +214,7 @@ watch(
|
|||
|
||||
<d-table
|
||||
:columns="columns2"
|
||||
:rows="rows2"
|
||||
:filter="filterKeyword2?.trim()"
|
||||
:rows="rows"
|
||||
row-key="id"
|
||||
:visible-columns="visibleColumns2"
|
||||
selection="multiple"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue