|
|
@@ -32,6 +32,11 @@ const getResourceName = (fullPath: string): string => {
|
|
|
return 'dashboard';
|
|
|
}
|
|
|
|
|
|
+ // 特殊处理:swagger路径直接映射到/tool/swagger
|
|
|
+ if (fullPath === 'swagger') {
|
|
|
+ return 'tool/swagger';
|
|
|
+ }
|
|
|
+
|
|
|
// 对于其他路径,直接将最后一个路径段转换为复数形式
|
|
|
const pathSegments = fullPath.split('/');
|
|
|
const lastSegment = pathSegments[pathSegments.length - 1];
|
|
|
@@ -51,6 +56,11 @@ const getResourceName = (fullPath: string): string => {
|
|
|
|
|
|
// 根据菜单类型获取图标
|
|
|
const getMenuIcon = (menuType: 'M' | 'C' | 'F', customIcon?: string) => {
|
|
|
+ // 特殊处理:swagger图标
|
|
|
+ if (customIcon === 'swagger') {
|
|
|
+ return <SettingsIcon fontSize="small" />;
|
|
|
+ }
|
|
|
+
|
|
|
if (customIcon) {
|
|
|
// 这里可以处理自定义图标,暂时使用默认图标
|
|
|
return <SettingsIcon fontSize="small" />;
|
|
|
@@ -75,12 +85,13 @@ const renderMenuTree = (menus: MenuItem[], basePath = '', expandedItems: Set<str
|
|
|
|
|
|
// 只渲染菜单类型为C(菜单)的项
|
|
|
if (menu.menuType === 'C' && menu.path && fullPath) {
|
|
|
- const resourceName = getResourceName(fullPath);
|
|
|
+ // 特殊处理:swagger菜单项直接导航到/tool/swagger
|
|
|
+ const toPath = menu.path === 'swagger' ? '/tool/swagger' : `/${getResourceName(fullPath)}`;
|
|
|
|
|
|
return (
|
|
|
<MenuItemLink
|
|
|
key={`menu-${menu.menuId}`}
|
|
|
- to={`/${resourceName}`}
|
|
|
+ to={toPath}
|
|
|
primaryText={menu.menuName}
|
|
|
leftIcon={getMenuIcon(menu.menuType, menu.icon)}
|
|
|
sx={{
|