fix: 关闭租户不应显示同步租户字典按钮

This commit is contained in:
dap 2024-10-08 14:16:33 +08:00
parent bda0711bbd
commit 335dc0cc11
2 changed files with 27 additions and 4 deletions

View File

@ -1,6 +1,18 @@
1.0.0-beta (2024-10-8) # 1.0.0
# FEATURES **FEATURES**
- 基础功能已经开发完毕
- 工作流相关模块等待后端重构后开发
**BUG FIXES**
- 登录页面 关闭租户后下拉框没有正常隐藏
- 字典管理 关闭租户不应显示`同步租户字典`按钮
# 1.0.0-beta (2024-10-8)
**FEATURES**
- 基础功能已经开发完毕 - 基础功能已经开发完毕
- 工作流相关模块等待后端重构后开发 - 工作流相关模块等待后端重构后开发

View File

@ -1,8 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Recordable } from '@vben/types'; import type { Recordable } from '@vben/types';
import { ref } from 'vue'; import { computed, ref } from 'vue';
import { useAccess } from '@vben/access';
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui'; import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
import { getPopupContainer } from '@vben/utils'; import { getPopupContainer } from '@vben/utils';
@ -25,6 +26,7 @@ import {
refreshDictTypeCache, refreshDictTypeCache,
} from '#/api/system/dict/dict-type'; } from '#/api/system/dict/dict-type';
import { dictSyncTenant } from '#/api/system/tenant'; import { dictSyncTenant } from '#/api/system/tenant';
import { useTenantStore } from '#/store/tenant';
import { downloadExcel } from '#/utils/file/download'; import { downloadExcel } from '#/utils/file/download';
import { emitter } from '../mitt'; import { emitter } from '../mitt';
@ -172,6 +174,15 @@ function handleSyncTenantDict() {
}, },
}); });
} }
const { hasAccessByRoles } = useAccess();
const tenantStore = useTenantStore();
/**
* 开启租户 & 超级管理员才可以同步租户字典
*/
const couldSyncTenantDict = computed(() => {
return tenantStore.tenantEnable && hasAccessByRoles(['superadmin']);
});
</script> </script>
<template> <template>
@ -188,7 +199,7 @@ function handleSyncTenantDict() {
<span v-access:code="['system:dict:edit']"> <span v-access:code="['system:dict:edit']">
<MenuItem key="1">刷新字典缓存</MenuItem> <MenuItem key="1">刷新字典缓存</MenuItem>
</span> </span>
<span v-access:role="['superadmin']"> <span v-if="couldSyncTenantDict">
<MenuItem key="2"> 同步租户字典 </MenuItem> <MenuItem key="2"> 同步租户字典 </MenuItem>
</span> </span>
</Menu> </Menu>