From 91fc7f7520ff8048406ad7a71f846d1636a94f97 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Wed, 18 Oct 2023 11:46:28 +0700 Subject: [PATCH] =?UTF-8?q?UI=20-=20=E0=B8=AA=E0=B8=B7=E0=B8=9A=E0=B8=AA?= =?UTF-8?q?=E0=B8=A7=E0=B8=99=E0=B8=82=E0=B9=89=E0=B8=AD=E0=B9=80=E0=B8=97?= =?UTF-8?q?=E0=B9=87=E0=B8=88=E0=B8=88=E0=B8=A3=E0=B8=B4=E0=B8=87=20?= =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1=20type=20?= =?UTF-8?q?=E0=B9=83=E0=B8=AB=E0=B9=89=20any=20=E0=B9=80=E0=B9=80=E0=B8=A5?= =?UTF-8?q?=E0=B9=89=E0=B8=A7=20=E0=B8=A2=E0=B9=89=E0=B8=B2=E0=B8=A2=20opt?= =?UTF-8?q?ion=20=E0=B9=84=E0=B8=9B=20store?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{investigatefactsAdd.vue => AddPage.vue} | 76 +++++---------- .../2_InvestigateFacts/MainPage.vue | 93 +++++-------------- .../11_discipline/interface/index/Main.ts | 11 ++- src/modules/11_discipline/router.ts | 2 +- .../stroes/InvestigateFactStore.ts | 73 +++++++++++---- 5 files changed, 111 insertions(+), 144 deletions(-) rename src/modules/11_discipline/components/2_InvestigateFacts/{investigatefactsAdd.vue => AddPage.vue} (85%) 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