From accc58a6b0f8e3a1dd578e67bbbc58287128e6ca Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Mon, 20 Dec 2021 00:12:22 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=BB=86=E5=8C=96=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=BB=B4=E6=8A=A4=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/blazor/admin/BootstrapAdmin.DataAccess.Models/User.cs | 7 ++----- .../admin/BootstrapAdmin.Web/Components/UserGroup.razor.cs | 2 +- .../admin/BootstrapAdmin.Web/Components/UserRole.razor.cs | 2 +- .../admin/BootstrapAdmin.Web/Pages/Admin/Users.razor | 6 +++--- .../admin/BootstrapAdmin.Web/Pages/Admin/Users.razor.cs | 6 +++--- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/User.cs b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/User.cs index 8f44b001..920ebda6 100644 --- a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/User.cs +++ b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/User.cs @@ -102,13 +102,10 @@ namespace BootstrapAdmin.DataAccess.Models public int IsReset { get; set; } /// - /// 获得/设置 默认格式为 UserName (DisplayName) + /// 获得/设置 默认格式为 DisplayName (UserName) /// /// - public override string ToString() - { - return string.Format("{0} ({1})", UserName, DisplayName); - } + public override string ToString() => $"{DisplayName} ({UserName})"; } /// diff --git a/src/blazor/admin/BootstrapAdmin.Web/Components/UserGroup.razor.cs b/src/blazor/admin/BootstrapAdmin.Web/Components/UserGroup.razor.cs index 8d45f8fc..4f386276 100644 --- a/src/blazor/admin/BootstrapAdmin.Web/Components/UserGroup.razor.cs +++ b/src/blazor/admin/BootstrapAdmin.Web/Components/UserGroup.razor.cs @@ -11,6 +11,6 @@ [Parameter] [NotNull] [EditorRequired] - public string? UserName { get; set; } + public string? UserId { get; set; } } } diff --git a/src/blazor/admin/BootstrapAdmin.Web/Components/UserRole.razor.cs b/src/blazor/admin/BootstrapAdmin.Web/Components/UserRole.razor.cs index bc162953..255d18d3 100644 --- a/src/blazor/admin/BootstrapAdmin.Web/Components/UserRole.razor.cs +++ b/src/blazor/admin/BootstrapAdmin.Web/Components/UserRole.razor.cs @@ -11,6 +11,6 @@ [Parameter] [NotNull] [EditorRequired] - public string? UserName { get; set; } + public string? UserId { get; set; } } } diff --git a/src/blazor/admin/BootstrapAdmin.Web/Pages/Admin/Users.razor b/src/blazor/admin/BootstrapAdmin.Web/Pages/Admin/Users.razor index 431f9782..04d95031 100644 --- a/src/blazor/admin/BootstrapAdmin.Web/Pages/Admin/Users.razor +++ b/src/blazor/admin/BootstrapAdmin.Web/Pages/Admin/Users.razor @@ -1,8 +1,8 @@ @page "/Admin/Users" - + - + @@ -14,7 +14,7 @@ - + diff --git a/src/blazor/admin/BootstrapAdmin.Web/Pages/Admin/Users.razor.cs b/src/blazor/admin/BootstrapAdmin.Web/Pages/Admin/Users.razor.cs index f536d354..a3b69e20 100644 --- a/src/blazor/admin/BootstrapAdmin.Web/Pages/Admin/Users.razor.cs +++ b/src/blazor/admin/BootstrapAdmin.Web/Pages/Admin/Users.razor.cs @@ -12,14 +12,14 @@ namespace BootstrapAdmin.Web.Pages.Admin [NotNull] private DialogService? DialogService { get; set; } - private async Task OnAssignmentDept(User user) + private async Task OnAssignmentGroups(User user) { var option = new DialogOption() { Title = $"分配部门 - {user}", Component = BootstrapDynamicComponent.CreateComponent(new Dictionary { - [nameof(UserGroup.UserName)] = user.UserName + [nameof(UserGroup.UserId)] = user.Id! }) }; @@ -33,7 +33,7 @@ namespace BootstrapAdmin.Web.Pages.Admin Title = $"分配角色 - {user}", Component = BootstrapDynamicComponent.CreateComponent(new Dictionary { - [nameof(UserGroup.UserName)] = user.UserName + [nameof(UserGroup.UserId)] = user.Id! }) };