Commit 3cc48927 authored by 黄奎's avatar 黄奎

页面修改

parent c6b872e9
...@@ -26,11 +26,6 @@ namespace Edu.Model.Entity.System ...@@ -26,11 +26,6 @@ namespace Edu.Model.Entity.System
/// </summary> /// </summary>
public string RoleIntro { get; set; } public string RoleIntro { get; set; }
/// <summary>
/// 角色权限
/// </summary>
public string RoleAuth { get; set; }
/// <summary> /// <summary>
/// 状态(0-正常,1-删除) /// 状态(0-正常,1-删除)
/// </summary> /// </summary>
......
...@@ -41,5 +41,10 @@ namespace Edu.Model.ViewModel.System ...@@ -41,5 +41,10 @@ namespace Edu.Model.ViewModel.System
/// 子菜单列表 /// 子菜单列表
/// </summary> /// </summary>
public List<MenuTree_ViewModel> SubList { get; set; } public List<MenuTree_ViewModel> SubList { get; set; }
/// <summary>
/// 功能权限列表
/// </summary>
public List<RB_Role_FunctionPermission_ViewModel> FunctionSubList { get; set; }
} }
} }
...@@ -22,16 +22,5 @@ namespace Edu.Model.ViewModel.System ...@@ -22,16 +22,5 @@ namespace Edu.Model.ViewModel.System
return Common.ConvertHelper.FormatTime(this.CreateDate); return Common.ConvertHelper.FormatTime(this.CreateDate);
} }
} }
/// <summary>
/// 选中的菜单列表
/// </summary>
public List<int> CheckMenuList
{
get
{
return Common.ConvertHelper.StringToList(this.RoleAuth);
}
}
} }
} }
...@@ -107,11 +107,15 @@ namespace Edu.Module.System ...@@ -107,11 +107,15 @@ namespace Edu.Module.System
/// </summary> /// </summary>
/// <param name="query"></param> /// <param name="query"></param>
/// <returns></returns> /// <returns></returns>
public List<MenuTree_ViewModel> GetTreeMenuModule(RB_Menu_ViewModel query) public List<MenuTree_ViewModel> GetTreeMenuModule(RB_Menu_ViewModel query,bool isGetMenuFuncton=false)
{ {
List<MenuTree_ViewModel> treeList = new List<MenuTree_ViewModel>(); List<MenuTree_ViewModel> treeList = new List<MenuTree_ViewModel>();
var list = GetMenuListModule(query); var list = GetMenuListModule(query);
var functionList = GetMenuFunctionListModule(new RB_Menu_Function_ViewModel()); List<RB_Menu_Function_ViewModel> functionList = new List<RB_Menu_Function_ViewModel>();
if (isGetMenuFuncton)
{
functionList = GetMenuFunctionListModule(new RB_Menu_Function_ViewModel());
}
if (list != null && list.Count > 0) if (list != null && list.Count > 0)
{ {
//一级菜单 //一级菜单
......
...@@ -115,7 +115,7 @@ namespace Edu.Module.System ...@@ -115,7 +115,7 @@ namespace Edu.Module.System
/// </summary> /// </summary>
/// <param name="roleId"></param> /// <param name="roleId"></param>
/// <returns></returns> /// <returns></returns>
public object GetRolePermissionModule(int roleId) public List<MenuTree_ViewModel> GetRolePermissionModule(int roleId)
{ {
//角色菜单权限列表 //角色菜单权限列表
List<RB_Role_Permission_ViewModel> rolePermissionList = new List<RB_Role_Permission_ViewModel>(); List<RB_Role_Permission_ViewModel> rolePermissionList = new List<RB_Role_Permission_ViewModel>();
...@@ -127,7 +127,7 @@ namespace Edu.Module.System ...@@ -127,7 +127,7 @@ namespace Edu.Module.System
roleFunctionList = GetRoleFunctionPermissionListModule(new RB_Role_FunctionPermission_ViewModel() { Role_Id = roleId }); roleFunctionList = GetRoleFunctionPermissionListModule(new RB_Role_FunctionPermission_ViewModel() { Role_Id = roleId });
} }
//菜单列表 //菜单列表
var menuList = menuModule.GetTreeMenuModule(new RB_Menu_ViewModel()); var menuList = menuModule.GetTreeMenuModule(new RB_Menu_ViewModel(),isGetMenuFuncton:true);
if (menuList != null && menuList.Count > 0) if (menuList != null && menuList.Count > 0)
{ {
foreach (var item in menuList) foreach (var item in menuList)
...@@ -149,57 +149,7 @@ namespace Edu.Module.System ...@@ -149,57 +149,7 @@ namespace Edu.Module.System
} }
} }
} }
return menuList;
var functionList = new List<RoleFunctionPermissionTree_ViewModel>();
List<RoleFunctionPermissionTree_ViewModel> resultRoleFunctionTreeList = new List<RoleFunctionPermissionTree_ViewModel>();
//获取枚举中权限列表
foreach (var item in Common.Plugin.EnumHelper.EnumToList(typeof(FunctionPermissionEnum)))
{
resultRoleFunctionTreeList.Add(new RoleFunctionPermissionTree_ViewModel()
{
Action_Id = item.Id,
ActionName = item.Name,
CategoryId = item.Id.ToString().Substring(0, 2),
CategoryName = GetCategoryName(item.Id.ToString().Substring(0, 2)),
IsChecked = false,
Role_Id = roleId,
});
}
if (resultRoleFunctionTreeList != null && resultRoleFunctionTreeList.Count > 0)
{
//根据枚举前两位分类
var categoryList = resultRoleFunctionTreeList.GroupBy(qitem => new { qitem.CategoryId,qitem.CategoryName }).Select(qitem => new { qitem.Key.CategoryId,qitem.Key.CategoryName });
foreach (var item in categoryList)
{
var cateModel = resultRoleFunctionTreeList.Where(qitem => qitem.CategoryId == item.CategoryId).Min();
var rootModel = new RoleFunctionPermissionTree_ViewModel()
{
Action_Id = Convert.ToInt32(cateModel.CategoryId),
ActionName = item.CategoryName,
CategoryId = item.CategoryId,
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;
}
}
functionList.Add(rootModel);
}
}
var obj = new
{
menuList,
functionList
};
return obj;
} }
/// <summary> /// <summary>
......
...@@ -51,7 +51,7 @@ WHERE 1=1 ...@@ -51,7 +51,7 @@ WHERE 1=1
{ {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" builder.AppendFormat(@"
SELECT A.*, SELECT A.*
FROM RB_Menu_Function AS A FROM RB_Menu_Function AS A
WHERE 1=1 WHERE 1=1
"); ");
......
...@@ -276,13 +276,9 @@ namespace Edu.WebApi.Controllers.Public ...@@ -276,13 +276,9 @@ namespace Edu.WebApi.Controllers.Public
[HttpPost] [HttpPost]
public ApiResult GetRolePermission() public ApiResult GetRolePermission()
{ {
var roleId = base.ParmJObj.GetInt("Role_Id"); var roleId = base.ParmJObj.GetInt("Role_Id");
if (roleId <= 0) var list = roleModule.GetRolePermissionModule(roleId);
{ return ApiResult.Success(data: list);
return ApiResult.ParamIsNull(message: "请传递角色编号");
}
var obj = roleModule.GetRolePermissionModule(roleId);
return ApiResult.Success(data: obj);
} }
/// <summary> /// <summary>
......
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