From 91fc7f7520ff8048406ad7a71f846d1636a94f97 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Wed, 18 Oct 2023 11:46:28 +0700 Subject: [PATCH 1/3] =?UTF-8?q?UI=20-=20=E0=B8=AA=E0=B8=B7=E0=B8=9A?= =?UTF-8?q?=E0=B8=AA=E0=B8=A7=E0=B8=99=E0=B8=82=E0=B9=89=E0=B8=AD=E0=B9=80?= =?UTF-8?q?=E0=B8=97=E0=B9=87=E0=B8=88=E0=B8=88=E0=B8=A3=E0=B8=B4=E0=B8=87?= =?UTF-8?q?=20=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 From 5947797d267be0760c7cbafceee88468664d00c2 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Wed, 18 Oct 2023 12:00:11 +0700 Subject: [PATCH 2/3] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=20value=20=3D>?= =?UTF-8?q?=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../11_discipline/stroes/InvestigateFactStore.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/modules/11_discipline/stroes/InvestigateFactStore.ts b/src/modules/11_discipline/stroes/InvestigateFactStore.ts index 6c40d31a1..99c039f89 100644 --- a/src/modules/11_discipline/stroes/InvestigateFactStore.ts +++ b/src/modules/11_discipline/stroes/InvestigateFactStore.ts @@ -26,23 +26,26 @@ export const useInvestigateFactStore = defineStore("DisciplineInvestigateFact", 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 + (v: any) => v.name.toLowerCase().indexOf(needle) > -1 ); + } else if (type === "investigationOp") { investigationOp.value = investigationOps.value.filter( - (v: any) => v.value.toLowerCase().indexOf(needle) > -1 + (v: any) => v.name.toLowerCase().indexOf(needle) > -1 ); } else if (type === "daysExtendOp") { daysExtendOp.value = daysExtendOps.value.filter( - (v: any) => v.value.toLowerCase().indexOf(needle) > -1 + (v: any) => v.name.toLowerCase().indexOf(needle) > -1 ); } + }); } - async function fecthList(data:investigatefactsDataRowType[]) { - let datalist:investigatefactsDataRowType[] = data.map((e: any) => ({ + async function fecthList(data: investigatefactsDataRowType[]) { + let datalist: investigatefactsDataRowType[] = data.map((e: any) => ({ subject: e.subject, interrogated: e.interrogated, fault: e.fault ?? convertFault(e.fault), From 1a07ac17da88ba702a1ae0777f2f43db6e26577b Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Wed, 18 Oct 2023 12:13:55 +0700 Subject: [PATCH 3/3] =?UTF-8?q?UI=20-=20=E0=B8=A7=E0=B8=B4=E0=B8=99?= =?UTF-8?q?=E0=B8=B1=E0=B8=A2=20=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=87?= =?UTF-8?q?=E0=B8=B2=E0=B8=99=20=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=20any?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{reportDetail.vue => DetailPage.vue} | 72 +++++-------------- src/modules/11_discipline/router.ts | 2 +- .../11_discipline/stroes/ReportStore.ts | 68 ++++++++++++++---- 3 files changed, 70 insertions(+), 72 deletions(-) rename src/modules/11_discipline/components/5_Report/{reportDetail.vue => DetailPage.vue} (83%) diff --git a/src/modules/11_discipline/components/5_Report/reportDetail.vue b/src/modules/11_discipline/components/5_Report/DetailPage.vue similarity index 83% rename from src/modules/11_discipline/components/5_Report/reportDetail.vue rename to src/modules/11_discipline/components/5_Report/DetailPage.vue index 4f36355c0..54b333f26 100644 --- a/src/modules/11_discipline/components/5_Report/reportDetail.vue +++ b/src/modules/11_discipline/components/5_Report/DetailPage.vue @@ -4,52 +4,31 @@ import { VuePDF, usePDF } from "@tato30/vue-pdf"; import { useCounterMixin } from "@/stores/mixin"; import { useRoute } from "vue-router"; import { useQuasar } from "quasar"; - +import type { DataOption } from "@/modules/11_discipline/interface/index/Main"; import { useReportDataStore } from "@/modules/11_discipline/stroes/ReportStore"; import http from "@/plugins/http"; import config from "@/app.config"; -const date = ref(null); -const dateEnd = ref(null); +const date = ref(); +const dateEnd = ref(); const route = useRoute(); const typeReport = route.params.type.toString(); const store = useReportDataStore(); const mixin = useCounterMixin(); const { messageError, showLoader, hideLoader, date2Thai } = mixin; -const { optionReport } = store; +const { filterFnOptionsType } = store; const $q = useQuasar(); const ocSelect = ref(""); -const ocSelectOp = ref(); -const ocSelectOps = ref([ - { id: "001", value: "กทม" }, - { id: "002", value: "กรุงเทพ" }, -]); const government = ref(""); -const governmentOp = ref(); -const governmentOps = ref([ - { id: "001", value: "กทม" }, - { id: "002", value: "กรุงเทพ" }, - { id: "003", value: "bankok" }, -]); -const fault = ref(); -const faultOp = ref(); -const faultOps = ref([ - { id: "001", value: "ยังไม่ระบุ" }, - { id: "002", value: "ไม่ร้ายเเรง" }, - { id: "003", value: "ร้ายเเรง" }, -]); +const fault = ref(); const pdfSrc = ref(); const numOfPages = ref(0); const page = ref(1); const titleReport = ref(""); -interface OptionReport { - id: string; - title: string; -} onMounted(async () => { - let report = optionReport.find((e: OptionReport) => e.id == typeReport); - report && (titleReport.value = report.title); + let report = store.optionReport.find((e: DataOption) => e.id == typeReport); + report && (titleReport.value = report.name); }); const splitterModel = ref(14); @@ -75,25 +54,6 @@ const backPage = () => { page.value--; } }; - -function filterFnOptionsType(val: string, update: any, type: string) { - update(() => { - const needle = val.toLowerCase(); - if (type === "ocSelectOp") { - ocSelectOp.value = ocSelectOps.value.filter( - (v: any) => v.value.toLowerCase().indexOf(needle) > -1 - ); - } else if (type === "governmentOp") { - governmentOp.value = governmentOps.value.filter( - (v: any) => v.value.toLowerCase().indexOf(needle) > -1 - ); - } else if (type === "faultOp") { - faultOp.value = faultOps.value.filter( - (v: any) => v.value.toLowerCase().indexOf(needle) > -1 - ); - } - }); -}