feat(role): 添加角色菜单权限分配功能
- 后端新增 listRoleMenuByPid 接口用于获取角色菜单权限 - 前端新增 listRoleMenuByPid API 方法调用接口 - 修改角色页面布局,调整菜单授权区域宽度为6列 - 角色页面导入 listRoleMenuByPid 方法替换原有的 listMenuByPid - 更新树形菜单数据加载方法,使用新的角色菜单权限接口 - 更改前端主题变量从 cyberorange 暗色主题为 cloudsky 亮色主题
This commit is contained in:
@@ -34,6 +34,13 @@ export function listMenuByPid(pid) {
|
||||
})
|
||||
}
|
||||
|
||||
export function listRoleMenuByPid(pid) {
|
||||
return request({
|
||||
url: 'api/menu/listRoleMenuByPid?pid=' + pid,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
export function searchMenu(params) {
|
||||
return request({
|
||||
url: 'api/menu/searchMenu',
|
||||
|
||||
@@ -1 +1 @@
|
||||
@import 'themes/dark/variables.cyberorange';
|
||||
@import 'themes/light/variables.cloudsky';
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
</el-dialog>
|
||||
<el-row :gutter="15">
|
||||
<!--角色管理-->
|
||||
<el-col :xs="24" :sm="24" :md="16" :lg="16" :xl="17" style="margin-bottom: 10px">
|
||||
<el-col span="18" style="margin-bottom: 10px">
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span class="role-span">角色列表</span>
|
||||
@@ -113,7 +113,7 @@
|
||||
</el-card>
|
||||
</el-col>
|
||||
<!-- 菜单授权 -->
|
||||
<el-col :xs="24" :sm="24" :md="8" :lg="8" :xl="7">
|
||||
<el-col span="6">
|
||||
<el-card class="box-card" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<el-tooltip class="item" effect="dark" content="选择指定角色分配菜单" placement="top">
|
||||
@@ -153,7 +153,7 @@
|
||||
<script>
|
||||
import crudRoles from '@/api/system/role'
|
||||
import { searchDept, searchDeptTree } from '@/api/system/dept'
|
||||
import { listChildMenuSetByMenuId, listMenuByPid } from '@/api/system/menu'
|
||||
import { listChildMenuSetByMenuId, listRoleMenuByPid } from '@/api/system/menu'
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
@@ -197,7 +197,7 @@ export default {
|
||||
methods: {
|
||||
getMenuDatas(node, resolve) {
|
||||
setTimeout(() => {
|
||||
listMenuByPid(node.data.id ? node.data.id : 0).then(res => {
|
||||
listRoleMenuByPid(node.data.id ? node.data.id : 0).then(res => {
|
||||
resolve(res)
|
||||
})
|
||||
}, 100)
|
||||
|
||||
+8
@@ -72,6 +72,14 @@ public class SystemMenuController {
|
||||
return ResponseEntity.ok(systemMenuTbs);
|
||||
}
|
||||
|
||||
@ApiOperation("返回全部的菜单")
|
||||
@PostMapping(value = "/listRoleMenuByPid")
|
||||
@PreAuthorize("@el.check('menu:list','roles:list')")
|
||||
public ResponseEntity<List<SystemMenuTb>> listRoleMenuByPid(@RequestParam Long pid) {
|
||||
List<SystemMenuTb> systemMenuTbs = systemMenuService.listMenuByPid(pid, true);
|
||||
return ResponseEntity.ok(systemMenuTbs);
|
||||
}
|
||||
|
||||
@ApiOperation("根据菜单ID返回所有子节点ID, 包含自身ID")
|
||||
@PostMapping(value = "/listChildMenuSetByMenuId")
|
||||
@PreAuthorize("@el.check('menu:list','roles:list')")
|
||||
|
||||
Reference in New Issue
Block a user