filter ส่งไปออกคำสั่งอื่นๆ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-09-29 10:27:24 +07:00
parent 887f229017
commit e2d755caca
3 changed files with 36 additions and 12 deletions

View file

@ -425,7 +425,7 @@ function filterFnYear(val: string, update: any) {
</template> </template>
</q-select> </q-select>
<q-select <q-select
class="col-xs-12 col-sm-3 col-md-2" class="col-xs-12 col-sm-3 col-md-3"
v-model="examType" v-model="examType"
label="ประเภทการสอบ" label="ประเภทการสอบ"
dense dense

View file

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed,watchEffect } from "vue"; import { ref, computed, watchEffect } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
@ -25,8 +25,8 @@ const props = defineProps({
fecthlistOthet: Function, fecthlistOthet: Function,
optionsType: Array, optionsType: Array,
rows2: Array, rows2: Array,
filterKeyword2:String, filterKeyword2: String,
type:String, type: String,
}); });
const visibleColumns2 = ref<string[]>([ const visibleColumns2 = ref<string[]>([
"no", "no",
@ -96,7 +96,6 @@ const emit = defineEmits([
"update:filterKeyword2", "update:filterKeyword2",
"update:type", "update:type",
"update:selected", "update:selected",
]); ]);
const updateInput = (value: any) => { const updateInput = (value: any) => {
emit("update:filterKeyword2", value); emit("update:filterKeyword2", value);
@ -107,7 +106,7 @@ const updateInputType = (value: any) => {
}; };
// //
const Reset = () => { const Reset = () => {
emit("update:filterKeyword2", ""); emit("update:filterKeyword2", "");
}; };
// modal // modal
const clickAddlist = () => { const clickAddlist = () => {
@ -117,7 +116,7 @@ const clickAddlist = () => {
// //
const addOther = async () => { const addOther = async () => {
let pId: string[] = []; let pId: string[] = [];
let Type = props.type as string let Type = props.type as string;
selected.value.forEach((e: any) => { selected.value.forEach((e: any) => {
pId.push(e.personalId); pId.push(e.personalId);
}); });
@ -136,7 +135,7 @@ const addOther = async () => {
.finally(() => { .finally(() => {
props.fecthlistOthet?.(); props.fecthlistOthet?.();
selected.value = []; selected.value = [];
props.clickClose?.() props.clickClose?.();
}); });
}; };
watchEffect(() => { watchEffect(() => {
@ -144,6 +143,23 @@ watchEffect(() => {
selected.value = []; selected.value = [];
} }
}); });
// filter OptionsType
const OptionsTypeFn = ref<any>([]);
function filterFnOptionsType(val: string, update: any) {
if (val == "") {
update(() => {
OptionsTypeFn.value = props.optionsType;
});
} else {
update(() => {
if (props.optionsType) {
OptionsTypeFn.value = props.optionsType.filter(
(e: any) => e.name.search(val) !== -1
);
}
});
}
}
</script> </script>
<template> <template>
@ -160,14 +176,23 @@ watchEffect(() => {
dense dense
:model-value="type" :model-value="type"
@update:model-value="updateInputType" @update:model-value="updateInputType"
:options="optionsType" :options="OptionsTypeFn"
label="ประเภทคำสั่ง" label="ประเภทคำสั่ง"
style="width: 400px; max-width: auto" style="width: 400px; max-width: auto"
emit-value emit-value
map-options map-options
option-label="name" option-label="name"
option-value="id" option-value="id"
/> use-input
@filter="filterFnOptionsType"
><template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template>
</q-select>
</q-toolbar> </q-toolbar>
</div> </div>
<div class="col-5"> <div class="col-5">
@ -232,7 +257,6 @@ watchEffect(() => {
<template v-slot:body="props"> <template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer"> <q-tr :props="props" class="cursor-pointer">
<q-td> <q-td>
<q-checkbox <q-checkbox
keep-color keep-color
color="primary" color="primary"

View file

@ -393,7 +393,7 @@ function filterFn(val: string, update: any) {
<div class="col-6"> <div class="col-6">
<div class="row"> <div class="row">
<q-select <q-select
class="col-5 q-mr-sm" class="col-5 col-sm-3 col-md-8"
v-model="fillter" v-model="fillter"
label="สถานะ" label="สถานะ"
dense dense