feat(system): 添加菜单显示状态控制功能并完善租户ID设置
- 在MetaVo中添加visible字段用于控制菜单显示状态 - 修改SysMenuServiceImpl中的路由构建逻辑,传递visible信息到前端 - 更新SidebarItem.vue组件,根据visible属性控制菜单项显示 - 在多个医嘱管理相关服务类中显式设置租户ID以确保多租户隔离 - 调整字典管理相关路由配置,优化页面跳转路径 - 在菜单管理界面添加显示状态查询和表格列展示功能
This commit is contained in:
@@ -28,6 +28,11 @@ public class MetaVo {
|
||||
*/
|
||||
private String link;
|
||||
|
||||
/**
|
||||
* 菜单是否可见(用于前端侧边栏显示控制)
|
||||
*/
|
||||
private String visible;
|
||||
|
||||
public MetaVo() {}
|
||||
|
||||
public MetaVo(String title, String icon) {
|
||||
@@ -56,6 +61,16 @@ public class MetaVo {
|
||||
}
|
||||
}
|
||||
|
||||
public MetaVo(String title, String icon, boolean noCache, String link, String visible) {
|
||||
this.title = title;
|
||||
this.icon = icon;
|
||||
this.noCache = noCache;
|
||||
if (StringUtils.ishttp(link)) {
|
||||
this.link = link;
|
||||
}
|
||||
this.visible = visible;
|
||||
}
|
||||
|
||||
public boolean isNoCache() {
|
||||
return noCache;
|
||||
}
|
||||
@@ -87,4 +102,12 @@ public class MetaVo {
|
||||
public void setLink(String link) {
|
||||
this.link = link;
|
||||
}
|
||||
|
||||
public String getVisible() {
|
||||
return visible;
|
||||
}
|
||||
|
||||
public void setVisible(String visible) {
|
||||
this.visible = visible;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,13 +147,15 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
||||
List<RouterVo> routers = new LinkedList<RouterVo>();
|
||||
for (SysMenu menu : menus) {
|
||||
RouterVo router = new RouterVo();
|
||||
router.setHidden("1".equals(menu.getVisible()));
|
||||
// 不再根据 visible 字段设置 hidden,确保所有有权限的路由都可用
|
||||
// router.setHidden("1".equals(menu.getVisible()));
|
||||
router.setHidden(false);
|
||||
router.setName(getRouteName(menu));
|
||||
router.setPath(getRouterPath(menu));
|
||||
router.setComponent(getComponent(menu));
|
||||
router.setQuery(menu.getQuery());
|
||||
router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()),
|
||||
menu.getPath()));
|
||||
menu.getPath(), menu.getVisible()));
|
||||
List<SysMenu> cMenus = menu.getChildren();
|
||||
if (StringUtils.isNotEmpty(cMenus) && UserConstants.TYPE_DIR.equals(menu.getMenuType())) {
|
||||
router.setAlwaysShow(true);
|
||||
@@ -167,12 +169,12 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
||||
children.setComponent(menu.getComponent());
|
||||
children.setName(getRouteName(menu.getRouteName(), menu.getPath()));
|
||||
children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(),
|
||||
StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
|
||||
StringUtils.equals("1", menu.getIsCache()), menu.getPath(), menu.getVisible()));
|
||||
children.setQuery(menu.getQuery());
|
||||
childrenList.add(children);
|
||||
router.setChildren(childrenList);
|
||||
} else if (menu.getParentId().intValue() == 0 && isInnerLink(menu)) {
|
||||
router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon()));
|
||||
router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), false, null, menu.getVisible()));
|
||||
router.setPath("/");
|
||||
List<RouterVo> childrenList = new ArrayList<RouterVo>();
|
||||
RouterVo children = new RouterVo();
|
||||
@@ -180,7 +182,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
||||
children.setPath(routerPath);
|
||||
children.setComponent(UserConstants.INNER_LINK);
|
||||
children.setName(getRouteName(menu.getRouteName(), routerPath));
|
||||
children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), menu.getPath()));
|
||||
children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), false, menu.getPath(), menu.getVisible()));
|
||||
childrenList.add(children);
|
||||
router.setChildren(childrenList);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user