fix bug: "ADMIN" only disable action

This commit is contained in:
Warunee Tamkoo 2025-11-08 21:35:03 +07:00
parent 3856035ce1
commit d4b61dd490
7 changed files with 75 additions and 23 deletions

View file

@ -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 {
@ -171,12 +172,17 @@ function onClose() {
selected.value = [];
}
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;
@ -194,6 +200,11 @@ watch(
onSearchListPerson(true);
}
);
onMounted(async () => {
const token = await tokenParsed();
tokenParsedData.value = token?.role || [];
});
</script>
<template>