feat: 租户/菜单只有管理员才能访问
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import { ref } from 'vue';
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useAccess } from '@vben/access';
|
||||
import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui';
|
||||
import { Fallback } from '@vben/common-ui';
|
||||
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
@@ -131,11 +132,19 @@ function handleMultiDelete() {
|
||||
},
|
||||
});
|
||||
}
|
||||
const { hasAccessByCodes } = useAccess();
|
||||
/**
|
||||
* 与后台逻辑相同
|
||||
* 只有超级管理员能访问租户相关
|
||||
*/
|
||||
const { hasAccessByCodes, hasAccessByRoles } = useAccess();
|
||||
|
||||
const isSuperAdmin = computed(() => {
|
||||
return hasAccessByRoles(['superadmin']);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page :auto-content-height="true">
|
||||
<Page v-if="isSuperAdmin" :auto-content-height="true">
|
||||
<BasicTable>
|
||||
<template #toolbar-actions>
|
||||
<span class="pl-[7px] text-[16px]">租户列表 </span>
|
||||
@@ -202,4 +211,5 @@ const { hasAccessByCodes } = useAccess();
|
||||
</BasicTable>
|
||||
<TenantDrawer @reload="tableApi.query()" />
|
||||
</Page>
|
||||
<Fallback v-else description="您没有租户的访问权限" status="403" />
|
||||
</template>
|
||||
|
Reference in New Issue
Block a user