เพิ่ม หมวดหมู่

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-09-12 16:07:56 +07:00
parent 935c85aba0
commit 2f3eb10564
2 changed files with 48 additions and 1 deletions

View file

@ -2,6 +2,11 @@ interface Pagination {
rowsPerPage: number; rowsPerPage: number;
} }
interface DateOption {
name: string;
id: string;
}
interface ActiveOptions { interface ActiveOptions {
value: boolean; value: boolean;
label: string; label: string;
@ -19,4 +24,4 @@ interface Tabs {
value: string; value: string;
label: string; label: string;
} }
export type { Pagination, ActiveOptions, ListOrder, Tabs }; export type { Pagination, DateOption, ActiveOptions, ListOrder, Tabs };

View file

@ -11,6 +11,7 @@ import type {
ActiveOptions, ActiveOptions,
ListOrder, ListOrder,
Tabs, Tabs,
DateOption,
} from "@/modules/05_command/interface/index/Main"; } from "@/modules/05_command/interface/index/Main";
import Header from "@/components/DialogHeader.vue"; import Header from "@/components/DialogHeader.vue";
@ -58,9 +59,13 @@ const tabs = ref<Tabs[]>([
}, },
]); ]);
const dataCategory = ref<DateOption[]>([]); //
const categoryOP = ref<DateOption[]>([]); // options
const idOrder = ref<string>(""); // Id const idOrder = ref<string>(""); // Id
const activeOrderId = ref<string>(""); // Id const activeOrderId = ref<string>(""); // Id
const name = ref<string>(""); // const name = ref<string>(""); //
const category = ref<string>(""); //
const listOrder = ref<ListOrder[]>([]); // list const listOrder = ref<ListOrder[]>([]); // list
const status = ref<boolean>(false); // const status = ref<boolean>(false); //
const isEdit = ref<boolean>(false); // true/false const isEdit = ref<boolean>(false); // true/false
@ -153,6 +158,15 @@ async function fetchOrderType() {
}); });
} }
function filterSelector(val: string, update: Function) {
update(() => {
category.value = val ? "" : category.value;
categoryOP.value = dataCategory.value.filter(
(v: any) => v.name.indexOf(val) > -1
);
});
}
/** เริ่มเมื่อโหลดหน้านี้*/ /** เริ่มเมื่อโหลดหน้านี้*/
onMounted(() => { onMounted(() => {
fetchOrderType(); fetchOrderType();
@ -353,6 +367,34 @@ onMounted(() => {
hide-bottom-space hide-bottom-space
></q-input> ></q-input>
</div> </div>
<div class="col-12">
<q-select
class="inputgreen"
v-model="category"
:label="`${'หมดหมู่'}`"
dense
emit-value
map-options
option-label="name"
:options="categoryOP"
option-value="id"
lazy-rules
use-input
hide-bottom-space
outlined
:rules="[(val:string) => !!val || `${'กรุณาเลือกหมดหมู่'}`]"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn) "
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template>
</q-select>
</div>
<div class="col-12"> <div class="col-12">
<div class="row items-center justify-between border_custom"> <div class="row items-center justify-between border_custom">
<p class="q-ma-none">สถานะการใชงาน</p> <p class="q-ma-none">สถานะการใชงาน</p>