update 菜单完善

This commit is contained in:
2021-04-29 16:07:01 +08:00
parent 88b7b3d4d2
commit 8da9283a69
12 changed files with 107 additions and 45 deletions

View File

@@ -115,11 +115,11 @@ namespace Ewide.Core
[Comment("备注")]
public string Remark { get; set; }
/// <summary>
/// 关联上级菜单显示 0标识关联 1表示不需要关联菜单 仅按钮有效
/// 关联上级菜单显示 0表示不需要关联菜单 1表示关联 仅按钮有效
/// </summary>
[Comment("关联菜单显示")]
[Column("UnbindParent", TypeName = "bit")]
public bool UnbindParent { get; set; }
[Comment("关联菜单显示")]
[Column("VisibleParent", TypeName = "bit")]
public bool VisibleParent { get; set; }
/// <summary>
/// 状态(字典 0正常 1停用 2删除

View File

@@ -88,9 +88,9 @@ namespace Ewide.Core.Service
public string Remark { get; set; }
/// <summary>
/// 绑定上级菜单
/// 绑定上级菜单显示
/// </summary>
public int UnbindParent { get; set; }
public bool VisibleParent { get; set; }
}
public class AddMenuInput : MenuInput

View File

@@ -28,10 +28,20 @@ namespace Ewide.Core.Service
/// </summary>
public string Value { get; set; }
/// <summary>
/// 菜单类型
/// </summary>
public int Type { get; set; }
/// <summary>
/// 关联显示父级
/// </summary>
public bool VisibleParent { get; set; }
/// <summary>
/// 排序,越小优先级越高
/// </summary>
public int Weight { get; set; }
public int Sort { get; set; }
/// <summary>
/// 子节点

View File

@@ -182,7 +182,7 @@ namespace Ewide.Core.Service
var router = input.Router;
var permission = input.Permission;
var openType = input.OpenType;
var isUnbindParent = input.UnbindParent==1;
var isVisibleParent = input.VisibleParent;
if (type.Equals((int)MenuType.DIR))
{
@@ -208,8 +208,8 @@ namespace Ewide.Core.Service
//if (!urlSet.Contains(permission.Replace(":","/")))
// throw Oops.Oh(ErrorCode.meu1005);
}
//按钮可以设置未不绑定菜单
if(isUnbindParent && type.Equals((int)MenuType.BTN))
//按钮可以设置绑定菜单
if(!isVisibleParent && type.Equals((int)MenuType.BTN))
{
throw Oops.Oh(ErrorCode.D4004);
}
@@ -382,7 +382,9 @@ namespace Ewide.Core.Service
ParentId = u.Pid,
Value = u.Id.ToString(),
Title = u.Name,
Weight = u.Sort
Type = u.Type,
VisibleParent = u.VisibleParent,
Sort = u.Sort
}).ToListAsync();
return new TreeBuildUtil<MenuTreeOutput>().DoTreeBuild(menus);
}
@@ -413,7 +415,9 @@ namespace Ewide.Core.Service
ParentId = u.Pid,
Value = u.Id.ToString(),
Title = u.Name,
Weight = u.Sort
Type = u.Type,
VisibleParent = u.VisibleParent,
Sort = u.Sort
}).ToListAsync();
return new TreeBuildUtil<MenuTreeOutput>().DoTreeBuild(menus);
}