Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Education
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
Education
Commits
f90b109b
Commit
f90b109b
authored
Nov 25, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
6fbd9cc9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
9 deletions
+61
-9
MenuTree_ViewModel.cs
Edu.Model/ViewModel/System/MenuTree_ViewModel.cs
+4
-4
RB_Role_ViewModel.cs
Edu.Model/ViewModel/System/RB_Role_ViewModel.cs
+10
-0
RoleModule.cs
Edu.Module.System/RoleModule.cs
+47
-5
No files found.
Edu.Model/ViewModel/System/MenuTree_ViewModel.cs
View file @
f90b109b
...
...
@@ -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
>
Function
SubList
{
get
;
set
;
}
public
List
<
MenuTree_ViewModel
>
SubList
{
get
;
set
;
}
}
}
Edu.Model/ViewModel/System/RB_Role_ViewModel.cs
View file @
f90b109b
...
...
@@ -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
;
}
}
}
Edu.Module.System/RoleModule.cs
View file @
f90b109b
...
...
@@ -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
);
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment