diff --git a/src/modules/07_insignia/store.ts b/src/modules/07_insignia/store.ts index ca9166aed..151b449f8 100644 --- a/src/modules/07_insignia/store.ts +++ b/src/modules/07_insignia/store.ts @@ -6,12 +6,12 @@ const mixin = useCounterMixin(); const { date2Thai } = mixin; export const useInsigniaDataStore = defineStore("insignia", () => { - const roundId = ref("") - const optionRound = ref([]) - const isLock = ref(false) - const roleUser = ref("") - const requestId = ref("") - const requestStatus = ref("") + const roundId = ref(""); + const optionRound = ref([]); + const isLock = ref(false); + const roleUser = ref(""); + const requestId = ref(""); + const requestStatus = ref(""); let optionsTypeOc = ref([]); let typeOc = ref(""); const agency = ref(""); @@ -20,11 +20,15 @@ export const useInsigniaDataStore = defineStore("insignia", () => { const typeinsignia = ref("all"); let typeinsigniaOptions = ref([{ id: "all", name: "ทั้งหมด" }]); const employeeClass = ref("all"); - const employeeClassOps = ref([{ name: "ทั้งหมด", id: "all" }, { name: "ข้าราชการ กทม.สามัญ", id: "officer" }, { name: "ลูกจ้างประจำ", id: "perm" }]) + const employeeClassOps = ref([ + { name: "ทั้งหมด", id: "all" }, + { name: "ข้าราชการ กทม.สามัญ", id: "officer" }, + { name: "ลูกจ้างประจำ", id: "perm" }, + ]); const typeReport = ref(""); const titleReport = ref(""); - const mainTab = ref('pending'); + const mainTab = ref("pending"); const setTypeandTitle = (type: string, title: string) => { typeReport.value = type; @@ -49,9 +53,9 @@ export const useInsigniaDataStore = defineStore("insignia", () => { requestNote: e.requestNote, employeeType: profileType(e.profileType), })); - rows.value = await datalist + rows.value = await datalist; listinsignia.value = await datalist; - searchDataTable(typeinsignia.value, employeeClass.value) + searchDataTable(typeinsignia.value, employeeClass.value); filtertypeInsignia(); } else rows.value = []; }; @@ -60,7 +64,7 @@ export const useInsigniaDataStore = defineStore("insignia", () => { isLock.value = data.isLock; // สถานะล็อกข้อมูล requestId.value = data.requestId; requestStatus.value = data.requestStatus; // สถานะของรอบการเสนอขอ - } + }; // เรียก Option หน่วยงานทั้งหมด const fetchOption = (op: any) => { if (agency.value !== null) { @@ -91,18 +95,26 @@ export const useInsigniaDataStore = defineStore("insignia", () => { }; // ค้นหาข้อมมูลราชชื่อ ตาม ประเท๓และสถานภาพ const searchDataTable = async (type: string, employeeClasstype: string) => { - typeinsignia.value = type - employeeClass.value = employeeClasstype - if (type !== 'all' && employeeClasstype !== 'all') { - rows.value = listinsignia.value.filter((e: any) => e.insigniaSend === type && e.employeeType === profileType(employeeClasstype)) - } else if (type !== 'all' && employeeClasstype === 'all') { - rows.value = listinsignia.value.filter((e: any) => e.insigniaSend === type) - } else if (type === 'all' && employeeClasstype !== 'all') { - rows.value = listinsignia.value.filter((e: any) => e.employeeType === profileType(employeeClasstype)) - } else if (type === 'all' && employeeClasstype === 'all') { - rows.value = listinsignia.value + typeinsignia.value = type; + employeeClass.value = employeeClasstype; + if (type !== "all" && employeeClasstype !== "all") { + rows.value = listinsignia.value.filter( + (e: any) => + e.insigniaSend === type && + e.employeeType === profileType(employeeClasstype) + ); + } else if (type !== "all" && employeeClasstype === "all") { + rows.value = listinsignia.value.filter( + (e: any) => e.insigniaSend === type + ); + } else if (type === "all" && employeeClasstype !== "all") { + rows.value = listinsignia.value.filter( + (e: any) => e.employeeType === profileType(employeeClasstype) + ); + } else if (type === "all" && employeeClasstype === "all") { + rows.value = listinsignia.value; } - } + }; // ประเภทลูกจ้าง const profileType = (val: string) => { @@ -111,8 +123,12 @@ export const useInsigniaDataStore = defineStore("insignia", () => { return "ข้าราชการ กทม.สามัญ"; case "employee": return "ลูกจ้างประจำ"; + case "perm": + return "ลูกจ้างประจำ"; + case "temp": + return "ลูกจ้างประจำ"; } - } + }; return { roundId,