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 86cca7d7bd..e77de70ef7 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 @@ -111,18 +111,6 @@ public class SysMenuServiceImpl implements ISysMenuService { return menuMapper.selectMenuListByRoleId(roleId, role.isMenuCheckStrictly()); } - /** - * 构建前端所需要下拉树结构 - * - * @param menus 菜单列表 - * @return 下拉树结构列表 - */ - @Override - public List buildMenuTreeSelect(List menus) { - List menuTrees = buildMenuTree(menus); - return menuTrees.stream().map(TreeSelect::new).collect(Collectors.toList()); - } - /** * 查询菜单使用数量 * diff --git a/ruoyi-ui/src/api/system/menu.js b/ruoyi-ui/src/api/system/menu.js index 724f197245..fb3fa6e983 100644 --- a/ruoyi-ui/src/api/system/menu.js +++ b/ruoyi-ui/src/api/system/menu.js @@ -1,60 +1,52 @@ -import request from '@/utils/request' - -// 查询菜单列表 -export function listMenu(query) { - return request({ - url: '/system/menu/list', - method: 'get', - params: query - }) -} - -// 查询菜单详细 -export function getMenu(id) { - return request({ - url: '/system/menu/get?id=' + id, - method: 'get' - }) -} - -// 查询菜单下拉树结构 -export function treeselect() { - return request({ - url: '/system/menu/treeselect', - method: 'get' - }) -} - -// 根据角色ID查询菜单下拉树结构 -export function roleMenuTreeselect(roleId) { - return request({ - url: '/system/menu/roleMenuTreeselect/' + roleId, - method: 'get' - }) -} - -// 新增菜单 -export function addMenu(data) { - return request({ - url: '/system/menu/create', - method: 'post', - data: data - }) -} - -// 修改菜单 -export function updateMenu(data) { - return request({ - url: '/system/menu/update', - method: 'post', - data: data - }) -} - -// 删除菜单 -export function delMenu(id) { - return request({ - url: '/system/menu/delete?id=' + id, - method: 'post' - }) -} +import request from '@/utils/request' + +// 查询菜单列表 +export function listMenu(query) { + return request({ + url: '/system/menu/list', + method: 'get', + params: query + }) +} + +// 查询菜单(精简)列表 +export function listSimpleMenus() { + return request({ + url: '/system/menu/list-all-simple', + method: 'get' + }) +} + +// 查询菜单详细 +export function getMenu(id) { + return request({ + url: '/system/menu/get?id=' + id, + method: 'get' + }) +} + +// 新增菜单 +export function addMenu(data) { + return request({ + url: '/system/menu/create', + method: 'post', + data: data + }) +} + +// 修改菜单 +export function updateMenu(data) { + return request({ + url: '/system/menu/update', + method: 'post', + data: data + }) +} + +// 删除菜单 +export function delMenu(id) { + return request({ + url: '/system/menu/delete?id=' + id, + method: 'post' + }) +} diff --git a/ruoyi-ui/src/api/system/permission.js b/ruoyi-ui/src/api/system/permission.js new file mode 100644 index 0000000000..1ec3eea0e2 --- /dev/null +++ b/ruoyi-ui/src/api/system/permission.js @@ -0,0 +1,18 @@ +import request from '@/utils/request' + +// 查询角色拥有的菜单数组 +export function listRoleMenus(roleId) { + return request({ + url: '/system/permission/list-role-resources?roleId=' + roleId, + method: 'get' + }) +} + +// 赋予角色菜单 +export function assignRoleMenu(data) { + return request({ + url: '/system/permission/assign-role-menu', + method: 'post', + data: data + }) +} diff --git a/ruoyi-ui/src/utils/ruoyi.js b/ruoyi-ui/src/utils/ruoyi.js index 81ee9c70bd..493aa047df 100644 --- a/ruoyi-ui/src/utils/ruoyi.js +++ b/ruoyi-ui/src/utils/ruoyi.js @@ -148,5 +148,5 @@ export function handleTree(data, id, parentId, children, rootId) { //返回第一层 return father[parentId] === rootId; }); - return treeData != '' ? treeData : data; + return treeData !== '' ? treeData : data; } diff --git a/ruoyi-ui/src/views/system/role/index.vue b/ruoyi-ui/src/views/system/role/index.vue index 601449d18f..5743db5dd0 100644 --- a/ruoyi-ui/src/views/system/role/index.vue +++ b/ruoyi-ui/src/views/system/role/index.vue @@ -182,9 +182,9 @@ + 父子联动 展开/折叠 全选/全不选 - 父子联动 @@ -214,16 +214,16 @@ + 父子联动(选中父节点,自动选择子节点) 展开/折叠 全选/全不选 - 父子联动 @@ -239,7 +239,8 @@