fix:hideBtnAction

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-11-04 11:46:54 +07:00
parent a760910794
commit 8b4ea6da38
12 changed files with 277 additions and 26 deletions

View file

@ -5,6 +5,7 @@ import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { tokenParsed } from "@/plugins/auth";
/** importComponents*/
import DialogHeader from "@/components/DialogHeader.vue";
@ -67,6 +68,7 @@ const columns = ref<QTableProps["columns"]>([
const visibleColumns = ref<string[]>(["roleName", "roleDescription"]);
const selected = ref<Roles[]>([]);
const roleUser = ref<string[]>([]);
function closeDialog() {
modal.value = false;
@ -74,10 +76,19 @@ function closeDialog() {
keyword.value = "";
}
function fetchListRoles() {
async function fetchListRoles() {
showLoader();
http
.get(config.API.managementAuth + `/list`)
const isCheckRole = roleUser.value.includes("SUPER_ADMIN") ? true : false;
const param: { params?: { isAdminVisibled: string } } = {};
if (!isCheckRole) {
param.params = {
isAdminVisibled: "true",
};
}
await http
.get(config.API.managementAuth + `/list`, param)
.then((res) => {
const data = res.data.result;
rows.value = data;
@ -138,8 +149,12 @@ function serchDataTable() {
watch(
() => modal.value,
() => {
modal.value && fetchListRoles();
async () => {
if (modal.value) {
const token = await tokenParsed();
roleUser.value = token?.role || [];
await fetchListRoles();
}
}
);
</script>