From a69cc94f354bcc0b787b0de4fe83b7d0c8e3b742 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Sat, 28 Nov 2020 20:39:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=89=E7=BA=A7=E8=8F=9C=E5=8D=95=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E9=85=8D=E7=BD=AE=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/common/constant/UserConstants.java | 3 +++ .../system/service/impl/SysMenuServiceImpl.java | 15 +++++++++++++++ .../log => components/ParentView}/index.vue | 6 +++--- ruoyi-ui/src/router/index.js | 1 + ruoyi-ui/src/store/modules/permission.js | 5 ++++- sql/{ry_20201123.sql => ry_20201128.sql} | 2 +- 6 files changed, 27 insertions(+), 5 deletions(-) rename ruoyi-ui/src/{views/system/log => components/ParentView}/index.vue (93%) rename sql/{ry_20201123.sql => ry_20201128.sql} (98%) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java index 69c2b9653..94b23a94f 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java @@ -54,6 +54,9 @@ public class UserConstants /** Layout组件标识 */ public final static String LAYOUT = "Layout"; + /** ParentView组件标识 */ + public final static String PARENT_VIEW = "ParentView"; + /** 校验返回结果码 */ public final static String UNIQUE = "0"; public final static String NOT_UNIQUE = "1"; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java index 8b38ead02..fd9084e9e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java @@ -364,6 +364,10 @@ public class SysMenuServiceImpl implements ISysMenuService { component = menu.getComponent(); } + else if (StringUtils.isEmpty(menu.getComponent()) && isParentView(menu)) + { + component = UserConstants.PARENT_VIEW; + } return component; } @@ -379,6 +383,17 @@ public class SysMenuServiceImpl implements ISysMenuService && menu.getIsFrame().equals(UserConstants.NO_FRAME); } + /** + * 是否为parent_view组件 + * + * @param menu 菜单信息 + * @return 结果 + */ + public boolean isParentView(SysMenu menu) + { + return menu.getParentId().intValue() != 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType()); + } + /** * 根据父节点的ID获取所有子节点 * diff --git a/ruoyi-ui/src/views/system/log/index.vue b/ruoyi-ui/src/components/ParentView/index.vue similarity index 93% rename from ruoyi-ui/src/views/system/log/index.vue rename to ruoyi-ui/src/components/ParentView/index.vue index ad6360cef..7bf614897 100644 --- a/ruoyi-ui/src/views/system/log/index.vue +++ b/ruoyi-ui/src/components/ParentView/index.vue @@ -1,3 +1,3 @@ - + diff --git a/ruoyi-ui/src/router/index.js b/ruoyi-ui/src/router/index.js index f2b320364..3f14fd3a3 100644 --- a/ruoyi-ui/src/router/index.js +++ b/ruoyi-ui/src/router/index.js @@ -5,6 +5,7 @@ Vue.use(Router) /* Layout */ import Layout from '@/layout' +import ParentView from '@/components/ParentView'; /** * Note: 路由配置项 diff --git a/ruoyi-ui/src/store/modules/permission.js b/ruoyi-ui/src/store/modules/permission.js index deed45193..260d8af53 100644 --- a/ruoyi-ui/src/store/modules/permission.js +++ b/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 @@ const permission = { 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) } diff --git a/sql/ry_20201123.sql b/sql/ry_20201128.sql similarity index 98% rename from sql/ry_20201123.sql rename to sql/ry_20201128.sql index 9b8ec9cfe..1db0d5af7 100644 --- a/sql/ry_20201123.sql +++ b/sql/ry_20201128.sql @@ -169,7 +169,7 @@ insert into sys_menu values('104', '岗位管理', '1', '5', 'post', 's insert into sys_menu values('105', '字典管理', '1', '6', 'dict', 'system/dict/index', 1, 0, 'C', '0', '0', 'system:dict:list', 'dict', 'admin', sysdate(), '', null, '字典管理菜单'); insert into sys_menu values('106', '参数设置', '1', '7', 'config', 'system/config/index', 1, 0, 'C', '0', '0', 'system:config:list', 'edit', 'admin', sysdate(), '', null, '参数设置菜单'); insert into sys_menu values('107', '通知公告', '1', '8', 'notice', 'system/notice/index', 1, 0, 'C', '0', '0', 'system:notice:list', 'message', 'admin', sysdate(), '', null, '通知公告菜单'); -insert into sys_menu values('108', '日志管理', '1', '9', 'log', 'system/log/index', 1, 0, 'M', '0', '0', '', 'log', 'admin', sysdate(), '', null, '日志管理菜单'); +insert into sys_menu values('108', '日志管理', '1', '9', 'log', '', 1, 0, 'M', '0', '0', '', 'log', 'admin', sysdate(), '', null, '日志管理菜单'); insert into sys_menu values('109', '在线用户', '2', '1', 'online', 'monitor/online/index', 1, 0, 'C', '0', '0', 'monitor:online:list', 'online', 'admin', sysdate(), '', null, '在线用户菜单'); insert into sys_menu values('110', '定时任务', '2', '2', 'job', 'monitor/job/index', 1, 0, 'C', '0', '0', 'monitor:job:list', 'job', 'admin', sysdate(), '', null, '定时任务菜单'); insert into sys_menu values('111', '数据监控', '2', '3', 'druid', 'monitor/druid/index', 1, 0, 'C', '0', '0', 'monitor:druid:list', 'druid', 'admin', sysdate(), '', null, '数据监控菜单');