From f5ffae0d87f4bebae79a92292173085f9abdc593 Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Mon, 19 Aug 2024 16:26:45 +0700 Subject: [PATCH] fixing list tree registry by system --- src/api/02_organizational/api.organization.ts | 1 + src/modules/04_registryPerson/views/list.vue | 25 +++++++++++++------ .../components/DialogSelectPos.vue | 4 ++- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/api/02_organizational/api.organization.ts b/src/api/02_organizational/api.organization.ts index 92d126242..61cdba2a1 100644 --- a/src/api/02_organizational/api.organization.ts +++ b/src/api/02_organizational/api.organization.ts @@ -13,6 +13,7 @@ export default { /** โครงสร้างอัตรากำลัง*/ activeOrganization: `${organization}/active`, orgByid: (id: string) => `${organization}/${id}`, + orgByIdSystem: (id: string, sys: string) => `${organization}/${id}/${sys}`, createOrganization: `${organization}/draft`, createOrgLevel: (type: string) => `${organization}/${type}`, orgLevelByid: (type: string, id: string) => `${organization}/${type}/${id}`, diff --git a/src/modules/04_registryPerson/views/list.vue b/src/modules/04_registryPerson/views/list.vue index d7aa64e7d..c88ecb7b9 100644 --- a/src/modules/04_registryPerson/views/list.vue +++ b/src/modules/04_registryPerson/views/list.vue @@ -250,8 +250,10 @@ async function selectType() { store.labelOption.posType = "ทั้งหมด"; store.labelOption.posLevel = "ทั้งหมด"; store.formFilter.type = empType.value; - store.labelOption.node = empType.value === "officer" ? "เลือกหน่วยงาน/ส่วนราชการ":'เลือกหน่วยงาน'; - + store.labelOption.node = + empType.value === "officer" + ? "เลือกหน่วยงาน/ส่วนราชการ" + : "เลือกหน่วยงาน"; } else { // แต่ถ้าประเภทเดิมระบบจะใช้ filter เดิมที่เคยค้นหาไว้ if ( @@ -305,10 +307,13 @@ function clearSelect(t: string) { } else if (t === "rangeYear") { store.formFilter.rangeYear.min = 0; store.formFilter.rangeYear.max = 60; - }else if (t === "org") { + } else if (t === "org") { nodeData.node = null; nodeData.nodeId = null; - store.labelOption.node = empType.value === "officer" ? "เลือกหน่วยงาน/ส่วนราชการ":'เลือกหน่วยงาน'; + store.labelOption.node = + empType.value === "officer" + ? "เลือกหน่วยงาน/ส่วนราชการ" + : "เลือกหน่วยงาน"; } store.formFilter.page = 1; fetchDataPerson(); @@ -317,7 +322,7 @@ function clearSelect(t: string) { async function fetchTree(id: string) { showLoader(); http - .get(config.API.orgByid(id.toString())) + .get(config.API.orgByIdSystem(id.toString(), route.meta.Key)) .then((res) => { const data = res.data.result; node.value = data; @@ -367,7 +372,10 @@ function updateSelectedTreeMain(data: any) { if (nodeData.node === data.orgLevel && nodeData.nodeId === data.orgTreeId) { store.nodeData.node = null; store.nodeData.nodeId = null; - nodeData.name = empType.value === "officer" ? "เลือกหน่วยงาน/ส่วนราชการ":'เลือกหน่วยงาน'; + nodeData.name = + empType.value === "officer" + ? "เลือกหน่วยงาน/ส่วนราชการ" + : "เลือกหน่วยงาน"; } else { store.nodeData.node = data.orgLevel; store.nodeData.nodeId = data.orgTreeId; @@ -481,7 +489,10 @@ onMounted(async () => { }` }} import { ref, reactive, watch } from "vue"; import { useQuasar } from "quasar"; +import { useRoute } from "vue-router"; import http from "@/plugins/http"; import config from "@/app.config"; @@ -31,6 +32,7 @@ const { dialogConfirm, } = useCounterMixin(); +const route = useRoute(); /**props*/ const modal = defineModel("modal", { required: true }); const props = defineProps({ @@ -227,7 +229,7 @@ async function fetchOrganizationActive() { async function fetchDataTree(id: string) { showLoader(); await http - .get(config.API.orgByid(id.toString())) + .get(config.API.orgByIdSystem(id.toString(), route.meta.Key)) .then((res) => { const data = res.data.result; if (data) {