feat(role): 添加角色菜单权限分配功能

- 后端新增 listRoleMenuByPid 接口用于获取角色菜单权限
- 前端新增 listRoleMenuByPid API 方法调用接口
- 修改角色页面布局,调整菜单授权区域宽度为6列
- 角色页面导入 listRoleMenuByPid 方法替换原有的 listMenuByPid
- 更新树形菜单数据加载方法,使用新的角色菜单权限接口
- 更改前端主题变量从 cyberorange 暗色主题为 cloudsky 亮色主题
This commit is contained in:
2026-01-25 10:16:26 +08:00
parent df841d64a2
commit 44fa37eac3
4 changed files with 20 additions and 5 deletions
+7
View File
@@ -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) { export function searchMenu(params) {
return request({ return request({
url: 'api/menu/searchMenu', url: 'api/menu/searchMenu',
@@ -1 +1 @@
@import 'themes/dark/variables.cyberorange'; @import 'themes/light/variables.cloudsky';
@@ -68,7 +68,7 @@
</el-dialog> </el-dialog>
<el-row :gutter="15"> <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"> <el-card class="box-card" shadow="never">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span class="role-span">角色列表</span> <span class="role-span">角色列表</span>
@@ -113,7 +113,7 @@
</el-card> </el-card>
</el-col> </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"> <el-card class="box-card" shadow="never">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<el-tooltip class="item" effect="dark" content="选择指定角色分配菜单" placement="top"> <el-tooltip class="item" effect="dark" content="选择指定角色分配菜单" placement="top">
@@ -153,7 +153,7 @@
<script> <script>
import crudRoles from '@/api/system/role' import crudRoles from '@/api/system/role'
import { searchDept, searchDeptTree } from '@/api/system/dept' 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 CRUD, { crud, form, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation' import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation' import crudOperation from '@crud/CRUD.operation'
@@ -197,7 +197,7 @@ export default {
methods: { methods: {
getMenuDatas(node, resolve) { getMenuDatas(node, resolve) {
setTimeout(() => { setTimeout(() => {
listMenuByPid(node.data.id ? node.data.id : 0).then(res => { listRoleMenuByPid(node.data.id ? node.data.id : 0).then(res => {
resolve(res) resolve(res)
}) })
}, 100) }, 100)
@@ -72,6 +72,14 @@ public class SystemMenuController {
return ResponseEntity.ok(systemMenuTbs); 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") @ApiOperation("根据菜单ID返回所有子节点ID, 包含自身ID")
@PostMapping(value = "/listChildMenuSetByMenuId") @PostMapping(value = "/listChildMenuSetByMenuId")
@PreAuthorize("@el.check('menu:list','roles:list')") @PreAuthorize("@el.check('menu:list','roles:list')")