From a54aeee0b1607e97ad7abdd9af3b60261032d0bf Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Mon, 21 Dec 2020 18:28:09 +0800 Subject: [PATCH] add layout view --- .../LINGYUN/Platform/Layouts/Dto/LayoutDto.cs | 4 - .../Platform/Layouts/ILayoutAppService.cs | 4 +- .../Platform/Menus/Dto/MenuGetAllInput.cs | 2 + .../Platform/Menus/Dto/MenuGetListInput.cs | 2 + .../Platform/Layouts/LayoutAppService.cs | 26 +- .../LINGYUN/Platform/Menus/MenuAppService.cs | 6 +- .../LINGYUN.Platform.Domain.Shared.csproj | 4 + .../Platform/Localization/Resources/en.json | 13 +- .../Localization/Resources/zh-Hans.json | 7 +- .../Platform/Layouts/ILayoutRepository.cs | 7 +- .../LINGYUN/Platform/Layouts/Layout.cs | 9 - .../LINGYUN/Platform/Menus/IMenuRepository.cs | 3 + .../Platform/PlatformDataSeedContributor.cs | 20 +- .../Platform/Routes/IRouteDataSeeder.cs | 1 - .../Platform/Routes/RouteDataSeeder.cs | 2 - .../Layouts/EfCoreLayoutRepository.cs | 14 +- .../Platform/Menus/EfCoreMenuRepository.cs | 6 + .../Platform/Layouts/LayoutController.cs | 7 + aspnet-core/modules/platform/README.md | 24 + .../LINGYUN.ApiGateway.Host/event-bus-cap.db | Bin 40960 -> 40960 bytes ...3615_Remove-Layout-Column-Code.Designer.cs | 641 ++++++++++++++++++ ...0201221093615_Remove-Layout-Column-Code.cs | 23 + ...ApiHostMigrationsDbContextModelSnapshot.cs | 3 - vueJs/debug.log | 1 + vueJs/src/api/layout.ts | 8 +- vueJs/src/api/menu.ts | 3 + vueJs/src/router/index.ts | 5 + vueJs/src/router/modules/admin.ts | 20 - vueJs/src/router/modules/container.ts | 37 + .../components/CreateOrUpdateLayoutDialog.vue | 275 ++++++++ vueJs/src/views/container/layouts/index.vue | 237 +++++++ .../components/CreateOrUpdateMenuDialog.vue | 4 + .../menus/components/MenuMetaInput.vue | 0 .../{admin => container}/menus/index.vue | 131 ++-- 34 files changed, 1403 insertions(+), 146 deletions(-) create mode 100644 aspnet-core/modules/platform/README.md create mode 100644 aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201221093615_Remove-Layout-Column-Code.Designer.cs create mode 100644 aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201221093615_Remove-Layout-Column-Code.cs create mode 100644 vueJs/src/router/modules/container.ts create mode 100644 vueJs/src/views/container/layouts/components/CreateOrUpdateLayoutDialog.vue create mode 100644 vueJs/src/views/container/layouts/index.vue rename vueJs/src/views/{admin => container}/menus/components/CreateOrUpdateMenuDialog.vue (98%) rename vueJs/src/views/{admin => container}/menus/components/MenuMetaInput.vue (100%) rename vueJs/src/views/{admin => container}/menus/index.vue (69%) diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/LayoutDto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/LayoutDto.cs index 5e59b7547..e9357e1c0 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/LayoutDto.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/Dto/LayoutDto.cs @@ -5,10 +5,6 @@ namespace LINGYUN.Platform.Layouts { public class LayoutDto : RouteDto { - /// - /// 布局编号 - /// - public string Code { get; set; } /// /// 所属平台 /// diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/ILayoutAppService.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/ILayoutAppService.cs index 408877ac7..69dc95752 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/ILayoutAppService.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Layouts/ILayoutAppService.cs @@ -1,4 +1,6 @@ using System; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; namespace LINGYUN.Platform.Layouts @@ -11,6 +13,6 @@ namespace LINGYUN.Platform.Layouts LayoutCreateDto, LayoutUpdateDto> { - + Task> GetAllListAsync(); } } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetAllInput.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetAllInput.cs index e9a54631a..0e8c645a2 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetAllInput.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetAllInput.cs @@ -14,5 +14,7 @@ namespace LINGYUN.Platform.Menus public Guid? ParentId { get; set; } public string Sorting { get; set; } + + public Guid? LayoutId { get; set; } } } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetListInput.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetListInput.cs index 5a86ff7b6..0c073b8e9 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetListInput.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Menus/Dto/MenuGetListInput.cs @@ -12,5 +12,7 @@ namespace LINGYUN.Platform.Menus public bool Reverse { get; set; } public Guid? ParentId { get; set; } + + public Guid? LayoutId { get; set; } } } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Layouts/LayoutAppService.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Layouts/LayoutAppService.cs index 30a289f75..1e7137616 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Layouts/LayoutAppService.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Layouts/LayoutAppService.cs @@ -1,5 +1,6 @@ using LINGYUN.Platform.Datas; using LINGYUN.Platform.Permissions; +using LINGYUN.Platform.Routes; using LINGYUN.Platform.Utils; using Microsoft.AspNetCore.Authorization; using System; @@ -13,42 +14,27 @@ namespace LINGYUN.Platform.Layouts [Authorize(PlatformPermissions.Layout.Default)] public class LayoutAppService : PlatformApplicationServiceBase, ILayoutAppService { - protected IDataRepository DataRepository { get; } protected ILayoutRepository LayoutRepository { get; } public LayoutAppService( - IDataRepository dataRepository, ILayoutRepository layoutRepository) { - DataRepository = dataRepository; LayoutRepository = layoutRepository; } [Authorize(PlatformPermissions.Layout.Create)] public virtual async Task CreateAsync(LayoutCreateDto input) { - var data = DataRepository.FindAsync(input.DataId); - if (data == null) - { - throw new UserFriendlyException($"数据字典 {input.DataId} 的不存在或已删除!"); - } - var layout = await LayoutRepository.FindByNameAsync(input.Name); if (layout != null) { throw new UserFriendlyException($"已经存在名为 {input.Name} 的布局!"); } - var lastLayout = await LayoutRepository.GetLastOrNullAsync(); - var code = lastLayout != null - ? CodeNumberGenerator.CalculateNextCode(lastLayout.Code) - : CodeNumberGenerator.CreateCode(1); - layout = new Layout( GuidGenerator.Create(), input.Path, input.Name, - code, input.DisplayName, input.DataId, input.PlatformType, @@ -83,11 +69,19 @@ namespace LINGYUN.Platform.Layouts return ObjectMapper.Map(layout); } + public virtual async Task> GetAllListAsync() + { + var layouts = await LayoutRepository.GetListAsync(); + + return new ListResultDto( + ObjectMapper.Map, List>(layouts)); + } + public virtual async Task> GetListAsync(GetLayoutListInput input) { var count = await LayoutRepository.GetCountAsync(input.PlatformType, input.Filter); - var layouts = await LayoutRepository.GetListAsync( + var layouts = await LayoutRepository.GetPagedListAsync( input.PlatformType, input.Filter, input.Sorting, input.Reverse, false, input.SkipCount, input.MaxResultCount); diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Menus/MenuAppService.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Menus/MenuAppService.cs index e3e378848..6c39a5237 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Menus/MenuAppService.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Menus/MenuAppService.cs @@ -60,7 +60,7 @@ namespace LINGYUN.Platform.Menus { var menus = await MenuRepository.GetAllAsync( input.Filter, input.Sorting, input.Reverse, - input.PlatformType, input.ParentId); + input.PlatformType, input.ParentId, input.LayoutId); return new ListResultDto( ObjectMapper.Map, List>(menus)); @@ -68,11 +68,11 @@ namespace LINGYUN.Platform.Menus public virtual async Task> GetListAsync(MenuGetListInput input) { - var count = await MenuRepository.GetCountAsync(input.Filter, input.PlatformType, input.ParentId); + var count = await MenuRepository.GetCountAsync(input.Filter, input.PlatformType, input.ParentId, input.LayoutId); var menus = await MenuRepository.GetListAsync( input.Filter, input.Sorting, input.Reverse, - input.PlatformType, input.ParentId, + input.PlatformType, input.ParentId, input.LayoutId, input.SkipCount, input.MaxResultCount); return new PagedResultDto(count, diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN.Platform.Domain.Shared.csproj b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN.Platform.Domain.Shared.csproj index 066eb3595..75b0aa691 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN.Platform.Domain.Shared.csproj +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN.Platform.Domain.Shared.csproj @@ -21,4 +21,8 @@ + + + + diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/en.json b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/en.json index 9cd1bf49a..dad8a587e 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/en.json +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/en.json @@ -28,22 +28,25 @@ "DisplayName:Component": "Component", "DisplayName:Filter": "Filter", "DisplayName:PlatformType": "Platform Type", - "DisplayName:SecrchMenu": "Secrch", + "DisplayName:SecrchMenu": "Secrch Menu", + "DisplayName:SecrchLayout": "Secrch Layout", "DisplayName:Layout": "Layout", "DisplayName:Basic": "Basic", "DisplayName:DataDictionary": "Data Dictionary", + "Layout:AddNew": "Add New", + "Layout:Edit": "Edit", + "Layout:EditByName": "Edit Layout - {0}", + "Layout:Delete": "Delete Layout", "Menu:AddNew": "Add New", "Menu:AddChildren": "Add Children", "Menu:Edit": "Edit", "Menu:EditByName": "Edit Menu - {0}", - "Menu:Delete": "Delete", - "Menu:WillDelete": "The menu {0} will be deleted", - "Data:WillDelete": "The dictionary {0} will be deleted", + "Menu:Delete": "Delete Menu", "Menu:Manage": "Manage Menus", "Data:AddNew": "Add New", "Data:AddChildren": "Add Children", "Data:Edit": "Edit", - "Data:Delete": "Delete", + "Data:Delete": "Delete Data", "Data:AppendItem": "Append Item", "Data:EditItem": "Edit Item", "Data:RemoveItem": "Remove Item", diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/zh-Hans.json b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/zh-Hans.json index f5c536e60..318540f9a 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/zh-Hans.json +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/zh-Hans.json @@ -29,17 +29,20 @@ "DisplayName:Filter": "筛选", "DisplayName:PlatformType": "平台类型", "DisplayName:SecrchMenu": "查询菜单", + "DisplayName:SecrchLayout": "查询布局", "DisplayName:Layout": "布局", "DisplayName:Basic": "基础信息", "DisplayName:DataDictionary": "数据字典", + "Layout:AddNew": "添加新布局", + "Layout:Edit": "编辑布局", + "Layout:EditByName": "编辑布局 - {0}", + "Layout:Delete": "删除布局", "Menu:AddNew": "添加新菜单", "Menu:AddChildren": "添加子菜单", "Menu:Edit": "编辑菜单", "Menu:EditByName": "编辑菜单 - {0}", "Menu:Delete": "删除菜单", - "Menu:WillDelete": "将要删除菜单 {0}", "Menu:Manage": "管理菜单", - "Data:WillDelete": "将要删除字典 {0}", "Data:AddNew": "添加新字典", "Data:AddChildren": "添加下级字典", "Data:Edit": "编辑字典", diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Layouts/ILayoutRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Layouts/ILayoutRepository.cs index 5c5604548..9f09e047b 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Layouts/ILayoutRepository.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Layouts/ILayoutRepository.cs @@ -20,18 +20,15 @@ namespace LINGYUN.Platform.Layouts bool includeDetails = true, CancellationToken cancellationToken = default); - Task GetLastOrNullAsync( - CancellationToken cancellationToken = default); - Task GetCountAsync( PlatformType? platformType = null, string filter = "", CancellationToken cancellationToken = default); - Task> GetListAsync( + Task> GetPagedListAsync( PlatformType? platformType = null, string filter = "", - string sorting = nameof(Layout.Code), + string sorting = nameof(Layout.Name), bool reverse = false, bool includeDetails = false, int skipCount = 0, diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Layouts/Layout.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Layouts/Layout.cs index 6699c22cd..32bf46ff2 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Layouts/Layout.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Layouts/Layout.cs @@ -1,7 +1,6 @@ using JetBrains.Annotations; using LINGYUN.Platform.Routes; using System; -using Volo.Abp; namespace LINGYUN.Platform.Layouts { @@ -10,10 +9,6 @@ namespace LINGYUN.Platform.Layouts /// public class Layout : Route { - /// - /// 布局编号 - /// - public virtual string Code { get; set; } /// /// 所属平台 /// @@ -29,7 +24,6 @@ namespace LINGYUN.Platform.Layouts [NotNull] Guid id, [NotNull] string path, [NotNull] string name, - [NotNull] string code, [NotNull] string displayName, [NotNull] Guid dataId, [NotNull] PlatformType platformType = PlatformType.None, @@ -38,9 +32,6 @@ namespace LINGYUN.Platform.Layouts [CanBeNull] Guid? tenantId = null) : base(id, path, name, displayName, redirect, description, tenantId) { - Check.NotNullOrWhiteSpace(code, nameof(code)); - - Code = code; DataId = dataId; PlatformType = platformType; } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IMenuRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IMenuRepository.cs index b57c0b44e..f2fdafb60 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IMenuRepository.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Menus/IMenuRepository.cs @@ -77,6 +77,7 @@ namespace LINGYUN.Platform.Menus string filter = "", PlatformType? platformType = null, Guid? parentId = null, + Guid? layoutId = null, CancellationToken cancellationToken = default); Task> GetListAsync( @@ -85,6 +86,7 @@ namespace LINGYUN.Platform.Menus bool reverse = false, PlatformType? platformType = null, Guid? parentId = null, + Guid? layoutId = null, int skipCount = 0, int maxResultCount = 10, CancellationToken cancellationToken = default); @@ -95,6 +97,7 @@ namespace LINGYUN.Platform.Menus bool reverse = false, PlatformType? platformType = null, Guid? parentId = null, + Guid? layoutId = null, CancellationToken cancellationToken = default); Task RemoveAllRolesAsync( diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDataSeedContributor.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDataSeedContributor.cs index 466feba01..c34500e6e 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDataSeedContributor.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDataSeedContributor.cs @@ -138,7 +138,6 @@ namespace LINGYUN.Platform var layout = await RouteDataSeeder.SeedLayoutAsync( "Layout", "layout/index.vue", - CodeNumberGenerator.CreateCode(1), "Vue Admin Layout", data.Id, PlatformType.WebMvvm, // 针对当前的vue管理页 @@ -567,10 +566,10 @@ namespace LINGYUN.Platform await SeedMenuAsync( layout, data, - "layout", - "layout", + "layouts", + "layouts", CodeNumberGenerator.AppendCode(containerRoot.Code, CodeNumberGenerator.CreateCode(1)), - "views/admin/layouts/index.vue", + "views/container/layouts/index.vue", "Manage Layouts", "", "Manage Layouts", @@ -578,7 +577,7 @@ namespace LINGYUN.Platform containerRoot.TenantId, new Dictionary() { - { "title", "layout" }, + { "title", "layouts" }, { "icon", "layout" } }, new string[] { "admin" }); @@ -589,7 +588,7 @@ namespace LINGYUN.Platform "menus", "menus", CodeNumberGenerator.AppendCode(containerRoot.Code, CodeNumberGenerator.CreateCode(2)), - "views/admin/menus/index.vue", + "views/container/menus/index.vue", "Manage Menus", "", "Manage Menus", @@ -718,6 +717,7 @@ namespace LINGYUN.Platform Guid? tenantId = null, Dictionary meta = null, string[] roles = null, + Guid[] users = null, bool isPublic = false ) { @@ -754,6 +754,14 @@ namespace LINGYUN.Platform } } + if (users != null) + { + foreach (var user in users) + { + await RouteDataSeeder.SeedUserMenuAsync(user, menu, tenantId); + } + } + return menu; } } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/IRouteDataSeeder.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/IRouteDataSeeder.cs index 59357c51c..3faf37fb0 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/IRouteDataSeeder.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/IRouteDataSeeder.cs @@ -11,7 +11,6 @@ namespace LINGYUN.Platform.Routes Task SeedLayoutAsync( string name, string path, - string code, string displayName, Guid dataId, PlatformType platformType = PlatformType.None, diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/RouteDataSeeder.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/RouteDataSeeder.cs index a5daf80ec..f44680e3b 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/RouteDataSeeder.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/RouteDataSeeder.cs @@ -34,7 +34,6 @@ namespace LINGYUN.Platform.Routes public virtual async Task SeedLayoutAsync( string name, string path, - string code, string displayName, Guid dataId, PlatformType platformType = PlatformType.None, @@ -50,7 +49,6 @@ namespace LINGYUN.Platform.Routes GuidGenerator.Create(), path, name, - code, displayName, dataId, platformType, diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Layouts/EfCoreLayoutRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Layouts/EfCoreLayoutRepository.cs index 3d0abf5db..903dd8e65 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Layouts/EfCoreLayoutRepository.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Layouts/EfCoreLayoutRepository.cs @@ -42,25 +42,17 @@ namespace LINGYUN.Platform.Layouts .CountAsync(GetCancellationToken(cancellationToken)); } - public virtual async Task GetLastOrNullAsync( - CancellationToken cancellationToken = default) - { - return await DbSet - .OrderByDescending(x => x.Code) - .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); - } - - public virtual async Task> GetListAsync( + public virtual async Task> GetPagedListAsync( PlatformType? platformType = null, string filter = "", - string sorting = "Code", + string sorting = nameof(Layout.Name), bool reverse = false, bool includeDetails = false, int skipCount = 0, int maxResultCount = 10, CancellationToken cancellationToken = default) { - sorting ??= nameof(Layout.Code); + sorting ??= nameof(Layout.Name); sorting = reverse ? sorting + " DESC" : sorting; return await DbSet diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs index 2a66d9a33..f934545e5 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs @@ -148,6 +148,7 @@ namespace LINGYUN.Platform.Menus bool reverse = false, PlatformType? platformType = null, Guid? parentId = null, + Guid? layoutId = null, CancellationToken cancellationToken = default) { sorting ??= nameof(Menu.Code); @@ -155,6 +156,7 @@ namespace LINGYUN.Platform.Menus return await DbSet .WhereIf(parentId.HasValue, x => x.ParentId == parentId) + .WhereIf(layoutId.HasValue, x => x.LayoutId == layoutId) .WhereIf(platformType.HasValue, menu => menu.PlatformType.HasFlag(platformType.Value)) .WhereIf(!filter.IsNullOrWhiteSpace(), menu => menu.Path.Contains(filter) || menu.Name.Contains(filter) || @@ -168,10 +170,12 @@ namespace LINGYUN.Platform.Menus string filter = "", PlatformType? platformType = null, Guid? parentId = null, + Guid? layoutId = null, CancellationToken cancellationToken = default) { return await DbSet .WhereIf(parentId.HasValue, x => x.ParentId == parentId) + .WhereIf(layoutId.HasValue, x => x.LayoutId == layoutId) .WhereIf(platformType.HasValue, menu => menu.PlatformType.HasFlag(platformType.Value)) .WhereIf(!filter.IsNullOrWhiteSpace(), menu => menu.Path.Contains(filter) || menu.Name.Contains(filter) || @@ -186,6 +190,7 @@ namespace LINGYUN.Platform.Menus bool reverse = false, PlatformType? platformType = null, Guid? parentId = null, + Guid? layoutId = null, int skipCount = 0, int maxResultCount = 10, CancellationToken cancellationToken = default) @@ -195,6 +200,7 @@ namespace LINGYUN.Platform.Menus return await DbSet .WhereIf(parentId.HasValue, x => x.ParentId == parentId) + .WhereIf(layoutId.HasValue, x => x.LayoutId == layoutId) .WhereIf(platformType.HasValue, menu => menu.PlatformType.HasFlag(platformType.Value)) .WhereIf(!filter.IsNullOrWhiteSpace(), menu => menu.Path.Contains(filter) || menu.Name.Contains(filter) || diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Layouts/LayoutController.cs b/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Layouts/LayoutController.cs index 789316b2a..ac7e6bd33 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Layouts/LayoutController.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Layouts/LayoutController.cs @@ -40,6 +40,13 @@ namespace LINGYUN.Platform.Layouts return await LayoutAppService.GetAsync(id); } + [HttpGet] + [Route("all")] + public virtual async Task> GetAllListAsync() + { + return await LayoutAppService.GetAllListAsync(); + } + [HttpGet] public virtual async Task> GetListAsync(GetLayoutListInput input) { diff --git a/aspnet-core/modules/platform/README.md b/aspnet-core/modules/platform/README.md new file mode 100644 index 000000000..d1bc08765 --- /dev/null +++ b/aspnet-core/modules/platform/README.md @@ -0,0 +1,24 @@ +# LINGYUN.Platform.Domain + +平台管理模块 + +#### 注意 + +> 动态菜单管理 + + ## IDataSeedContributor + 说明: 用于预置菜单数据的接口,模块默认已初始化与vue-admin相关的菜单 + + ## 其他注意事项 + 不论是布局(path)还是菜单(component),都不需要添加 @/ 的前缀(这通常在前端定义路由时需要),因为前端不支持这样的形式 + + +## 配置使用 + + +```csharp +[DependsOn(typeof(PlatformDomainModule))] +public class YouProjectModule : AbpModule +{ + // other +} diff --git a/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/event-bus-cap.db b/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/event-bus-cap.db index 82cd869b882d713c5ff0180bb83d1d8bebf2db37..dc066d37fec461d90669698c4d938b7f2fe9c2fb 100644 GIT binary patch delta 229 zcmZoTz|?SnX@WGP=|mZ4M$?T6OZeFsdABg|ZrRKwu!>i##gmbTO|X&Kuq~Ry*;!s_ z4)1{_OBE(JMz;!@7+9JaS{hgyT38wyn;Bb}Ois+J=Q1)>Fto5TFtak5Jh4@pA5GEZ z_^t?1BV8lI5U3(^Ju@>i3o|qG$&K-zjtI@>dO%Z6jLa;I42%qP4S`yWVCGurnOj(x tn;4h`mnJ8trlzE(a4|42F!Fz4;Qz9jOW_qiH#ajIC)A~z|LZdr002)YJSqSH delta 217 zcmZoTz|?SnX@WGP@kAMCM&peMOZeFs1Q-}NWj1pOtl|}AU|{lL6KrHQY>Vb_c9s|F zm)K)mIoVLMi`T@$(7@Eh*wO+>noLg2tLHW}R4_ENGB&X?Hk_OoEX{9jY>2FAaza=5 zWO-Rm9*_b(Q%h4zBV)_Sjq#q7Yh~H3z=CF$CYDC#CPoHE2D*kuKm;?;NYB*R*c>Pq mT$-GmnwpZD!o>gtK!@_*+RUZ!ik} +using System; +using LINGYUN.Platform.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.Platform.Migrations +{ + [DbContext(typeof(PlatformHttpApiHostMigrationsDbContext))] + [Migration("20201221093615_Remove-Layout-Column-Code")] + partial class RemoveLayoutColumnCode + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) + .HasAnnotation("ProductVersion", "3.1.8") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("LINGYUN.Platform.Datas.Data", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .IsRequired() + .HasColumnName("Code") + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AppPlatformDatas"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AllowBeNull") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(true); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DataId") + .HasColumnType("char(36)"); + + b.Property("DefaultValue") + .HasColumnName("DefaultValue") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("varchar(1024) CHARACTER SET utf8mb4") + .HasMaxLength(1024); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DataId"); + + b.HasIndex("Name"); + + b.ToTable("AppPlatformDataItems"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Layouts.Layout", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DataId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("Redirect") + .HasColumnName("Redirect") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("AppPlatformLayouts"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.Menu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("Code") + .IsRequired() + .HasColumnName("Code") + .HasColumnType("varchar(23) CHARACTER SET utf8mb4") + .HasMaxLength(23); + + b.Property("Component") + .IsRequired() + .HasColumnName("Component") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("DisplayName") + .IsRequired() + .HasColumnName("DisplayName") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("IsPublic") + .HasColumnType("tinyint(1)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("LayoutId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(64) CHARACTER SET utf8mb4") + .HasMaxLength(64); + + b.Property("ParentId") + .HasColumnType("char(36)"); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("Redirect") + .HasColumnName("Redirect") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.ToTable("AppPlatformMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.RoleMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("RoleName") + .IsRequired() + .HasColumnName("RoleName") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("RoleName", "MenuId"); + + b.ToTable("AppPlatformRoleMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Menus.UserMenu", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("MenuId") + .HasColumnType("char(36)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("UserId", "MenuId"); + + b.ToTable("AppPlatformUserMenus"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.AppVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("varchar(40) CHARACTER SET utf8mb4") + .HasMaxLength(40); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnName("Description") + .HasColumnType("longtext CHARACTER SET utf8mb4") + .HasMaxLength(2048); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("PlatformType") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Title") + .IsRequired() + .HasColumnName("Title") + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("Version") + .IsRequired() + .HasColumnName("Version") + .HasColumnType("varchar(20) CHARACTER SET utf8mb4") + .HasMaxLength(20); + + b.HasKey("Id"); + + b.HasIndex("Version"); + + b.ToTable("AppPlatformVersion"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AppVersionId") + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DownloadCount") + .HasColumnType("int"); + + b.Property("FileType") + .HasColumnType("int"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnName("Name") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("Path") + .HasColumnName("Path") + .HasColumnType("varchar(255) CHARACTER SET utf8mb4") + .HasMaxLength(255); + + b.Property("SHA256") + .IsRequired() + .HasColumnName("SHA256") + .HasColumnType("varchar(65) CHARACTER SET utf8mb4") + .HasMaxLength(65); + + b.Property("Size") + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("char(36)"); + + b.Property("Version") + .IsRequired() + .HasColumnName("Version") + .HasColumnType("varchar(20) CHARACTER SET utf8mb4") + .HasMaxLength(20); + + b.HasKey("Id"); + + b.HasIndex("AppVersionId"); + + b.HasIndex("Path", "Name", "Version") + .IsUnique(); + + b.ToTable("AppPlatformVersionFile"); + }); + + modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => + { + b.HasOne("LINGYUN.Platform.Datas.Data", null) + .WithMany("Items") + .HasForeignKey("DataId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => + { + b.HasOne("LINGYUN.Platform.Versions.AppVersion", "AppVersion") + .WithMany("Files") + .HasForeignKey("AppVersionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201221093615_Remove-Layout-Column-Code.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201221093615_Remove-Layout-Column-Code.cs new file mode 100644 index 000000000..3dc9febef --- /dev/null +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20201221093615_Remove-Layout-Column-Code.cs @@ -0,0 +1,23 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace LINGYUN.Platform.Migrations +{ + public partial class RemoveLayoutColumnCode : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Code", + table: "AppPlatformLayouts"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Code", + table: "AppPlatformLayouts", + type: "longtext CHARACTER SET utf8mb4", + nullable: true); + } + } +} diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/PlatformHttpApiHostMigrationsDbContextModelSnapshot.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/PlatformHttpApiHostMigrationsDbContextModelSnapshot.cs index 1a1ed68fe..63f721ef2 100644 --- a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/PlatformHttpApiHostMigrationsDbContextModelSnapshot.cs +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/PlatformHttpApiHostMigrationsDbContextModelSnapshot.cs @@ -200,9 +200,6 @@ namespace LINGYUN.Platform.Migrations .ValueGeneratedOnAdd() .HasColumnType("char(36)"); - b.Property("Code") - .HasColumnType("longtext CHARACTER SET utf8mb4"); - b.Property("ConcurrencyStamp") .IsConcurrencyToken() .HasColumnName("ConcurrencyStamp") diff --git a/vueJs/debug.log b/vueJs/debug.log index b7d44f1be..9fd001a32 100644 --- a/vueJs/debug.log +++ b/vueJs/debug.log @@ -3,3 +3,4 @@ [1211/094715.020:ERROR:directory_reader_win.cc(43)] FindFirstFile: ϵͳҲָ· (0x3) [1219/155359.779:ERROR:directory_reader_win.cc(43)] FindFirstFile: ϵͳҲָ· (0x3) [1220/155401.094:ERROR:directory_reader_win.cc(43)] FindFirstFile: ϵͳҲָ· (0x3) +[1221/155401.113:ERROR:directory_reader_win.cc(43)] FindFirstFile: ϵͳҲָ· (0x3) diff --git a/vueJs/src/api/layout.ts b/vueJs/src/api/layout.ts index 137c50232..af8cc757a 100644 --- a/vueJs/src/api/layout.ts +++ b/vueJs/src/api/layout.ts @@ -1,6 +1,6 @@ import ApiService from './serviceBase' import { urlStringify } from '@/utils/index' -import { FullAuditedEntityDto, PagedResultDto, PagedAndSortedResultRequestDto } from './types' +import { ListResultDto, PagedResultDto, PagedAndSortedResultRequestDto } from './types' const sourceUrl = '/api/platform/layouts' /** 远程服务地址 */ @@ -13,6 +13,11 @@ export default class LayoutService { return ApiService.Get(_url, serviceUrl) } + public static getAllList() { + const _url = sourceUrl + '/all' + return ApiService.Get>(_url, serviceUrl) + } + public static getList(payload: GetLayoutByPaged) { const _url = sourceUrl + '?' + urlStringify(payload) return ApiService.Get>(_url, serviceUrl) @@ -76,7 +81,6 @@ export class Route { } export class Layout extends Route { - code!: string platformType!: PlatformType dataId!: string } diff --git a/vueJs/src/api/menu.ts b/vueJs/src/api/menu.ts index 47cc43238..dd29a114a 100644 --- a/vueJs/src/api/menu.ts +++ b/vueJs/src/api/menu.ts @@ -80,6 +80,7 @@ export class GetAllMenu implements ISortedResultRequest { sorting = '' reverse = false parentId?: string + layoutId?: string platformType?: PlatformType } @@ -91,6 +92,8 @@ export class GetRoleMenu { export class GetMenuByPaged extends PagedAndSortedResultRequestDto { filter = '' reverse = false + layoutId?: string + parentId?: string platformType?: PlatformType } diff --git a/vueJs/src/router/index.ts b/vueJs/src/router/index.ts index 3566d6c04..0335c36cc 100644 --- a/vueJs/src/router/index.ts +++ b/vueJs/src/router/index.ts @@ -10,11 +10,15 @@ import Layout from '@/layout/index.vue' // import tableRouter from './modules/table' // import nestedRouter from './modules/nested' // import taskRouter from './modules/task' +// 就算是动态菜单,依然要在这里定义一下路径,这是为了告诉webpack哪些文件需要打包,否则会找不到页面路径 +// 当然,更好的方法是指定webpack配置 + import adminRouter from './modules/admin' import auditingRouter from './modules/auditing' import apigatewayRouter from './modules/apigateway' import identityServerRouter from './modules/identityServer' import fileManagementRouter from './modules/file-management' +import containerRouter from './modules/container' Vue.use(Router) /* @@ -164,6 +168,7 @@ export const asyncRoutes: RouteConfig[] = [ apigatewayRouter, identityServerRouter, fileManagementRouter, + containerRouter, { path: '*', component: () => import(/* webpackChunkName: "error-page-404" */ '@/views/error-page/404.vue'), diff --git a/vueJs/src/router/modules/admin.ts b/vueJs/src/router/modules/admin.ts index 00802cb7e..32eb3aa68 100644 --- a/vueJs/src/router/modules/admin.ts +++ b/vueJs/src/router/modules/admin.ts @@ -70,26 +70,6 @@ const adminRouter: RouteConfig = { icon: 'claim-type', roles: ['AbpIdentity.IdentityClaimTypes'] } - }, - { - path: 'data-dictionary', - component: () => import(/* webpackChunkName: "claim-type" */ '@/views/admin/data-dictionary/index.vue'), - name: 'data-dictionary', - meta: { - title: '数据字典', - icon: 'data-dictionary', - roles: ['AbpIdentity.IdentityClaimTypes'] - } - }, - { - path: 'menus', - component: () => import(/* webpackChunkName: "claim-type" */ '@/views/admin/menus/index.vue'), - name: 'menus', - meta: { - title: '菜单', - icon: 'menus', - roles: ['AbpIdentity.IdentityClaimTypes'] - } } ] } diff --git a/vueJs/src/router/modules/container.ts b/vueJs/src/router/modules/container.ts new file mode 100644 index 000000000..1be5469c0 --- /dev/null +++ b/vueJs/src/router/modules/container.ts @@ -0,0 +1,37 @@ +import { RouteConfig } from 'vue-router' +import Layout from '@/layout/index.vue' + +const containerRouter: RouteConfig = { + path: '/container', + component: Layout, + meta: { + title: 'container', + icon: 'container', + roles: ['Platform.Layout', 'Platform.Menus'], + alwaysShow: true + }, + children: [ + { + path: 'layouts', + component: () => import(/* webpackChunkName: "layouts" */ '@/views/container/layouts/index.vue'), + name: 'layouts', + meta: { + title: 'layouts', + icon: 'layouts', + roles: ['Platform.Layout'] + } + }, + { + path: 'menus', + component: () => import(/* webpackChunkName: "menus" */ '@/views/container/menus/index.vue'), + name: 'menus', + meta: { + title: 'menus', + icon: 'menus', + roles: ['ApiGateway.Menus'] + } + } + ] +} + +export default containerRouter diff --git a/vueJs/src/views/container/layouts/components/CreateOrUpdateLayoutDialog.vue b/vueJs/src/views/container/layouts/components/CreateOrUpdateLayoutDialog.vue new file mode 100644 index 000000000..016de8522 --- /dev/null +++ b/vueJs/src/views/container/layouts/components/CreateOrUpdateLayoutDialog.vue @@ -0,0 +1,275 @@ + + + + + diff --git a/vueJs/src/views/container/layouts/index.vue b/vueJs/src/views/container/layouts/index.vue new file mode 100644 index 000000000..593d1df51 --- /dev/null +++ b/vueJs/src/views/container/layouts/index.vue @@ -0,0 +1,237 @@ + + + + + diff --git a/vueJs/src/views/admin/menus/components/CreateOrUpdateMenuDialog.vue b/vueJs/src/views/container/menus/components/CreateOrUpdateMenuDialog.vue similarity index 98% rename from vueJs/src/views/admin/menus/components/CreateOrUpdateMenuDialog.vue rename to vueJs/src/views/container/menus/components/CreateOrUpdateMenuDialog.vue index b35d9b873..3aa84600b 100644 --- a/vueJs/src/views/admin/menus/components/CreateOrUpdateMenuDialog.vue +++ b/vueJs/src/views/container/menus/components/CreateOrUpdateMenuDialog.vue @@ -282,6 +282,10 @@ export default class CreateOrUpdateMenuDialog extends Vue { private onLayoutChanged() { const layout = this.layouts.find(x => x.id === this.layoutId) if (layout) { + if (!this.parentId) { + // 对于根菜单,自动设置组件路径为布局路径 + this.menu.component = layout.path + } DataService .get(layout.dataId) .then(res => { diff --git a/vueJs/src/views/admin/menus/components/MenuMetaInput.vue b/vueJs/src/views/container/menus/components/MenuMetaInput.vue similarity index 100% rename from vueJs/src/views/admin/menus/components/MenuMetaInput.vue rename to vueJs/src/views/container/menus/components/MenuMetaInput.vue diff --git a/vueJs/src/views/admin/menus/index.vue b/vueJs/src/views/container/menus/index.vue similarity index 69% rename from vueJs/src/views/admin/menus/index.vue rename to vueJs/src/views/container/menus/index.vue index ce39e8d38..910b15061 100644 --- a/vueJs/src/views/admin/menus/index.vue +++ b/vueJs/src/views/container/menus/index.vue @@ -1,60 +1,69 @@