You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
97 lines
3.0 KiB
97 lines
3.0 KiB
using System; |
|
using System.Collections.Generic; |
|
using System.ComponentModel.DataAnnotations; |
|
using Volo.Abp.Application.Dtos; |
|
using Volo.Abp.MultiTenancy; |
|
|
|
namespace Sanhe.Abp.MenuManagement |
|
{ |
|
/// <summary> |
|
/// 创建修改菜单 |
|
/// </summary> |
|
public class CreateOrUpdateMenuDto : EntityDto, IValidatableObject |
|
{ |
|
/// <summary> |
|
/// 名称 |
|
/// </summary> |
|
public string Name { get; set; } |
|
/// <summary> |
|
/// 显示名称 |
|
/// </summary> |
|
public string DisplayName { get; set; } |
|
/// <summary> |
|
/// 组件路径 |
|
/// </summary> |
|
public string ComponentPath { get; set; } |
|
/// <summary> |
|
/// 路由路径 |
|
/// </summary> |
|
public string RouterPath { get; set; } |
|
/// <summary> |
|
/// 父Id |
|
/// </summary> |
|
public Guid? ParentId { get; set; } |
|
/// <summary> |
|
/// 菜单类型 |
|
/// </summary> |
|
public MenuEnumType MenuType { get; set; } |
|
/// <summary> |
|
/// 图标 |
|
/// </summary> |
|
public string Icon { get; set; } |
|
/// <summary> |
|
/// 排序 |
|
/// </summary> |
|
public string Sort { get; set; } |
|
/// <summary> |
|
/// window.open _blank |
|
/// </summary> |
|
public string TargetUrl { get; set; } |
|
/// <summary> |
|
/// 此菜单关联的权限key |
|
/// </summary> |
|
public string PermissionKey { get; set; } |
|
/// <summary> |
|
/// 表示多租户应用程序中的所属方 |
|
/// </summary> |
|
public MultiTenancySides MultiTenancySide { get; set; } |
|
|
|
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) |
|
{ |
|
if (MenuType == MenuEnumType.Menu) |
|
{ |
|
if (Name.IsNullOrWhiteSpace()) |
|
{ |
|
yield return new ValidationResult("Name 不能为空", new[] { "Name" }); |
|
} |
|
|
|
if (DisplayName.IsNullOrWhiteSpace()) |
|
{ |
|
yield return new ValidationResult("DisplayName 不能为空", new[] { "DisplayName" }); |
|
} |
|
|
|
if (RouterPath.IsNullOrWhiteSpace()) |
|
{ |
|
yield return new ValidationResult("RouterPath 不能为空", new[] { "RouterPath" }); |
|
} |
|
|
|
if (ComponentPath.IsNullOrWhiteSpace()) |
|
{ |
|
yield return new ValidationResult("ComponentPath 不能为空", new[] { "ComponentPath" }); |
|
} |
|
} |
|
else if (MenuType == MenuEnumType.Permission) |
|
{ |
|
if (DisplayName.IsNullOrWhiteSpace()) |
|
{ |
|
yield return new ValidationResult("DisplayName 不能为空", new[] { "DisplayName" }); |
|
} |
|
|
|
if (!ParentId.HasValue) |
|
{ |
|
yield return new ValidationResult("ParentId 不能为空", new[] { "ParentId" }); |
|
} |
|
} |
|
} |
|
} |
|
} |