From 1a07ac17da88ba702a1ae0777f2f43db6e26577b Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Wed, 18 Oct 2023 12:13:55 +0700 Subject: [PATCH] =?UTF-8?q?UI=20-=20=E0=B8=A7=E0=B8=B4=E0=B8=99=E0=B8=B1?= =?UTF-8?q?=E0=B8=A2=20=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=87=E0=B8=B2?= =?UTF-8?q?=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 - ); - } - }); -}