Merge branch 'develop' into dev
All checks were successful
Build & Deploy on Dev / build (push) Successful in 2m0s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 2m0s
* develop: fix bug: "ADMIN" only disable action
This commit is contained in:
commit
3d238d2400
7 changed files with 75 additions and 23 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { reactive, ref, watch } from "vue";
|
import { reactive, ref, watch, onMounted } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
|
|
||||||
|
|
@ -8,6 +8,7 @@ import config from "@/app.config";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { useDataStoreUser } from "@/modules/02_users/stores/main";
|
import { useDataStoreUser } from "@/modules/02_users/stores/main";
|
||||||
import { usekeycloakPosition } from "@/stores/keycloakPosition";
|
import { usekeycloakPosition } from "@/stores/keycloakPosition";
|
||||||
|
import { tokenParsed } from "@/plugins/auth";
|
||||||
|
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
import type {
|
import type {
|
||||||
|
|
@ -171,12 +172,17 @@ function onClose() {
|
||||||
selected.value = [];
|
selected.value = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const tokenParsedData = ref<string[]>([]);
|
||||||
/**
|
/**
|
||||||
* ซ่อน checkbox ของผู้ใช้งานที่กำลังล็อกอินอยู่
|
* ซ่อน checkbox ของผู้ใช้งานที่กำลังล็อกอินอยู่
|
||||||
* @param id รหัสผู้ใช้งาน
|
* @param id รหัสผู้ใช้งาน
|
||||||
*/
|
*/
|
||||||
function hideCheckbox(id: string) {
|
function hideCheckbox(id: string) {
|
||||||
if (dataPosition.value?.profileId === id) {
|
if (
|
||||||
|
dataPosition.value?.profileId === id &&
|
||||||
|
tokenParsedData.value.includes("ADMIN") &&
|
||||||
|
!tokenParsedData.value.includes("SUPER_ADMIN")
|
||||||
|
) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -194,6 +200,11 @@ watch(
|
||||||
onSearchListPerson(true);
|
onSearchListPerson(true);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
const token = await tokenParsed();
|
||||||
|
tokenParsedData.value = token?.role || [];
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { reactive, ref, watch } from "vue";
|
import { reactive, ref, watch, onMounted } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
|
|
||||||
|
|
@ -8,6 +8,7 @@ import config from "@/app.config";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { useDataStoreUser } from "@/modules/02_users/stores/main";
|
import { useDataStoreUser } from "@/modules/02_users/stores/main";
|
||||||
import { usekeycloakPosition } from "@/stores/keycloakPosition";
|
import { usekeycloakPosition } from "@/stores/keycloakPosition";
|
||||||
|
import { tokenParsed } from "@/plugins/auth";
|
||||||
|
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
import type {
|
import type {
|
||||||
|
|
@ -187,12 +188,17 @@ function onClose() {
|
||||||
isCheck.value = false;
|
isCheck.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const tokenParsedData = ref<string[]>([]);
|
||||||
/**
|
/**
|
||||||
* ซ่อน checkbox ของผู้ใช้งานที่กำลังล็อกอินอยู่
|
* ซ่อน checkbox ของผู้ใช้งานที่กำลังล็อกอินอยู่
|
||||||
* @param id รหัสผู้ใช้งาน
|
* @param id รหัสผู้ใช้งาน
|
||||||
*/
|
*/
|
||||||
function hideCheckbox(id: string) {
|
function hideCheckbox(id: string) {
|
||||||
if (dataPosition.value?.profileId === id) {
|
if (
|
||||||
|
dataPosition.value?.profileId === id &&
|
||||||
|
tokenParsedData.value.includes("ADMIN") &&
|
||||||
|
!tokenParsedData.value.includes("SUPER_ADMIN")
|
||||||
|
) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -210,6 +216,11 @@ watch(
|
||||||
onSearchListPerson(true);
|
onSearchListPerson(true);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
const token = await tokenParsed();
|
||||||
|
tokenParsedData.value = token?.role || [];
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
||||||
|
|
@ -232,8 +232,7 @@ async function fetchOrganizationActive() {
|
||||||
* @param id id โครงสร้าง
|
* @param id id โครงสร้าง
|
||||||
*/
|
*/
|
||||||
async function fetchDataTree(id: string) {
|
async function fetchDataTree(id: string) {
|
||||||
const tokenParsedData = await tokenParsed();
|
const isSuperAdmin = tokenParsedData.value.includes("SUPER_ADMIN");
|
||||||
const isSuperAdmin = tokenParsedData.role.includes("SUPER_ADMIN");
|
|
||||||
if (!isSuperAdmin) {
|
if (!isSuperAdmin) {
|
||||||
nodeTree.value = [];
|
nodeTree.value = [];
|
||||||
}
|
}
|
||||||
|
|
@ -436,13 +435,18 @@ watch(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const tokenParsedData = ref<string[]>([]);
|
||||||
/**
|
/**
|
||||||
* ตรวจสอบการแสดงปุ่ม action
|
* ตรวจสอบการแสดงปุ่ม action
|
||||||
* @param keycloakID keycloakID รหัสผู้ใช้งาน
|
* @param keycloakID keycloakID รหัสผู้ใช้งาน
|
||||||
* @returns true หากผู้ใช้งานมีสิทธิ์ในการดำเนินการ
|
* @returns true หากผู้ใช้งานมีสิทธิ์ในการดำเนินการ
|
||||||
*/
|
*/
|
||||||
function checkhideBtnAction(keycloakID: string) {
|
function checkhideBtnAction(keycloakID: string) {
|
||||||
if (dataPosition.value?.keycloak === keycloakID) {
|
if (
|
||||||
|
dataPosition.value?.keycloak === keycloakID &&
|
||||||
|
tokenParsedData.value.includes("ADMIN") &&
|
||||||
|
!tokenParsedData.value.includes("SUPER_ADMIN")
|
||||||
|
) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -455,6 +459,8 @@ function checkhideBtnAction(keycloakID: string) {
|
||||||
*/
|
*/
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await fetchOrganizationActive();
|
await fetchOrganizationActive();
|
||||||
|
const token = await tokenParsed();
|
||||||
|
tokenParsedData.value = token.role || [];
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -286,13 +286,13 @@ async function fetchOrganizationActive() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const tokenParsedData = ref<string[]>([]);
|
||||||
/**
|
/**
|
||||||
* function fetch ข้อมูลของ Tree
|
* function fetch ข้อมูลของ Tree
|
||||||
* @param id id โครงสร้าง
|
* @param id id โครงสร้าง
|
||||||
*/
|
*/
|
||||||
async function fetchDataTree(id: string) {
|
async function fetchDataTree(id: string) {
|
||||||
const tokenParsedData = await tokenParsed();
|
const isSuperAdmin = tokenParsedData.value.includes("SUPER_ADMIN");
|
||||||
const isSuperAdmin = tokenParsedData.role.includes("SUPER_ADMIN");
|
|
||||||
if (!isSuperAdmin) {
|
if (!isSuperAdmin) {
|
||||||
nodes.value = [];
|
nodes.value = [];
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -501,15 +501,21 @@ function isUpload() {
|
||||||
* @returns true หากผู้ใช้งานมีสิทธิ์ในการดำเนินการ
|
* @returns true หากผู้ใช้งานมีสิทธิ์ในการดำเนินการ
|
||||||
*/
|
*/
|
||||||
function checkhideBtnAction(current_holderId: string) {
|
function checkhideBtnAction(current_holderId: string) {
|
||||||
if (dataPosition.value?.profileId === current_holderId) {
|
if (
|
||||||
|
dataPosition.value?.profileId === current_holderId &&
|
||||||
|
tokenParsedData.value.includes("ADMIN") &&
|
||||||
|
!tokenParsedData.value.includes("SUPER_ADMIN")
|
||||||
|
) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(async () => {
|
||||||
fetchOrganizationActive();
|
fetchOrganizationActive();
|
||||||
|
const token = await tokenParsed();
|
||||||
|
tokenParsedData.value = token.role || [];
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,9 +63,8 @@ const personId = ref<string>("");
|
||||||
* ฟังก์ชันดึงข้อมูลโครงสร้าง
|
* ฟังก์ชันดึงข้อมูลโครงสร้าง
|
||||||
* เก็บข้อมูลโครงสร้างไว้ใน nodeTree
|
* เก็บข้อมูลโครงสร้างไว้ใน nodeTree
|
||||||
*/
|
*/
|
||||||
async function fatchOrg() {
|
async function fetchOrg() {
|
||||||
const tokenParsedData = await tokenParsed();
|
const isSuperAdmin = tokenParsedData.value.includes("SUPER_ADMIN");
|
||||||
const isSuperAdmin = tokenParsedData.role.includes("SUPER_ADMIN");
|
|
||||||
if (!isSuperAdmin) {
|
if (!isSuperAdmin) {
|
||||||
nodeTree.value = [];
|
nodeTree.value = [];
|
||||||
}
|
}
|
||||||
|
|
@ -215,8 +214,13 @@ function updatemodalPersonal(modal: boolean) {
|
||||||
modalPersonal.value = modal;
|
modalPersonal.value = modal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const tokenParsedData = ref<string[]>([]);
|
||||||
function checkhideBtnAction(id: string) {
|
function checkhideBtnAction(id: string) {
|
||||||
if (dataPosition.value?.profileId === id) {
|
if (
|
||||||
|
dataPosition.value?.profileId === id &&
|
||||||
|
tokenParsedData.value.includes("ADMIN") &&
|
||||||
|
!tokenParsedData.value.includes("SUPER_ADMIN")
|
||||||
|
) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -236,7 +240,9 @@ watch(
|
||||||
|
|
||||||
/** hook ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
|
/** hook ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await fatchOrg(); // ดึงข้อมูลโครงสร้าง
|
await fetchOrg(); // ดึงข้อมูลโครงสร้าง
|
||||||
|
const token = await tokenParsed();
|
||||||
|
tokenParsedData.value = token?.role || [];
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -273,13 +273,13 @@ async function fetchOrganizationActive() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const tokenParsedData = ref<string[]>([]);
|
||||||
/**
|
/**
|
||||||
* function fetch ข้อมูลของ Tree
|
* function fetch ข้อมูลของ Tree
|
||||||
* @param id id โครงสร้าง
|
* @param id id โครงสร้าง
|
||||||
*/
|
*/
|
||||||
async function fetchDataTree(id: string) {
|
async function fetchDataTree(id: string) {
|
||||||
const tokenParsedData = await tokenParsed();
|
const isSuperAdmin = tokenParsedData.value.includes("SUPER_ADMIN");
|
||||||
const isSuperAdmin = tokenParsedData.role.includes("SUPER_ADMIN");
|
|
||||||
if (!isSuperAdmin) {
|
if (!isSuperAdmin) {
|
||||||
nodes.value = [];
|
nodes.value = [];
|
||||||
}
|
}
|
||||||
|
|
@ -411,7 +411,11 @@ function updatemodalPersonal(modal: boolean) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideBtnAction(id: string) {
|
function hideBtnAction(id: string) {
|
||||||
if (dataPosition.value?.profileId === id) {
|
if (
|
||||||
|
dataPosition.value?.profileId === id &&
|
||||||
|
tokenParsedData.value.includes("ADMIN") &&
|
||||||
|
!tokenParsedData.value.includes("SUPER_ADMIN")
|
||||||
|
) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -432,8 +436,10 @@ watch(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(async () => {
|
||||||
fetchOrganizationActive();
|
fetchOrganizationActive();
|
||||||
|
const token = await tokenParsed();
|
||||||
|
tokenParsedData.value = token?.role || [];
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,13 +82,13 @@ async function fatchOrg() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const tokenParsedData = ref<string[]>([]);
|
||||||
/**
|
/**
|
||||||
* function fetch ข้อมูลของ Tree
|
* function fetch ข้อมูลของ Tree
|
||||||
* @param id id โครงสร้าง
|
* @param id id โครงสร้าง
|
||||||
*/
|
*/
|
||||||
async function fetchDataTree(id: string) {
|
async function fetchDataTree(id: string) {
|
||||||
const tokenParsedData = await tokenParsed();
|
const isSuperAdmin = tokenParsedData.value.includes("SUPER_ADMIN");
|
||||||
const isSuperAdmin = tokenParsedData.role.includes("SUPER_ADMIN");
|
|
||||||
if (!isSuperAdmin) {
|
if (!isSuperAdmin) {
|
||||||
nodeTree.value = [];
|
nodeTree.value = [];
|
||||||
}
|
}
|
||||||
|
|
@ -260,7 +260,11 @@ function updatemodalPersonal(modal: boolean) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideBtnAction(id: string) {
|
function hideBtnAction(id: string) {
|
||||||
if (dataPosition.value?.profileId === id) {
|
if (
|
||||||
|
dataPosition.value?.profileId === id &&
|
||||||
|
tokenParsedData.value.includes("ADMIN") &&
|
||||||
|
!tokenParsedData.value.includes("SUPER_ADMIN")
|
||||||
|
) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -281,6 +285,8 @@ watch(
|
||||||
/** hook ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
|
/** hook ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await fatchOrg(); // ดึงข้อมูลโครงสร้าง
|
await fatchOrg(); // ดึงข้อมูลโครงสร้าง
|
||||||
|
const token = await tokenParsed();
|
||||||
|
tokenParsedData.value = token?.role || [];
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue