修改在角色管理页修改菜单权限偶尔未选中问题
This commit is contained in:
parent
a5c170fa2a
commit
554beaf6e7
@ -369,15 +369,15 @@ export default {
|
|||||||
/** 根据角色ID查询菜单树结构 */
|
/** 根据角色ID查询菜单树结构 */
|
||||||
getRoleMenuTreeselect(roleId) {
|
getRoleMenuTreeselect(roleId) {
|
||||||
roleMenuTreeselect(roleId).then(response => {
|
roleMenuTreeselect(roleId).then(response => {
|
||||||
this.getMenuTreeselect();
|
this.menuOptions = response.menus;
|
||||||
this.$refs.menu.setCheckedKeys(response.data);
|
this.$refs.menu.setCheckedKeys(response.checkedKeys);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 根据角色ID查询部门树结构 */
|
/** 根据角色ID查询部门树结构 */
|
||||||
getRoleDeptTreeselect(roleId) {
|
getRoleDeptTreeselect(roleId) {
|
||||||
roleDeptTreeselect(roleId).then(response => {
|
roleDeptTreeselect(roleId).then(response => {
|
||||||
this.getDeptTreeselect();
|
this.deptOptions = response.depts;
|
||||||
this.$refs.dept.setCheckedKeys(response.data);
|
this.$refs.dept.setCheckedKeys(response.checkedKeys);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 角色状态修改
|
// 角色状态修改
|
||||||
@ -407,8 +407,8 @@ export default {
|
|||||||
},
|
},
|
||||||
// 表单重置
|
// 表单重置
|
||||||
reset() {
|
reset() {
|
||||||
if (this.$refs.tree != undefined) {
|
if (this.$refs.menu != undefined) {
|
||||||
this.$refs.tree.setCheckedKeys([]);
|
this.$refs.menu.setCheckedKeys([]);
|
||||||
}
|
}
|
||||||
this.form = {
|
this.form = {
|
||||||
roleId: undefined,
|
roleId: undefined,
|
||||||
|
@ -70,7 +70,11 @@ public class SysDeptController extends BaseController
|
|||||||
@GetMapping(value = "/roleDeptTreeselect/{roleId}")
|
@GetMapping(value = "/roleDeptTreeselect/{roleId}")
|
||||||
public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId)
|
public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId)
|
||||||
{
|
{
|
||||||
return AjaxResult.success(deptService.selectDeptListByRoleId(roleId));
|
List<SysDept> depts = deptService.selectDeptList(new SysDept());
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
|
||||||
|
ajax.put("depts", deptService.buildDeptTreeSelect(depts));
|
||||||
|
return ajax;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -80,7 +80,12 @@ public class SysMenuController extends BaseController
|
|||||||
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
|
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
|
||||||
public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId)
|
public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId)
|
||||||
{
|
{
|
||||||
return AjaxResult.success(menuService.selectMenuListByRoleId(roleId));
|
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||||
|
List<SysMenu> menus = menuService.selectMenuList(loginUser.getUser().getUserId());
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
|
||||||
|
ajax.put("menus", menuService.buildMenuTreeSelect(menus));
|
||||||
|
return ajax;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,6 +13,14 @@ import com.ruoyi.project.system.domain.vo.RouterVo;
|
|||||||
*/
|
*/
|
||||||
public interface ISysMenuService
|
public interface ISysMenuService
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* 根据用户查询系统菜单列表
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return 菜单列表
|
||||||
|
*/
|
||||||
|
public List<SysMenu> selectMenuList(Long userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户查询系统菜单列表
|
* 根据用户查询系统菜单列表
|
||||||
*
|
*
|
||||||
|
@ -38,6 +38,18 @@ public class SysMenuServiceImpl implements ISysMenuService
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SysRoleMenuMapper roleMenuMapper;
|
private SysRoleMenuMapper roleMenuMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户查询系统菜单列表
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return 菜单列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysMenu> selectMenuList(Long userId)
|
||||||
|
{
|
||||||
|
return selectMenuList(new SysMenu(), userId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询系统菜单列表
|
* 查询系统菜单列表
|
||||||
*
|
*
|
||||||
@ -83,9 +95,9 @@ public class SysMenuServiceImpl implements ISysMenuService
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户名称查询菜单
|
* 根据用户ID查询菜单
|
||||||
*
|
*
|
||||||
* @param username 用户名称
|
* @param userId 用户名称
|
||||||
* @return 菜单列表
|
* @return 菜单列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -117,7 +117,7 @@
|
|||||||
update sys_menu
|
update sys_menu
|
||||||
<set>
|
<set>
|
||||||
<if test="menuName != null and menuName != ''">menu_name = #{menuName},</if>
|
<if test="menuName != null and menuName != ''">menu_name = #{menuName},</if>
|
||||||
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
|
<if test="parentId != null">parent_id = #{parentId},</if>
|
||||||
<if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if>
|
<if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if>
|
||||||
<if test="path != null and path != ''">path = #{path},</if>
|
<if test="path != null and path != ''">path = #{path},</if>
|
||||||
<if test="component != null and component != ''">component = #{component},</if>
|
<if test="component != null and component != ''">component = #{component},</if>
|
||||||
|
Loading…
Reference in New Issue
Block a user