refactor: 多租户适配调整

This commit is contained in:
Ray.Hao
2025-12-11 21:19:02 +08:00
parent 9176298b44
commit 888e17e405
12 changed files with 260 additions and 74 deletions

View File

@@ -100,9 +100,19 @@ const router = useRouter();
// 是否为桌面设备
const isDesktop = computed(() => appStore.device === DeviceEnum.DESKTOP);
// 是否显示租户选择(如果用户有多个租户或已选择租户
// 是否显示租户选择(如果用户有多个租户,则显示租户选择器
// 最小侵入:只有在多租户模式下(租户列表长度 > 1才显示
const showTenantSelect = computed(() => {
return tenantStore.tenantList.length > 0 || tenantStore.currentTenantId !== null;
// 如果租户列表为空,不显示
if (tenantStore.tenantList.length === 0) {
return false;
}
// 如果只有一个租户,也不显示(单租户模式,用户无感知)
if (tenantStore.tenantList.length === 1) {
return false;
}
// 多个租户时才显示
return true;
});
/**
@@ -257,6 +267,16 @@ function handleSettingsClick() {
.user-profile__name {
color: rgba(255, 255, 255, 0.85);
}
// 租户选择器在白色文字模式下的样式
:deep(.tenant-select) {
color: rgba(255, 255, 255, 0.85);
&:hover {
color: #fff;
background: rgba(255, 255, 255, 0.1);
}
}
}
// 深色文字样式(用于浅色背景:明亮主题下的左侧布局)
@@ -278,6 +298,16 @@ function handleSettingsClick() {
.user-profile__name {
color: var(--el-text-color-regular) !important;
}
// 租户选择器在深色文字模式下的样式
:deep(.tenant-select) {
color: var(--el-text-color-regular) !important;
&:hover {
color: var(--el-color-primary) !important;
background: rgba(0, 0, 0, 0.04);
}
}
}
// 确保下拉菜单中的图标不受影响