fix: 文件乱码修复,代码生成指定ts类型,登录移除租户选择

This commit is contained in:
Ray.Hao committed 2026-01-16 23:19:29 +08:00
1 parent 23b789badd
commit da2002f6d0
9 files changed
+65 -153

No files matched your search

+2 -2
View File
@@ -3,10 +3,10 @@
<div class="flex-y-center">
<!-- 菜单折叠按钮 -->
<Hamburger :is-active="isSidebarOpened" @toggle-click="toggleSideBar" />
<!-- �包屑导�-->
<!-- 面包屑导行栏-->
<Breadcrumb />
</div>
<!-- 导航��作区�-->
<!-- 导航栏操作区域-->
<div class="navbar__actions">
<LayoutToolbar />
</div>
+18 -18
View File
@@ -14,7 +14,7 @@
@open="onMenuOpen"
@close="onMenuClose"
>
<!-- 闖懷黒鬘?-->
<!-- 菜单项 -->
<LayoutSidebarItem
v-for="route in data"
:key="route.path"
@@ -63,10 +63,10 @@ const expandedMenuIndexes = ref<string[]>([]);
// 获取主题
const theme = computed(() => settingsStore.theme);
// 闔キ蜿匁オ�牡荳サ鬚倅ク狗噪萓ァ霎ケ譬城�濶イ譁ケ譯?
// 获取浅色主题下的侧边栏配色方案
const sidebarColorScheme = computed(() => settingsStore.sidebarColorScheme);
// 闖懷黒荳サ鬚伜ア樊€?
// 菜单主题属性
const menuThemeProps = computed(() => {
const isDarkOrClassicBlue =
theme.value === "dark" || sidebarColorScheme.value === SidebarColor.CLASSIC_BLUE;
@@ -78,11 +78,11 @@ const menuThemeProps = computed(() => {
};
});
// 隶。邂怜ス灘燕豼€豢サ逧�除蜊暮。?
// 计算当前激活的菜单项
const activeMenuPath = computed((): string => {
const { meta, path } = currentRoute;
// 螯よ棡霍ッ逕アmeta荳ュ隶セ鄂ョ莠�ctiveMenu�悟�菴ソ逕ィ螳�シ育畑莠主、�炊荳€莠帷音谿頑ュ蜀オ�悟ヲりッヲ諠�。オ�?
// 如果路由 meta 中设置了 activeMenu,则使用它(用于处理一些特殊情况,如详情页等)
if (meta?.activeMenu && typeof meta.activeMenu === "string") {
return meta.activeMenu;
}
@@ -94,8 +94,8 @@ const activeMenuPath = computed((): string => {
/**
* 获取完整路径
*
* @param routePath 蠖灘燕霍ッ逕ア逧�嶌蟇ケ霍ッ蠕? /user
* @returns 螳梧紛逧�サ晏ッケ霍ッ蠕?D://vue3-element-admin/system/user
* @param routePath 当前路由的相对路径 /user
* @returns 完整的绝对路径 D://vue3-element-admin/system/user
*/
function resolveFullPath(routePath: string) {
if (isExternal(routePath)) {
@@ -143,8 +143,8 @@ watch(
);
/**
* 逶大成闖懷黒讓。蠑丞序蛹厄シ壼ス楢除蜊墓ィ。蠑丞�謐「荳コ豌エ蟷ウ讓。蠑乗慮�悟�髣ュ謇€譛牙ア募シ€逧�除蜊暮。ケ�?
* 驕ソ蜈榊惠豌エ蟷ウ讓。蠑丈ク玖除蜊暮。ケ譏セ遉コ髞吩ス阪€?
* 监听菜单模式变化:当菜单模式切换为水平模式时,关闭所有展开的菜单项
* 避免在水平模式下菜单项显示错位
*/
watch(
() => props.menuMode,
@@ -156,7 +156,7 @@ watch(
);
/**
* 逶大成豼€豢サ闖懷黒蜿伜喧�御クコ蛹�性豼€豢サ蟄占除蜊慕噪辷カ闖懷黒豺サ蜉�譬キ蠑冗ア?
* 监听激活菜单变化,为包含激活子菜单的父菜单添加样式
*/
watch(
() => activeMenuPath.value,
@@ -169,7 +169,7 @@ watch(
);
/**
* 逶大成霍ッ逕ア蜿伜喧�檎。ョ菫晁除蜊戊�髫週agsView蛻�困閠梧ュ」遑ョ豼€豢?
* 监听路由变化,确保菜单能随 TagsView 切换而正确激活
*/
watch(
() => currentRoute.path,
@@ -181,7 +181,7 @@ watch(
);
/**
* 譖エ譁ー辷カ闖懷黒譬キ蠑?- 荳コ蛹�性豼€豢サ蟄占除蜊慕噪辷カ闖懷黒豺サ蜉� has-active-child 邀?
* 更新父菜单样式 - 为包含激活子菜单的父菜单添加 has-active-child 类
*/
function updateParentMenuStyles() {
if (!menuRef.value?.$el) return;
@@ -191,13 +191,13 @@ function updateParentMenuStyles() {
const menuEl = menuRef.value?.$el as HTMLElement;
if (!menuEl) return;
// 遘サ髯、謇€譛臥鴫譛臥噪 has-active-child 邀?
// 移除所有现有的 has-active-child 类
const allSubMenus = menuEl.querySelectorAll(".el-sub-menu");
allSubMenus.forEach((subMenu) => {
subMenu.classList.remove("has-active-child");
});
// 譟・謇セ蠖灘燕豼€豢サ逧�除蜊暮。?
// 查找当前激活的菜单项
const activeMenuItem = menuEl.querySelector(".el-menu-item.is-active");
if (activeMenuItem) {
@@ -210,12 +210,12 @@ function updateParentMenuStyles() {
parent = parent.parentElement;
}
} else {
// 豌エ蟷ウ讓。蠑丈ク句庄閭ス髴€隕∫音谿雁、��?
// 水平模式下可能需要特殊处理
if (props.menuMode === "horizontal") {
// 蟇ケ莠取ーエ蟷ウ闖懷黒�御スソ逕ィ霍ッ蠕�源驟肴擂謇セ蛻ー辷カ闖懷�?
// 对于水平菜单,使用路径匹配来找到父菜单
const currentPath = activeMenuPath.value;
// 譟・謇セ謇€譛臥宛闖懷黒鬘ケ�梧」€譟・蜩ェ荳ェ蛹�性蠖灘燕霍ッ蠕?
// 查找所有父菜单项,检查哪个包含当前路径
allSubMenus.forEach((subMenu) => {
const subMenuEl = subMenu as HTMLElement;
const subMenuPath =
@@ -239,7 +239,7 @@ function updateParentMenuStyles() {
* 组件挂载后立即更新父菜单样式
*/
onMounted(() => {
// 遑ョ菫晏惠扈�サカ謖りスス蜷取峩譁ー譬キ蠑擾シ御ク堺セ晁オ紋コ主シよュ・謫堺ス?
// 确保在组件挂载后更新样式,不依赖于异步操作
updateParentMenuStyles();
});
</script>
+7 -7
View File
@@ -94,18 +94,18 @@ const router = useRouter();
// 是否为桌面设备
const isDesktop = computed(() => appStore.device === DeviceEnum.DESKTOP);
// 是否显示租户选择(如果用户有多个租户,则显示租户选择器)
// 最小侵入:只有在多租户模式下(租户列表长度 > 1)才显示
const isPlatformUser = computed(() => {
return (userStore.userInfo?.tenantScope || "").toUpperCase() === "PLATFORM";
});
// 是否显示租户选择(仅平台用户可显式切换租户)
const showTenantSelect = computed(() => {
// 如果租户列表为空,不显示
if (tenantStore.tenantList.length === 0) {
if (!isPlatformUser.value) {
return false;
}
// 如果只有一个租户,也不显示(单租户模式,用户无感知)
if (tenantStore.tenantList.length === 1) {
if (tenantStore.tenantList.length <= 1) {
return false;
}
// 多个租户时才显示
return true;
});