diff --git a/src/modules/11_discipline/components/2_InvestigateFacts/investigatefactsAdd.vue b/src/modules/11_discipline/components/2_InvestigateFacts/AddPage.vue similarity index 85% rename from src/modules/11_discipline/components/2_InvestigateFacts/investigatefactsAdd.vue rename to src/modules/11_discipline/components/2_InvestigateFacts/AddPage.vue index 0fabed5b6..0e46075d4 100644 --- a/src/modules/11_discipline/components/2_InvestigateFacts/investigatefactsAdd.vue +++ b/src/modules/11_discipline/components/2_InvestigateFacts/AddPage.vue @@ -1,7 +1,10 @@ - + - diff --git a/src/modules/11_discipline/interface/index/Main.ts b/src/modules/11_discipline/interface/index/Main.ts index 1a6136942..2a943c3e2 100644 --- a/src/modules/11_discipline/interface/index/Main.ts +++ b/src/modules/11_discipline/interface/index/Main.ts @@ -2,6 +2,15 @@ interface DataOption { id: string; name: string; } +interface investigatefactsDataRowType { +subject: string; +interrogated: string; +fault: string; +status: string; +active: string; +} + export type { - DataOption + DataOption, + investigatefactsDataRowType }; diff --git a/src/modules/11_discipline/router.ts b/src/modules/11_discipline/router.ts index d0a715198..0dc23cbe9 100644 --- a/src/modules/11_discipline/router.ts +++ b/src/modules/11_discipline/router.ts @@ -4,7 +4,7 @@ const factsMain = () => import("@/modules/11_discipline/components/2_InvestigateFacts/MainPage.vue"); const investigatefactsAdd = () => import( - "@/modules/11_discipline/components/2_InvestigateFacts/investigatefactsAdd.vue" + "@/modules/11_discipline/components/2_InvestigateFacts/AddPage.vue" ); const disciplinaryMain = () => import( diff --git a/src/modules/11_discipline/stroes/InvestigateFactStore.ts b/src/modules/11_discipline/stroes/InvestigateFactStore.ts index 072fe5ee4..97631669d 100644 --- a/src/modules/11_discipline/stroes/InvestigateFactStore.ts +++ b/src/modules/11_discipline/stroes/InvestigateFactStore.ts @@ -1,41 +1,71 @@ import { defineStore } from "pinia"; import { ref } from "vue"; - +import type { investigatefactsDataRowType, DataOption } from '@/modules/11_discipline/interface/index/Main' export const useInvestigateFactStore = defineStore("InvestigateFact", () => { - const rows = ref([]) - async function fecthList(data: any) { - let datalist = data.map((e: any) => ({ + const rows = ref([]) + const faultOp = ref(); + const daysExtendOp = ref(); + const investigationOp = ref(); + const daysExtendOps = ref([ + { id: "000", name: "15 วัน" }, + { id: "001", name: "30 วัน" }, + { id: "002", name: "45 วัน" }, + { id: "003", name: "60 วัน" }, + ]); + const investigationOps = ref([ + { id: "001", name: "เเต่งตั้งการสืบสวน" }, + { id: "002", name: "สืบสวนทางลับ" }, + { id: "003", name: "อื่นๆ" }, + ]); + const faultOps = ref([ + { id: "001", name: "ยังไม่ระบุ" }, + { id: "002", name: "ไม่ร้ายเเรง" }, + { id: "003", name: "ร้ายเเรง" }, + ]); + function filterFnOptionsType(val: string, update: any, type: string) { + update(() => { + const needle = val.toLowerCase(); + if (type === "faultOp") { + faultOp.value = faultOps.value.filter( + (v: any) => v.value.toLowerCase().indexOf(needle) > -1 + ); + } else if (type === "investigationOp") { + investigationOp.value = investigationOps.value.filter( + (v: any) => v.value.toLowerCase().indexOf(needle) > -1 + ); + } else if (type === "daysExtendOp") { + daysExtendOp.value = daysExtendOps.value.filter( + (v: any) => v.value.toLowerCase().indexOf(needle) > -1 + ); + } + }); + } + async function fecthList(data:investigatefactsDataRowType[]) { + let datalist:investigatefactsDataRowType[] = data.map((e: any) => ({ subject: e.subject, interrogated: e.interrogated, - fault: convertFault(e.fault), - status: convertSatatus(e.status), - active: activeStatus(e.active) - + fault: e.fault ?? convertFault(e.fault), + status: e.status ?? convertSatatus(e.status), + active: e.active ?? activeStatus(e.active) + })) rows.value = datalist - console.log(rows.value) } function convertFault(val: string) { switch (val) { case "0": - return "ความผิดวินัยยังไม่ระบุ" - case "1": return "ความผิดวินัยไม่ร้ายแรง" - case "2": + case "1": return "ความผิดวินัยร้ายแรง" } } function convertSatatus(val: string) { switch (val) { case "0": - return "ยังไม่ระบุ" - case "1": - return "ร้ายแรง" - case "2": - return "ไม่ร้ายแรง" - case "3": return "ยุติเรื่อง" + case "1": + return "เสร็จสิ้นเเล้ว" } } function activeStatus(val: string) { @@ -49,5 +79,12 @@ export const useInvestigateFactStore = defineStore("InvestigateFact", () => { return { fecthList, rows, + daysExtendOps, + investigationOps, + faultOps, + filterFnOptionsType, + faultOp, + daysExtendOp, + investigationOp, }; }) \ No newline at end of file