From 32d74ea81ab8b04095d8ce577d68138c690bb54d Mon Sep 17 00:00:00 2001 From: Argo-Tianyi Date: Mon, 28 Feb 2022 19:37:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E5=96=84=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E7=BB=B4=E6=8A=A4=E7=88=B6=E7=BA=A7=E8=8F=9C=E5=8D=95=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BootstrapAdmin.DataAccess.PetaPoco.csproj | 2 +- .../Components/MenuEditor.razor | 29 +++++++ .../Components/MenuEditor.razor.cs | 42 +++++++++ .../Components/MenuTree.razor | 8 ++ .../Components/MenuTree.razor.cs | 87 +++++++++++++++++++ .../Components/MenuTree.razor.css | 7 ++ .../Components/NavigationTree.razor | 2 +- .../Components/ParentMenuTree.razor | 6 ++ .../Components/ParentMenuTree.razor.cs | 66 ++++++++++++++ .../Pages/Admin/Menus.razor | 30 +------ .../Services/AdminTaskService.cs | 2 +- .../admin/BootstrapAdmin.Web/_Imports.razor | 2 +- 12 files changed, 250 insertions(+), 33 deletions(-) create mode 100644 src/blazor/admin/BootstrapAdmin.Web/Components/MenuEditor.razor create mode 100644 src/blazor/admin/BootstrapAdmin.Web/Components/MenuEditor.razor.cs create mode 100644 src/blazor/admin/BootstrapAdmin.Web/Components/MenuTree.razor create mode 100644 src/blazor/admin/BootstrapAdmin.Web/Components/MenuTree.razor.cs create mode 100644 src/blazor/admin/BootstrapAdmin.Web/Components/MenuTree.razor.css create mode 100644 src/blazor/admin/BootstrapAdmin.Web/Components/ParentMenuTree.razor create mode 100644 src/blazor/admin/BootstrapAdmin.Web/Components/ParentMenuTree.razor.cs diff --git a/src/blazor/admin/BootstrapAdmin.DataAccess.PetaPoco/BootstrapAdmin.DataAccess.PetaPoco.csproj b/src/blazor/admin/BootstrapAdmin.DataAccess.PetaPoco/BootstrapAdmin.DataAccess.PetaPoco.csproj index fe49c612..764143cb 100644 --- a/src/blazor/admin/BootstrapAdmin.DataAccess.PetaPoco/BootstrapAdmin.DataAccess.PetaPoco.csproj +++ b/src/blazor/admin/BootstrapAdmin.DataAccess.PetaPoco/BootstrapAdmin.DataAccess.PetaPoco.csproj @@ -1,7 +1,7 @@  - + diff --git a/src/blazor/admin/BootstrapAdmin.Web/Components/MenuEditor.razor b/src/blazor/admin/BootstrapAdmin.Web/Components/MenuEditor.razor new file mode 100644 index 00000000..56784ebe --- /dev/null +++ b/src/blazor/admin/BootstrapAdmin.Web/Components/MenuEditor.razor @@ -0,0 +1,29 @@ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
diff --git a/src/blazor/admin/BootstrapAdmin.Web/Components/MenuEditor.razor.cs b/src/blazor/admin/BootstrapAdmin.Web/Components/MenuEditor.razor.cs new file mode 100644 index 00000000..1511a952 --- /dev/null +++ b/src/blazor/admin/BootstrapAdmin.Web/Components/MenuEditor.razor.cs @@ -0,0 +1,42 @@ +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information. +// Website: https://admin.blazor.zone + +using BootstrapAdmin.DataAccess.Models; + +namespace BootstrapAdmin.Web.Components; + +public partial class MenuEditor +{ + /// + /// + /// + [Parameter] + [EditorRequired] + [NotNull] + public Navigation? Value { get; set; } + + /// + /// + /// + [Parameter] + [EditorRequired] + [NotNull] + public List? ParementMenus { get; set; } + + /// + /// + /// + [Parameter] + [EditorRequired] + [NotNull] + public List? Targets { get; set; } + + /// + /// + /// + [Parameter] + [EditorRequired] + [NotNull] + public List? Apps { get; set; } +} diff --git a/src/blazor/admin/BootstrapAdmin.Web/Components/MenuTree.razor b/src/blazor/admin/BootstrapAdmin.Web/Components/MenuTree.razor new file mode 100644 index 00000000..6a46d70f --- /dev/null +++ b/src/blazor/admin/BootstrapAdmin.Web/Components/MenuTree.razor @@ -0,0 +1,8 @@ +
+ + + + + + +
diff --git a/src/blazor/admin/BootstrapAdmin.Web/Components/MenuTree.razor.cs b/src/blazor/admin/BootstrapAdmin.Web/Components/MenuTree.razor.cs new file mode 100644 index 00000000..1e03cb70 --- /dev/null +++ b/src/blazor/admin/BootstrapAdmin.Web/Components/MenuTree.razor.cs @@ -0,0 +1,87 @@ +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information. +// Website: https://admin.blazor.zone + +using BootstrapAdmin.Web.Core; +using BootstrapAdmin.Web.Services; +using Microsoft.AspNetCore.Components.Web; + +namespace BootstrapAdmin.Web.Components; + +/// +/// +/// +public partial class MenuTree +{ + /// + /// + /// + [Parameter] + [NotNull] + public List? Lookup { get; set; } + + /// + /// + /// + [Parameter] + [NotNull] + public string? DisplayText { get; set; } + + /// + /// + /// + [Parameter] + [NotNull] + public string? Value { get; set; } + + /// + /// + /// + [Parameter] + [NotNull] + public EventCallback ValueChanged { get; set; } + + [Inject] + [NotNull] + private DialogService? DialogService { get; set; } + + private DialogOption? Option { get; set; } + + private async Task OnSelectMenu() + { + Option = new DialogOption() + { + IsScrolling = true, + Title = "选择菜单", + BodyTemplate = BootstrapDynamicComponent.CreateComponent(new Dictionary + { + [nameof(ParentMenuTree.Value)] = Value, + [nameof(ParentMenuTree.ValueChanged)] = EventCallback.Factory.Create(this, v => OnValueChanged(v)) + }).Render(), + FooterTemplate = BootstrapDynamicComponent.CreateComponent