fix bug: "ADMIN" only disable action
This commit is contained in:
parent
3856035ce1
commit
d4b61dd490
7 changed files with 75 additions and 23 deletions
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { reactive, ref, watch, onMounted } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import { storeToRefs } from "pinia";
|
||||
|
||||
|
|
@ -8,6 +8,7 @@ import config from "@/app.config";
|
|||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useDataStoreUser } from "@/modules/02_users/stores/main";
|
||||
import { usekeycloakPosition } from "@/stores/keycloakPosition";
|
||||
import { tokenParsed } from "@/plugins/auth";
|
||||
|
||||
import type { QTableProps } from "quasar";
|
||||
import type {
|
||||
|
|
@ -187,12 +188,17 @@ function onClose() {
|
|||
isCheck.value = false;
|
||||
}
|
||||
|
||||
const tokenParsedData = ref<string[]>([]);
|
||||
/**
|
||||
* ซ่อน checkbox ของผู้ใช้งานที่กำลังล็อกอินอยู่
|
||||
* @param id รหัสผู้ใช้งาน
|
||||
*/
|
||||
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;
|
||||
} else {
|
||||
return true;
|
||||
|
|
@ -210,6 +216,11 @@ watch(
|
|||
onSearchListPerson(true);
|
||||
}
|
||||
);
|
||||
|
||||
onMounted(async () => {
|
||||
const token = await tokenParsed();
|
||||
tokenParsedData.value = token?.role || [];
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue