Commit 8caa5f1c authored by 黄奎's avatar 黄奎

页面修改

parent 914f1c90
......@@ -12,6 +12,11 @@ namespace Edu.Model.ViewModel.System
/// </summary>
public int MenuId { get; set; }
/// <summary>
/// 上级菜单编号
/// </summary>
public int ParentId { get; set; }
/// <summary>
/// 菜单名称
/// </summary>
......
......@@ -28,6 +28,11 @@ namespace Edu.Model.ViewModel.System
/// </summary>
public int Action_Id { get; set; }
/// <summary>
/// 上级节点编号
/// </summary>
public int ParentId { get; set; }
/// <summary>
/// 权限名称描述
/// </summary>
......
......@@ -120,6 +120,7 @@ namespace Edu.Module.System
MenuName = fItem.MenuName,
MenuUrl = fItem.MenuUrl,
MenuIcon=fItem.MenuIcon,
ParentId=0,
SubList = new List<MenuTree_ViewModel>()
};
//二级菜单
......@@ -134,10 +135,11 @@ namespace Edu.Module.System
MenuName = sItem.MenuName,
MenuUrl = sItem.MenuUrl,
MenuIcon = sItem.MenuIcon,
ParentId = fItem.MenuId,
SubList = new List<MenuTree_ViewModel>()
};
//三级菜单
var thirdLevelList= list.Where(qitem => qitem.MenuLevel == 3 && qitem.ParentId == sItem.MenuId).ToList();
var thirdLevelList = list.Where(qitem => qitem.MenuLevel == 3 && qitem.ParentId == sItem.MenuId).ToList();
if (thirdLevelList != null && thirdLevelList.Count > 0)
{
foreach (var tItem in thirdLevelList)
......@@ -145,6 +147,7 @@ namespace Edu.Module.System
sModel.SubList.Add(new MenuTree_ViewModel()
{
MenuId = tItem.MenuId,
ParentId = sItem.MenuId,
MenuName = tItem.MenuName,
MenuUrl = tItem.MenuUrl,
MenuIcon = tItem.MenuIcon,
......
......@@ -180,12 +180,14 @@ namespace Edu.Module.System
CategoryName = item.CategoryName,
IsChecked = false,
Role_Id = roleId,
ParentId = 0,
SubList = resultRoleFunctionTreeList?.Where(qitem => qitem.CategoryId == item.CategoryId)?.ToList() ?? new List<RoleFunctionPermissionTree_ViewModel>()
};
if (rootModel != null && rootModel.SubList.Count > 0)
{
foreach (var subItem in rootModel.SubList)
{
subItem.ParentId = Convert.ToInt32(cateModel.CategoryId);
subItem.IsChecked = roleFunctionList?.Where(qitem => (int)qitem.Action_Id == subItem.Action_Id)?.Count() > 0;
}
}
......@@ -217,21 +219,33 @@ namespace Edu.Module.System
}
/// <summary>
/// 新增修改角色菜单权限
/// 新增修改[角色菜单、角色功能]权限
/// </summary>
/// <param name="list"></param>
/// <param name="roleMenuList">菜单权限列表</param>
/// <param name="roleFunctionList">功能权限列表</param>
/// <returns></returns>
[TransactionCallHandler]
public bool SetRolePermissionModule(List<RB_Role_Permission_ViewModel> list)
public bool SetRolePermissionModule(List<RB_Role_Permission_ViewModel> roleMenuList, List<RB_Role_FunctionPermission_ViewModel> roleFunctionList)
{
bool flag = false;
if (list != null && list.Count > 0)
//菜单权限
if (roleMenuList != null && roleMenuList.Count > 0)
{
rolePermissionRepository.DeleteOne(new WhereHelper(nameof(RB_Role_Permission_ViewModel.Role_Id), list[0].Role_Id));
foreach (var item in list)
rolePermissionRepository.DeleteOne(new WhereHelper(nameof(RB_Role_Permission_ViewModel.Role_Id), roleMenuList[0].Role_Id));
foreach (var item in roleMenuList)
{
item.ID = 0;
flag = rolePermissionRepository.Insert(item);
flag = rolePermissionRepository.Insert(item)>0;
}
}
//功能权限
if (roleFunctionList != null && roleFunctionList.Count > 0)
{
roleFunctionPermissionRepository.DeleteOne(new WhereHelper(nameof(RB_Role_FunctionPermission_ViewModel.Role_Id), roleFunctionList[0].Role_Id));
foreach (var item in roleFunctionList)
{
item.ID = 0;
flag = roleFunctionPermissionRepository.Insert(item)>0;
}
}
return flag;
......@@ -247,28 +261,6 @@ namespace Edu.Module.System
return rolePermissionRepository.GetRolePermissionListRepository(query);
}
/// <summary>
/// 新增修改角色功能权限
/// </summary>
/// <param name="list"></param>
/// <returns></returns>
[TransactionCallHandler]
public bool SetRoleFunctionPermissionModule(List<RB_Role_FunctionPermission_ViewModel> list)
{
bool flag = false;
if (list != null && list.Count > 0)
{
roleFunctionPermissionRepository.DeleteOne(new WhereHelper(nameof(RB_Role_FunctionPermission_ViewModel.Role_Id), list[0].Role_Id));
foreach (var item in list)
{
item.ID = 0;
flag = roleFunctionPermissionRepository.Insert(item);
}
}
return flag;
}
/// <summary>
/// 获取角色功能菜单列表
/// </summary>
......
......@@ -34,7 +34,7 @@ namespace Edu.WebApi.Controllers.Public
/// <summary>
/// 角色处理类对象
/// </summary>
private readonly RoleModule roleModule = new RoleModule();
private readonly RoleModule roleModule = AOP.AOPHelper.CreateAOPObject<RoleModule>();
#region 省市区
......@@ -222,10 +222,24 @@ namespace Edu.WebApi.Controllers.Public
var roleId = base.ParmJObj.GetInt("Role_Id");
if (roleId <= 0)
{
return ApiResult.ParamIsNull(message:"请传递角色编号");
return ApiResult.ParamIsNull(message: "请传递角色编号");
}
var obj = roleModule.GetRolePermissionModule(roleId);
return ApiResult.Success(data: obj);
}
/// <summary>
/// 保存角色权限
/// </summary>
/// <returns></returns>
public ApiResult SetRolePermission()
{
var roleMenu = base.ParmJObj.GetStringValue("roleMenu");
var roleFunction = base.ParmJObj.GetStringValue("roleFunction");
var rolePermissionList = Common.Plugin.JsonHelper.DeserializeObject<List<RB_Role_Permission_ViewModel>>(roleMenu);
var roleFunctionList= Common.Plugin.JsonHelper.DeserializeObject<List<RB_Role_FunctionPermission_ViewModel>>(roleFunction);
bool flag = roleModule.SetRolePermissionModule(rolePermissionList, roleFunctionList);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment