Commit f90b109b authored by 黄奎's avatar 黄奎

页面修改

parent 6fbd9cc9
......@@ -38,13 +38,13 @@ namespace Edu.Model.ViewModel.System
public bool IsChecked { get; set; }
/// <summary>
/// 子菜单列表
/// 菜单类型(1-系统菜单,2-功能菜单)
/// </summary>
public List<MenuTree_ViewModel> SubList { get; set; }
public int MenuType { get; set; }
/// <summary>
/// 功能权限列表
/// 子菜单列表
/// </summary>
public List<RB_Menu_Function_ViewModel> FunctionSubList { get; set; }
public List<MenuTree_ViewModel> SubList { get; set; }
}
}
......@@ -22,5 +22,15 @@ namespace Edu.Model.ViewModel.System
return Common.ConvertHelper.FormatTime(this.CreateDate);
}
}
/// <summary>
/// 角色菜单权限列表
/// </summary>
public List<RB_Role_Permission_ViewModel> RolePermissionList { get; set; }
/// <summary>
/// 角色功能权限列表
/// </summary>
public List<RB_Role_FunctionPermission_ViewModel> RoleFunctionList { get; set; }
}
}
......@@ -25,7 +25,7 @@ namespace Edu.Module.System
private readonly RB_Role_PermissionRepository rolePermissionRepository = new RB_Role_PermissionRepository();
/// <summary>
/// 角色数据权限仓储层对象
/// 角色功能权限表仓储层对象
/// </summary>
private readonly RB_Role_FunctionPermissionRepository roleFunctionPermissionRepository = new RB_Role_FunctionPermissionRepository();
......@@ -67,7 +67,8 @@ namespace Edu.Module.System
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetRoleModule(RB_Role_ViewModel model)
[TransactionCallHandler]
public virtual bool SetRoleModule(RB_Role_ViewModel model)
{
bool flag;
if (model.RoleId > 0)
......@@ -86,6 +87,26 @@ namespace Edu.Module.System
model.RoleId = newId;
flag = newId > 0;
}
rolePermissionRepository.DeleteOne(new WhereHelper(nameof(RB_Role_Permission_ViewModel.Role_Id), model.RoleId));
//添加角色权限
if (model.RolePermissionList != null && model.RolePermissionList.Count > 0)
{
foreach (var roleItem in model.RolePermissionList)
{
roleItem.Role_Id = model.RoleId;
flag= rolePermissionRepository.Insert(roleItem) > 0;
}
}
//添加角色功能权限
roleFunctionPermissionRepository.DeleteOne(new WhereHelper(nameof(RB_Role_FunctionPermission_ViewModel.Role_Id), model.RoleId));
if (model.RoleFunctionList != null && model.RoleFunctionList.Count > 0)
{
foreach (var roleItem in model.RoleFunctionList)
{
roleItem.Role_Id = model.RoleId;
flag = roleFunctionPermissionRepository.Insert(roleItem) > 0;
}
}
return flag;
}
......@@ -140,20 +161,41 @@ namespace Edu.Module.System
{
foreach (var item in menuList)
{
item.MenuType = 1;
item.IsChecked = rolePermissionList?.Where(qitem => qitem.Menu_Id == item.MenuId)?.Count() > 0;
item.FunctionSubList = actionList?.Where(qitem => qitem.MenuId == item.MenuId)?.ToList() ?? new List<RB_Menu_Function_ViewModel>();
//item.FunctionSubList = actionList?.Where(qitem => qitem.MenuId == item.MenuId)?.ToList() ?? new List<RB_Menu_Function_ViewModel>();
if (item.SubList != null && item.SubList.Count > 0)
{
foreach (var subItem in item.SubList)
{
subItem.MenuType = 1;
subItem.IsChecked = rolePermissionList?.Where(qitem => qitem.Menu_Id == subItem.MenuId)?.Count() > 0;
subItem.FunctionSubList = actionList?.Where(qitem => qitem.MenuId == subItem.MenuId)?.ToList() ?? new List<RB_Menu_Function_ViewModel>();
if (subItem.SubList != null && subItem.SubList.Count > 0)
{
foreach (var childItem in subItem.SubList)
{
childItem.FunctionSubList = actionList?.Where(qitem => qitem.MenuId == childItem.MenuId)?.ToList() ?? new List<RB_Menu_Function_ViewModel>();
childItem.MenuType = 1;
childItem.IsChecked = rolePermissionList?.Where(qitem => qitem.Menu_Id == childItem.MenuId)?.Count() > 0;
childItem.SubList = new List<MenuTree_ViewModel>();
var subActionList = actionList?.Where(qitem => qitem.MenuId == childItem.MenuId)?.ToList() ?? new List<RB_Menu_Function_ViewModel>();
if (subActionList != null && subActionList.Count > 0)
{
foreach (var actionItem in actionList)
{
var actionModel = new MenuTree_ViewModel()
{
MenuName = actionItem?.FunctionName+"【F】",
ParentId = childItem.MenuId,
MenuIcon = "",
MenuType = 2,
MenuUrl = "",
MenuId = actionItem.Id,
SubList = new List<MenuTree_ViewModel>()
};
actionModel.IsChecked = roleFunctionList?.Where(qitem => qitem.Action_Id == actionItem.Id)?.Count() > 0;
childItem.SubList.Add(actionModel);
}
}
}
}
}
......
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