เพิ่มฟิลเตอร์

This commit is contained in:
setthawutttty 2025-02-21 13:57:53 +07:00
parent b925026c2f
commit 07962731fa
12 changed files with 403 additions and 36 deletions

View file

@ -6,6 +6,7 @@ import { useCounterMixin } from "@/stores/mixin";
import type {
FormPlacementMainData,
OpfillterTypeSt,
DataOptions,
} from "@/modules/05_placement/interface/request/Main";
import type { FormOrderPlacementMainData } from "@/modules/05_placement/interface/request/Main";
@ -357,6 +358,15 @@ export const useTransferDataStore = defineStore("transferDataStore", () => {
value: "ออกคำสั่งเสร็จแล้ว",
},
]);
const statusOp = ref<DataOptions[]>([]);
const statusMainOp = ref<DataOptions[]>([
{ id: "WAITTING", name: "รอดำเนินการ" },
{ id: "PENDING", name: "เลือกตำแหน่งแล้ว" },
{ id: "APPROVE", name: "อนุมัติ" },
{ id: "REJECT", name: "ไม่อนุมัติ" },
{ id: "REPORT", name: "ส่งรายชื่อไปออกคำสั่ง" },
{ id: "DONE", name: "ออกคำสั่งเสร็จแล้ว" },
]);
const statusText = (val: string) => {
switch (val) {
@ -377,6 +387,22 @@ export const useTransferDataStore = defineStore("transferDataStore", () => {
return "-";
}
};
/**
* Option Filter
* @param val
* @param update Function
*/
function filterOption(val: string, update: any) {
update(() => {
const needle = val.toLowerCase();
statusOp.value = statusMainOp.value.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
);
});
}
function statusProbationMain(val: number) {
switch (val) {
case 1:
@ -406,5 +432,8 @@ export const useTransferDataStore = defineStore("transferDataStore", () => {
statusText,
statusProbationMain,
optionStatusProbation,
statusOp,
statusMainOp,
filterOption,
};
});