Skip to content

Commit 8714564

Browse files
author
1877682825@qq.com
committed
1. 菜单配置页面
1.1新增修改菜单是否页面显示开关 1.2二级列表展示ico
1 parent 0b92aac commit 8714564

File tree

6 files changed

+39
-13
lines changed

6 files changed

+39
-13
lines changed

ant.mgr/Repository/Repository/MenuRespository.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public List<SystemMenuSM> GetMenuTree(long roleId, Token userToken, long roleSen
167167
}
168168
else
169169
{
170-
allMenusList = this.Entity.Where(r => r.IsActive).MappperTo<SystemMenuSM>().ToList();
170+
allMenusList = this.Entity.MappperTo<SystemMenuSM>().ToList();
171171

172172
}
173173
var parentMenu = allMenusList.Where(r => r.ParentTid.Equals(0))
@@ -239,6 +239,7 @@ public string UpdateMenu(AddMenuVm model)
239239
.Set(r => r.Url, model.Url)
240240
.Set(r => r.ParentTid, model.ParentTid)
241241
.Set(r => r.OrderRule, model.OrderRule)
242+
.Set(r => r.IsActive, model.IsActive)
242243
.Update() > 0;
243244
if (!updateResult)
244245
{
@@ -277,7 +278,7 @@ public string AddMenu(AddMenuVm model)
277278
SystemMenu menu = new SystemMenu
278279
{
279280
Class = model.Class,
280-
IsActive = true,
281+
IsActive = model.IsActive,
281282
Name = model.Name,
282283
Url = model.Url,
283284
OrderRule = model.OrderRule,
@@ -300,7 +301,7 @@ public string AddMenu(AddMenuVm model)
300301
/// <returns></returns>
301302
public List<SystemMenuSM> GetSubMenus(long menuTid)
302303
{
303-
var allMenus = this.Entity.Where(r => r.IsActive && r.ParentTid == menuTid)
304+
var allMenus = this.Entity.Where(r => r.ParentTid == menuTid)
304305
.OrderBy(r => r.OrderRule)
305306
.MappperTo<SystemMenuSM>()
306307
.ToList();
@@ -313,7 +314,7 @@ public List<SystemMenuSM> GetSubMenus(long menuTid)
313314
/// <returns></returns>
314315
public List<SystemMenuSM> GetAllParentMenus()
315316
{
316-
var allMenus = this.Entity.Where(r => r.IsActive && r.ParentTid == 0)
317+
var allMenus = this.Entity.Where(r => r.ParentTid == 0)
317318
.OrderBy(r => r.OrderRule)
318319
.MappperTo<SystemMenuSM>().ToList();
319320
return allMenus;
@@ -437,7 +438,7 @@ private List<SystemMenuSM> GetAllRightsMenusTwo(string eid, string menuRights, b
437438
return new List<SystemMenuSM>();
438439
}
439440
var right = new BigInteger(menuRights ?? "0");
440-
var allMenus = this.Entity.Where(r => r.IsActive).MappperTo<SystemMenuSM>().ToList();
441+
var allMenus = this.Entity.MappperTo<SystemMenuSM>().ToList();
441442
var parentMenu = allMenus.Where(r => r.ParentTid.Equals(0) && (right.TestBit((int)r.Tid) || isGlod))
442443
.OrderBy(r => r.OrderRule).ToList();
443444
//递归构建

ant.mgr/ServicesModel/ServicesModel/SystemMenuSM.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public string IdExtend {
5050
public long ParentTid { get; set; }
5151

5252
public string Class { get; set; }
53+
public bool IsActive { get; set; }
5354

5455
[JsonProperty("nodes")]
5556
public List<SystemMenuSM> ChildMunuList { get; set; }

ant.mgr/ViewModels/ViewModels/Reuqest/AddMenuVm.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ public class AddMenuVm
3131
/// 样式
3232
/// </summary>
3333
public string Class { get; set; }
34+
35+
/// <summary>
36+
/// 是否要在页面上显示该菜单
37+
/// </summary>
38+
public bool IsActive { get; set; }
3439

3540
/// <summary>
3641
/// 主键

ant.mgr/mgr.core/App_Start/CustomViewEngine.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,11 @@ private string RenderMenu(List<SystemMenuSM> menuList)
8282

8383
if (mu.ChildMunuList.Count == 0)
8484
{
85+
continue;
8586
//只有一层
86-
sb.AppendLine(
87-
"<a class=\"J_menuItem\" href=\"" + (string.IsNullOrEmpty(mu.Url) ? "#" : Url.Content(mu.Url)) + "\"><i class=\"" + mu.Class +
88-
"\"></i> <span class=\"nav-label\">" + mu.Name + "</span></a>");
87+
//sb.AppendLine(
88+
// "<a class=\"J_menuItem\" href=\"" + (string.IsNullOrEmpty(mu.Url) ? "#" : Url.Content(mu.Url)) + "\"><i class=\"" + mu.Class +
89+
// "\"></i> <span class=\"nav-label\">" + mu.Name + "</span></a>");
8990
}
9091
else
9192
{

ant.mgr/mgr.core/Controllers/AccountController.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public async Task<ActionResult> UserDetail()
6262
/// <returns></returns>
6363
[Route("UpdateUserInfo")]
6464
[ValidateAntiForgeryToken]
65+
[API("更新个人信息")]
6566
[AuthorizeFilter]
6667
public async Task<ActionResult> UpdateUserInfo([FromForm] SystemUsers user)
6768
{
@@ -88,6 +89,7 @@ public async Task<ActionResult> UpdateUserInfo([FromForm] SystemUsers user)
8889
/// <returns></returns>
8990
[Route("UpdatePwd")]
9091
[ValidateAntiForgeryToken]
92+
[API("更新登录密码")]
9193
[AuthorizeFilter]
9294
public async Task<ActionResult> UpdatePwd([FromForm] UpdatePwdVm user)
9395
{

ant.mgr/mgr.core/Views/Home/MenuList.cshtml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<td class="center">{{$index+1}}</td>
4646
<td class='center'>
4747
<i class="{{item.Class}}">&nbsp;</i>{{item.name}}&nbsp;
48-
<span class="label label-success arrowed">系统</span>
48+
<span class="label label-success arrowed">一级</span>
4949
</td>
5050
<td>{{item.Url}}</td>
5151
<td class='center'>{{item.OrderRule}}</td>
@@ -107,9 +107,13 @@
107107
<label class="control-label">Class图标:</label><button type="button" class="btn btn-success" v-on:click="_SelectIco">选择图标</button>
108108
<input class="form-control" type="text" name="menuClass" id="menuClass" placeholder="这里输入Ico" value="" title="Class图标">
109109
</div>
110+
<div class="form-group" id="checkBoxActive" style="display: none">
111+
<label class="control-label">页面展示:&nbsp;&nbsp;&nbsp;</label>
112+
<input type="checkbox" class="js-switch" v-model="currentRow.IsActive" id="isActive" />&nbsp;&nbsp;{{currentRow.IsActive ? "" : ""}}
113+
</div>
110114
</div>
111115
<div class="modal-footer">
112-
<button type="button" class="btn btn-primary" id="close-model" v-on:click="_CloseAddMenu">关闭</button>
116+
<button type="button" class="btn btn-danger" id="close-model" v-on:click="_CloseAddMenu">关闭</button>
113117
<button type="button" class="btn btn-primary" id="save-model" v-on:click="_SaveAddMenu">提交</button>
114118
</div>
115119
</div>
@@ -3328,12 +3332,15 @@
33283332
methods: {
33293333
_toAddMenu: function () {
33303334
vm.add = true;
3335+
changeSwitcheryState('isActive', true);
3336+
$('#checkBoxActive').hide();
33313337
$("#menuUrl").attr("readonly", true);
33323338
$('#myModal').modal({ backdrop: 'static', keyboard: false });
33333339
$('#myModal').modal('show');
33343340
},
33353341
_CloseAddMenu: function () {
33363342
vm.currentRow = {};
3343+
$("#parentId").val('0');
33373344
$('#menuId').val('');
33383345
$('#pId').val('');
33393346
$('#menuName').val('');
@@ -3377,6 +3384,7 @@
33773384
}
33783385
33793386
if (vm.add) {
3387+
33803388
QQT.ajax('/Home/AddMenu',
33813389
'Post',
33823390
{
@@ -3385,7 +3393,8 @@
33853393
Url: $('#menuUrl').val(),
33863394
OrderRule: $('#menuOrder').val(),
33873395
Class: $('#menuClass').val(),
3388-
Tid: $('#menuId').val()
3396+
Tid: $('#menuId').val(),
3397+
IsActive: vm.currentRow.IsActive
33893398
})
33903399
.done(function (response) {
33913400
swal({
@@ -3410,7 +3419,8 @@
34103419
Url: $('#menuUrl').val(),
34113420
OrderRule: $('#menuOrder').val(),
34123421
Class: $('#menuClass').val(),
3413-
Tid: $('#menuId').val()
3422+
Tid: $('#menuId').val(),
3423+
IsActive: vm.currentRow.IsActive
34143424
})
34153425
.done(function (response) {
34163426
swal({
@@ -3435,6 +3445,8 @@
34353445
ready: function () {
34363446
auth();
34373447
onReady();
3448+
initSwitchery();
3449+
changeSwitcheryState('isActive', true);
34383450
}
34393451
});
34403452
@@ -3453,6 +3465,7 @@
34533465
34543466
function setMUR(flag) {
34553467
if ($("#parentId").val() == "0") {
3468+
$('#checkBoxActive').hide();
34563469
$("#menuUrl").attr("readonly", true);
34573470
if (flag) {
34583471
$("#menuUrl").val(flag);
@@ -3462,6 +3475,7 @@
34623475
$("#form-field-radio1").attr("disabled", false);
34633476
$("#form-field-radio2").attr("disabled", false);
34643477
} else {
3478+
$('#checkBoxActive').show();
34653479
$("#menuUrl").attr("readonly", false);
34663480
$("#form-field-radio1").attr("disabled", true);
34673481
$("#form-field-radio2").attr("disabled", true);
@@ -3483,6 +3497,7 @@
34833497
$('#menuOrder').val(menu.OrderRule);
34843498
$('#menuClass').val(menu.Class);
34853499
vm.add = false;
3500+
changeSwitcheryState('isActive', menu.IsActive);
34863501
$("#parentId").val(menu.ParentTid);
34873502
setMUR(menu.Url);
34883503
$('#myModal').modal({ backdrop: 'static', keyboard: false });
@@ -3558,7 +3573,8 @@
35583573
html += "<img src='" +
35593574
window.appUrl +
35603575
"/Content/static/images/join.gif' style='vertical-align: middle;'/>";
3561-
html += "<span style='width:100px;text-align:left;display:inline-block;'>" +
3576+
html += "<span style='width:100px;text-align:left;display:inline-block;" + (!this.IsActive ? "color:red" : "") +
3577+
"' class='" + this.Class + "'" + ">&nbsp;" +
35623578
this.name +
35633579
"</span>";
35643580
html += "</td>";

0 commit comments

Comments
 (0)