From a3536816059ab1f764ad5c3f8056a89a248cba35 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Mon, 24 Feb 2025 11:41:25 +0700 Subject: [PATCH] =?UTF-8?q?filter=20=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=87?= =?UTF-8?q?=E0=B8=B2=E0=B8=99=E0=B8=97=E0=B8=B0=E0=B9=80=E0=B8=9A=E0=B8=B5?= =?UTF-8?q?=E0=B8=A2=E0=B8=99=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B8=A7=E0=B8=B1?= =?UTF-8?q?=E0=B8=95=E0=B8=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../21_report/views/02_reportRegistry.vue | 172 +++++++++++++++--- 1 file changed, 144 insertions(+), 28 deletions(-) diff --git a/src/modules/21_report/views/02_reportRegistry.vue b/src/modules/21_report/views/02_reportRegistry.vue index ecaf4cca6..3d70e56a9 100644 --- a/src/modules/21_report/views/02_reportRegistry.vue +++ b/src/modules/21_report/views/02_reportRegistry.vue @@ -5,10 +5,12 @@ import * as XLSX from "xlsx"; import http from "@/plugins/http"; import config from "@/app.config"; +import { useRoute } from "vue-router"; import { checkPermission } from "@/utils/permissions"; import { useCounterMixin } from "@/stores/mixin"; import { useReportStore } from "@/modules/21_report/store"; import { useRegistryNewDataStore } from "@/modules/04_registryPerson/store"; +import { useStructureTree } from "@/stores/structureTree"; import type { OptionData } from "@/modules/07_insignia/interface/index/Main"; import type { @@ -24,9 +26,10 @@ import type { import DialogOrg from "@/modules/21_report/components/01_org/DialogOrg.vue"; const $q = useQuasar(); +const route = useRoute(); const storeReport = useReportStore(); const stroeRegistry = useRegistryNewDataStore(); - +const { fetchStructureTree } = useStructureTree(); const mixin = useCounterMixin(); const { messageError, showLoader, hideLoader, date2Thai } = mixin; @@ -486,8 +489,8 @@ async function onSearch() { education: education.value, ageMin: rangeAge.value.min, ageMax: rangeAge.value.max, - dateStart: dateStart.value ?? "", - dateEnd: dateEnd.value ?? "", + dateStart: dateStart.value ?? null, + dateEnd: dateEnd.value ?? null, isProbation: isProbation.value, isRetire: isRetire.value, @@ -587,15 +590,44 @@ function clearFilter() { isProbation.value = false; //ทดลองปฏิบัติราชการ isRetire.value = false; //แสดงผู้พ้นจากราชการ retireType.value = ""; //ประเภมการพ้นราชการ + + expandedModal.value = false; + filterTree.value = ""; } watch( () => pagination.value.descending, () => { - sortBy.value = pagination.value.descending ? "DESC" : "ASC"; + if (pagination.value.sortBy === "dateAppoint") { + sortBy.value = pagination.value.descending ? "DESC" : "ASC"; + } } ); +const node = ref([]); +const filterTree = ref(""); +const expanded = ref([]); +const expandedModal = ref(false); + +async function fetchTree() { + const data = await fetchStructureTree(route.meta.Key as string, true); + if (data) { + node.value = data; + } +} + +/** + * ฟังก์ชันเลือกหน่วยงาน/ส่วนราชการ + * @param data ข้อมูลหน่วยงาน/ส่วนราชการที่ต้องการค้นหาร + * เพื่อค้นหาข้อมูลตามหน่วยงาน/ส่วนราชการ + */ +function updateSelectedTreeMain(data: any) { + org.value = data.orgName; + storeReport.formFilter.node = data.orgLevel; + storeReport.formFilter.nodeId = data.orgTreeId; + expandedModal.value = false +} + onMounted(async () => { showLoader(); Promise.all([ @@ -604,6 +636,7 @@ onMounted(async () => { getExecutive(), getDataPerson(), getEducationLevel(), + fetchTree(), ]) .catch((e) => { @@ -750,29 +783,103 @@ onMounted(async () => {
-
- + -