RuoYi
2020-11-28 20f85a37cf765a6e0eee69622e4ec2d0e0192053
三级菜单自动配置组件
2 files renamed
4 files modified
26 ■■■■■ changed files
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/UserConstants.java 3 ●●●●● patch | view | raw | blame | history
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java 15 ●●●●● patch | view | raw | blame | history
ruoyi-ui/src/components/ParentView/index.vue patch | view | raw | blame | history
ruoyi-ui/src/router/index.js 1 ●●●● patch | view | raw | blame | history
ruoyi-ui/src/store/modules/permission.js 5 ●●●● patch | view | raw | blame | history
sql/ry_20201128.sql 2 ●●● patch | view | raw | blame | history
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/UserConstants.java
@@ -54,6 +54,9 @@
    /** Layout组件标识 */
    public final static String LAYOUT = "Layout";
    /** ParentView组件标识 */
    public final static String PARENT_VIEW = "ParentView";
    /** 校验返回结果码 */
    public final static String UNIQUE = "0";
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java
@@ -364,6 +364,10 @@
        {
            component = menu.getComponent();
        }
        else if (StringUtils.isEmpty(menu.getComponent()) && isParentView(menu))
        {
            component = UserConstants.PARENT_VIEW;
        }
        return component;
    }
@@ -380,6 +384,17 @@
    }
    /**
     * 是否为parent_view组件
     *
     * @param menu 菜单信息
     * @return 结果
     */
    public boolean isParentView(SysMenu menu)
    {
        return menu.getParentId().intValue() != 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType());
    }
    /**
     * 根据父节点的ID获取所有子节点
     * 
     * @param list 分类表
ruoyi-ui/src/components/ParentView/index.vue
ruoyi-ui/src/router/index.js
@@ -5,6 +5,7 @@
/* Layout */
import Layout from '@/layout'
import ParentView from '@/components/ParentView';
/**
 * Note: 路由配置项
ruoyi-ui/src/store/modules/permission.js
@@ -1,6 +1,7 @@
import { constantRoutes } from '@/router'
import { getRouters } from '@/api/menu'
import Layout from '@/layout/index'
import ParentView from '@/components/ParentView';
const permission = {
  state: {
@@ -33,9 +34,11 @@
function filterAsyncRouter(asyncRouterMap) {
  return asyncRouterMap.filter(route => {
    if (route.component) {
      // Layout组件特殊处理
      // Layout ParentView 组件特殊处理
      if (route.component === 'Layout') {
        route.component = Layout
      } else if (route.component === 'ParentView') {
        route.component = ParentView
      } else {
        route.component = loadView(route.component)
      }
sql/ry_20201128.sql
File was renamed from sql/ry_20200924.sql
@@ -169,7 +169,7 @@
insert into sys_menu values('105',  '字典管理',       '1',   '6',  'dict',                                'system/dict/index',       1, 0, 'C', '0', '0', 'system:dict:list',        'dict',          'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '字典管理菜单');
insert into sys_menu values('106',  '参数设置',       '1',   '7',  'config',                              'system/config/index',     1, 0, 'C', '0', '0', 'system:config:list',      'edit',          'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '参数设置菜单');
insert into sys_menu values('107',  '通知公告',       '1',   '9',  'notice',                              'system/notice/index',     1, 0, 'C', '0', '0', 'system:notice:list',      'message',       'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '通知公告菜单');
insert into sys_menu values('108',  '日志管理',       '1',   '10', 'log',                                 'system/log/index',        1, 0, 'M', '0', '0', '',                        'log',           'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '日志管理菜单');
insert into sys_menu values('108',  '日志管理',       '1',   '10', 'log',                                 '',                        1, 0, 'M', '0', '0', '',                        'log',           'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '日志管理菜单');
insert into sys_menu values('109',  '在线用户',       '2',   '1',  'online',                              'monitor/online/index',    1, 0, 'C', '0', '0', 'monitor:online:list',     'online',        'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '在线用户菜单');
insert into sys_menu values('110',  '定时任务',       '2',   '2',  'job',                                 'monitor/job/index',       1, 0, 'C', '0', '0', 'monitor:job:list',        'job',           'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '定时任务菜单');
insert into sys_menu values('111',  'Sentinel控制台', '2',   '3',  'http://localhost:8718',                '',                       1, 0, 'C', '0', '0', 'monitor:sentinel:list',   'sentinel',      'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', '流量控制菜单');