feat: 用户添加租户身份标识用于控制是否可切换租户

This commit is contained in:
Ray.Hao
2026-01-20 08:02:10 +08:00
parent 102b95e288
commit 31dbcf2efa
4 changed files with 7328 additions and 2 deletions

View File

@@ -72,6 +72,7 @@ import { useRoute, useRouter } from "vue-router";
import { defaults } from "@/settings";
import { DeviceEnum, SidebarColor, ThemeMode, LayoutMode } from "@/enums/settings";
import { useAppStore, useSettingsStore, useUserStore } from "@/store";
import { hasPerm } from "@/utils/auth";
// 导入子组件
import CommandPalette from "@/components/CommandPalette/index.vue";
@@ -98,9 +99,11 @@ const isPlatformUser = computed(() => {
return (userStore.userInfo?.tenantScope || "").toUpperCase() === "PLATFORM";
});
const canSwitchTenant = computed(() => hasPerm("sys:tenant:switch", "button"));
// 是否显示租户选择(仅平台用户可显式切换租户)
const showTenantSelect = computed(() => {
if (!isPlatformUser.value) {
if (!isPlatformUser.value || !canSwitchTenant.value) {
return false;
}
if (tenantStore.tenantList.length <= 1) {