แก้ฟิลเตอร์ระบบ บรรจุ

This commit is contained in:
setthawutttty 2024-12-11 11:49:34 +07:00
parent a15efd7b45
commit b8f336d2ba
7 changed files with 88 additions and 23 deletions

View file

@ -14,7 +14,7 @@ import DialogCreateCommand from "@/modules/18_command/components/DialogCreateCom
const $q = useQuasar();
const selected = ref<AppointMainRows[]>([]);
const mixin = useCounterMixin();
const { dialogConfirm } = mixin;
const { dialogConfirm, onSearchDataTable } = mixin;
const dataMapToSend = computed(() => {
return selected.value.map((i: any) => ({
@ -29,6 +29,7 @@ const dataMapToSend = computed(() => {
const filterKeyword = defineModel<string>("filterKeyword", { required: true });
const rows = defineModel<AppointMainRows[]>("rows", { required: true });
const rowsData = defineModel<AppointMainRows[]>("rowsData", { required: true });
/** props*/
const props = defineProps({
modal: Boolean,
@ -130,6 +131,14 @@ function convertText(val: string) {
}
}
function onSearch() {
rows.value = onSearchDataTable(
filterKeyword.value,
rowsData.value,
columns.value ? columns.value : []
);
}
watchEffect(() => {
if (props.modal === true) {
selected.value = [];
@ -153,6 +162,7 @@ watchEffect(() => {
dense
placeholder="ค้นหา"
v-model="filterKeyword"
@keydown.enter="onSearch"
>
<template v-slot:append>
<q-icon name="search" />
@ -178,7 +188,6 @@ watchEffect(() => {
<d-table
:columns="columns"
:rows="rows"
:filter="filterKeyword.trim()"
row-key="id"
:visible-columns="visibleColumns"
selection="single"