From 90568eac79a03caca53ed7f33af9e77a1388aa71 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Mon, 11 Nov 2024 13:11:42 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=81=E0=B8=B3=E0=B8=AB=E0=B8=99=E0=B8=94?= =?UTF-8?q?=E0=B8=AA=E0=B8=B4=E0=B8=97=E0=B8=98=E0=B8=B4=E0=B9=8C=E0=B8=88?= =?UTF-8?q?=E0=B8=B1=E0=B8=94=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B9=82=E0=B8=84?= =?UTF-8?q?=E0=B8=A3=E0=B8=87=E0=B8=AA=E0=B8=A3=E0=B9=89=E0=B8=B2=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/interface/request/main/main.ts | 12 ++++++++++++ .../02_users/views/04_roleOrganization.vue | 15 ++++++--------- src/views/MainLayout.vue | 7 ++++--- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/interface/request/main/main.ts b/src/interface/request/main/main.ts index 5551d655..2c60d49e 100644 --- a/src/interface/request/main/main.ts +++ b/src/interface/request/main/main.ts @@ -63,26 +63,31 @@ const menuList = readonly([ key: 2.0, label: "ข้อมูลเกี่ยวกับบุคคล", path: "masterPersonal", + role: ["SUPER_ADMIN"], }, { key: 2.0, label: "ข้อมูลตำแหน่งข้าราชการ ฯ", path: "masterPosition", + role: ["SUPER_ADMIN"], }, { key: 2.0, label: "ข้อมูลตำแหน่งลูกจ้างประจำ", path: "masterPositionEmployee", + role: ["SUPER_ADMIN"], }, { key: 2.0, label: "ข้อมูลปฏิทินวันหยุด", path: "masterCalendarWork", + role: ["SUPER_ADMIN"], }, { key: 2.0, label: "ข้อมูลเครื่องราชอิสริยาภรณ์", path: "masterInsigniaPage", + role: ["SUPER_ADMIN"], }, ], }, @@ -97,26 +102,31 @@ const menuList = readonly([ key: 2.0, label: "จัดการผู้ใช้งาน", path: "manageUsers", + role: ["SUPER_ADMIN", "ADMIN"], }, { key: 2.0, label: "จัดการบทบาทและสิทธิ์ (Roles)", path: "manageRoles", + role: ["SUPER_ADMIN"], }, { key: 2.0, label: "กำหนดสิทธิ์ (Permissions)", path: "managePermission", + role: ["SUPER_ADMIN", "ADMIN"], }, { key: 2.0, label: "กำหนดสิทธิ์จัดการโครงสร้าง", path: "roleOrganization", + role: ["SUPER_ADMIN", "ADMIN"], }, { key: 2.0, label: "มอบหมายหน้าที่ความรับผิดชอบ", path: "responsibilities", + role: ["SUPER_ADMIN", "ADMIN"], }, ], }, @@ -147,11 +157,13 @@ const menuList = readonly([ key: 2.0, label: "รายการคำสั่ง", path: "commandTemplate", + role: ["SUPER_ADMIN"], }, { key: 2.0, label: "ต้นแบบสำหรับลงในตำแหน่ง/เงินเดือน", path: "salaryTemplate", + role: ["SUPER_ADMIN"], }, ], }, diff --git a/src/modules/02_users/views/04_roleOrganization.vue b/src/modules/02_users/views/04_roleOrganization.vue index ec09d354..6b4835b2 100644 --- a/src/modules/02_users/views/04_roleOrganization.vue +++ b/src/modules/02_users/views/04_roleOrganization.vue @@ -30,7 +30,6 @@ const orgId = ref(""); // id หน่วยงานที่เลื /** * ฟังก์ชันดึงข้อมูลโครงสร้าง - * * เก็บข้อมูลโครงสร้างไว้ใน nodeTree */ async function fatchOrg() { @@ -40,6 +39,11 @@ async function fatchOrg() { .then(async (res) => { const data = await res.data.result; nodeTree.value = data; + if (data.length === 1) { + selectedOrg(data[0].id); + } else { + await fetchListPerson(); // ดึงข้อมูลรายชื่อคนที่มีสิทธิ์จัดการโครงสร้าง + } }) .catch((err) => { messageError($q, err); @@ -52,7 +56,6 @@ async function fatchOrg() { /** * ฟังก์ชันเลือกหน่วยงาน * @param id หน่วยงานที่เลือก - * * กำหนดค่าของ qureyBody ให้เป็นค่า defult และกำหนดค่าของ qureyBody.id เป็นหน่วยงานที่เลือก * และดึงข้อมูลรายชื่อคนที่มีสิทธิ์จัดการโครงสร้างในหน่วยงานที่เลือก */ @@ -157,7 +160,6 @@ async function fetchListPerson(newPage: boolean = false) { /** * ฟังก์ชันยืนยันการลบรายชื่อคนที่มีสิทธิ์จัดการโครงสร้าง * @param id รายชื่อคนที่มีสิทธิ์จัดการโครงสร้าง - * * ลบเสร็จจะโหลดข้อมูลรายชื่อคนที่มีสิทธิ์จัดการโครงสร้าง */ function onDeletePerson(id: string) { @@ -197,7 +199,6 @@ function updatePagination(newPagination: Pagination) { /** * ดูการเปลี่ยนแปลงของ pageSize ใน queryBody - * * เมื่อ pageSize มีการเปลี่ยนแปลงให้โหลดข้อมูลหน้าแรก */ watch( @@ -209,13 +210,9 @@ watch( /** * hook ทำงานเมื่อ Components ถูกเรียกใช้งาน - * */ onMounted(async () => { - await Promise.all([ - fatchOrg(), // ดึงข้อมูลโครงสร้าง - fetchListPerson(), // ดึงข้อมูลรายชื่อคนที่มีสิทธิ์จัดการโครงสร้าง - ]); + await fatchOrg(); // ดึงข้อมูลโครงสร้าง }); diff --git a/src/views/MainLayout.vue b/src/views/MainLayout.vue index 7ce59e15..8f887f18 100644 --- a/src/views/MainLayout.vue +++ b/src/views/MainLayout.vue @@ -889,14 +889,15 @@ onUnmounted(() => { :to="{ name: `${subMenu2.path}` }" > - {{ subMenu2.label }} + + {{ subMenu2.label }} +