diff --git a/assets/seed-data/Sys_Menu.json b/assets/seed-data/Sys_Menu.json index 8de79b03..fc614da3 100644 --- a/assets/seed-data/Sys_Menu.json +++ b/assets/seed-data/Sys_Menu.json @@ -24,7 +24,7 @@ "Component": "sys/user", "Icon": "el-icon-user", "Id": 373837957840901, - "Name": "sys-user", + "Name": "sys/user", "ParentId": 373837917724677, "Path": "/sys/user", "Sort": 100, @@ -35,7 +35,7 @@ "Component": "sys/role", "Icon": "sc-icon-role", "Id": 373838018527237, - "Name": "sys-role", + "Name": "sys/role", "ParentId": 373837917724677, "Path": "/sys/role", "Sort": 99, @@ -46,7 +46,7 @@ "Component": "sys/dept", "Icon": "sc-icon-dept", "Id": 373838045605893, - "Name": "sys-dept", + "Name": "sys/dept", "ParentId": 373837917724677, "Path": "/sys/dept", "Sort": 98, @@ -57,7 +57,7 @@ "Component": "sys/menu", "Icon": "el-icon-fold", "Id": 373838070898693, - "Name": "sys-menu", + "Name": "sys/menu", "ParentId": 373837917724677, "Path": "/sys/menu", "Sort": 97, @@ -78,7 +78,7 @@ "Component": "sys/config", "Icon": "el-icon-set-up", "Id": 380415005847557, - "Name": "sys-config", + "Name": "sys/config", "ParentId": 485278637670422, "Path": "/sys/config", "Sort": 100, @@ -89,7 +89,7 @@ "Component": "sys/job", "Icon": "sc-icon-ScheduledJob", "Id": 510067557638158, - "Name": "sys-job", + "Name": "sys/job", "ParentId": 485278637670422, "Path": "/sys/job", "Sort": 99, @@ -100,7 +100,7 @@ "Component": "sys/dic", "Icon": "sc-icon-dic", "Id": 375315654221829, - "Name": "sys-dic", + "Name": "sys/dic", "ParentId": 485278637670422, "Path": "/sys/dic", "Sort": 98, @@ -111,7 +111,7 @@ "Component": "sys/msg", "Icon": "el-icon-message", "Id": 482779610341392, - "Name": "sys-msg", + "Name": "sys/msg", "ParentId": 485278637670422, "Path": "/sys/msg", "Sort": 97, @@ -122,7 +122,7 @@ "Component": "sys/api", "Icon": "sc-icon-api", "Id": 397880678895621, - "Name": "sys-api", + "Name": "sys/api", "ParentId": 485278637670422, "Path": "/sys/api", "Sort": 96, @@ -133,7 +133,7 @@ "Component": "sys/cache", "Icon": "sc-icon-memory", "Id": 374911555702789, - "Name": "sys-cache", + "Name": "sys/cache", "ParentId": 485278637670422, "Path": "/sys/cache", "Sort": 95, @@ -154,7 +154,7 @@ "Component": "sys/log/operation", "Icon": "el-icon-pointer", "Id": 485285246504976, - "Name": "sys-log-operation", + "Name": "sys/log/operation", "ParentId": 374792687640581, "Path": "/sys/log/operation", "Sort": 100, @@ -165,7 +165,7 @@ "Component": "sys/log/login", "Icon": "sc-icon-OpenDoor", "Id": 485285246504970, - "Name": "sys-log-login", + "Name": "sys/log/login", "ParentId": 374792687640581, "Path": "/sys/log/login", "Sort": 99, @@ -186,7 +186,7 @@ "Component": "dev/code", "Icon": "sc-icon-code2", "Id": 373838147022853, - "Name": "dev-code", + "Name": "dev/code", "ParentId": 373838105399301, "Path": "/dev/code", "Sort": 100, @@ -197,10 +197,20 @@ "Id": 482777529417739, "ParentId": 373838105399301, "Icon": "el-icon-eleme-filled", - "Name": "dev-element", - "Path": "https://element-plus.gitee.io/zh-CN/component/button.html", + "Name": "dev/element", + "Path": "http://element-plus.org/zh-CN/component/overview.html", "Sort": 99, "Title": "Element", "Type": 3, + }, + { + "Id": 560217289232398, + "ParentId": 373838105399301, + "Icon": "sc-icon-FreeSql", + "Name": "dev/freesql", + "Path": "https://freesql.net/guide", + "Sort": 99, + "Title": "FreeSql", + "Type": 3, } ] \ No newline at end of file diff --git a/assets/seed-data/Sys_RoleApi.json b/assets/seed-data/Sys_RoleApi.json index ff017513..bf836da7 100644 --- a/assets/seed-data/Sys_RoleApi.json +++ b/assets/seed-data/Sys_RoleApi.json @@ -34,5 +34,13 @@ { "ApiId": "api/sys/site.msg/set.site.msg.status", "RoleId": 371729946431493, + }, + { + "ApiId": "api/sys/user/get.session.user.app.config", + "RoleId": 371729946431493, + }, + { + "ApiId": "api/sys/user/set.session.user.app.config", + "RoleId": 371729946431493, } ] \ No newline at end of file diff --git a/assets/seed-data/Sys_User.json b/assets/seed-data/Sys_User.json index a86d7889..9e5850b2 100644 --- a/assets/seed-data/Sys_User.json +++ b/assets/seed-data/Sys_User.json @@ -6,5 +6,13 @@ "Password": "A8E87D23-49BC-25A1-1C7C-59186BEF5D15", "Token": "A9AFD92E-A33D-4152-9A6C-A9C141D24887", "UserName": "root" + }, + { + "DeptId": 372119301627909, + "Enabled": true, + "Id": 560217289236492, + "Password": "A8E87D23-49BC-25A1-1C7C-59186BEF5D15", + "Token": "4208EA97-B32F-4E39-A290-4C0D27B61EBF", + "UserName": "user" } ] \ No newline at end of file diff --git a/assets/seed-data/Sys_UserProfile.json b/assets/seed-data/Sys_UserProfile.json index fa8bc31b..6944b9d8 100644 --- a/assets/seed-data/Sys_UserProfile.json +++ b/assets/seed-data/Sys_UserProfile.json @@ -1,5 +1,8 @@ [ { "Id": 370942943322181 + }, + { + "Id": 560217289236492 } ] \ No newline at end of file diff --git a/assets/seed-data/Sys_UserRole.json b/assets/seed-data/Sys_UserRole.json index 5069b6c8..fad24415 100644 --- a/assets/seed-data/Sys_UserRole.json +++ b/assets/seed-data/Sys_UserRole.json @@ -2,5 +2,9 @@ { "RoleId": 370943613149253, "UserId": 370942943322181 + }, + { + "RoleId": 371729946431493, + "UserId": 560217289236492 } ] \ No newline at end of file diff --git a/src/backend/NetAdmin.AdmServer.Tests/AllTests.cs b/src/backend/NetAdmin.AdmServer.Tests/AllTests.cs index d119c8b6..268697bc 100644 --- a/src/backend/NetAdmin.AdmServer.Tests/AllTests.cs +++ b/src/backend/NetAdmin.AdmServer.Tests/AllTests.cs @@ -954,6 +954,13 @@ public class AllTests(WebApplicationFactory factory, ITestOutputHelper return default; } + /// + [Fact] + public Task GetSessionUserAppConfigAsync() + { + return default; + } + /// [Fact] public async Task GetVersionAsync() @@ -1342,7 +1349,7 @@ public class AllTests(WebApplicationFactory factory, ITestOutputHelper /// [InlineData(default)] [Theory] - public Task ResetPasswordAsync(ResetPasswordReq req) + public Task ResetPasswordAsync(ResetPasswordReq req) { return default; } @@ -1363,6 +1370,14 @@ public class AllTests(WebApplicationFactory factory, ITestOutputHelper return default; } + /// + [InlineData(default)] + [Theory] + public Task SetDisplayDashboardAsync(SetDisplayDashboardReq req) + { + return default; + } + /// [InlineData(default)] [Theory] @@ -1374,7 +1389,7 @@ public class AllTests(WebApplicationFactory factory, ITestOutputHelper /// [InlineData(default)] [Theory] - public Task SetEnabledAsync(SetDeptEnabledReq req) + public Task SetEnabledAsync(SetDeptEnabledReq req) { return default; } @@ -1382,7 +1397,7 @@ public class AllTests(WebApplicationFactory factory, ITestOutputHelper /// [InlineData(default)] [Theory] - public Task SetEnabledAsync(SetRoleEnabledReq req) + public Task SetEnabledAsync(SetConfigEnabledReq req) { return default; } @@ -1390,7 +1405,7 @@ public class AllTests(WebApplicationFactory factory, ITestOutputHelper /// [InlineData(default)] [Theory] - public Task SetEnabledAsync(SetJobEnabledReq req) + public Task SetEnabledAsync(SetRoleEnabledReq req) { return default; } @@ -1398,7 +1413,23 @@ public class AllTests(WebApplicationFactory factory, ITestOutputHelper /// [InlineData(default)] [Theory] - public Task SetEnabledAsync(SetUserEnabledReq req) + public Task SetEnabledAsync(SetJobEnabledReq req) + { + return default; + } + + /// + [InlineData(default)] + [Theory] + public Task SetEnabledAsync(SetUserEnabledReq req) + { + return default; + } + + /// + [InlineData(default)] + [Theory] + public Task SetIgnorePermissionControlAsync(SetIgnorePermissionControlReq req) { return default; } @@ -1414,7 +1445,15 @@ public class AllTests(WebApplicationFactory factory, ITestOutputHelper /// [InlineData(default)] [Theory] - public Task SetPasswordAsync(SetPasswordReq req) + public Task SetPasswordAsync(SetPasswordReq req) + { + return default; + } + + /// + [InlineData(default)] + [Theory] + public Task SetSessionUserAppConfigAsync(SetSessionUserAppConfigReq req) { return default; } diff --git a/src/backend/NetAdmin.Domain/DbMaps/Sys/Sys_JobRecord.cs b/src/backend/NetAdmin.Domain/DbMaps/Sys/Sys_JobRecord.cs index d01968af..0fe21e68 100644 --- a/src/backend/NetAdmin.Domain/DbMaps/Sys/Sys_JobRecord.cs +++ b/src/backend/NetAdmin.Domain/DbMaps/Sys/Sys_JobRecord.cs @@ -9,6 +9,7 @@ namespace NetAdmin.Domain.DbMaps.Sys; [Index($"{Chars.FLG_DB_INDEX_PREFIX}{nameof(JobId)}_{nameof(TimeId)}", $"{nameof(JobId)},{nameof(TimeId)}", true)] [Index(Chars.FLG_DB_INDEX_PREFIX + nameof(CreatedTime), nameof(CreatedTime), false)] [Index(Chars.FLG_DB_INDEX_PREFIX + nameof(JobId), nameof(JobId), false)] +[Index(Chars.FLG_DB_INDEX_PREFIX + nameof(HttpStatusCode), nameof(HttpStatusCode), false)] [Table(Name = Chars.FLG_DB_TABLE_NAME_PREFIX + nameof(Sys_JobRecord))] public record Sys_JobRecord : LiteImmutableEntity { diff --git a/src/backend/NetAdmin.Domain/DbMaps/Sys/Sys_User.cs b/src/backend/NetAdmin.Domain/DbMaps/Sys/Sys_User.cs index 9f4b35ec..40e8bdd4 100644 --- a/src/backend/NetAdmin.Domain/DbMaps/Sys/Sys_User.cs +++ b/src/backend/NetAdmin.Domain/DbMaps/Sys/Sys_User.cs @@ -115,7 +115,7 @@ public record Sys_User : VersionEntity, IFieldSummary, IFieldEnabled, IRegister ? Array.Empty() : s.RoleIds.Select(x => new Sys_Role { Id = x })); - _ = config.ForType() + _ = config.ForType() .Map( // d => d.Password, s => s.PasswordText.NullOrEmpty() ? Guid.Empty : s.PasswordText.Pwd().Guid()) .Map( // diff --git a/src/backend/NetAdmin.Domain/DbMaps/Sys/Sys_UserProfile.cs b/src/backend/NetAdmin.Domain/DbMaps/Sys/Sys_UserProfile.cs index 45976f93..b3392337 100644 --- a/src/backend/NetAdmin.Domain/DbMaps/Sys/Sys_UserProfile.cs +++ b/src/backend/NetAdmin.Domain/DbMaps/Sys/Sys_UserProfile.cs @@ -9,6 +9,17 @@ namespace NetAdmin.Domain.DbMaps.Sys; [Table(Name = Chars.FLG_DB_TABLE_NAME_PREFIX + nameof(Sys_UserProfile))] public record Sys_UserProfile : VersionEntity, IRegister { + /// + /// 应用配置 + /// + #if DBTYPE_SQLSERVER + [Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_MAX)] + #else + [Column(DbType = Chars.FLG_DB_FIELD_TYPE_VARCHAR_255)] + #endif + [JsonIgnore] + public virtual string AppConfig { get; init; } + /// /// 出生日期 /// diff --git a/src/backend/NetAdmin.Domain/Dto/Sys/Cache/GetAllEntriesReq.cs b/src/backend/NetAdmin.Domain/Dto/Sys/Cache/GetAllEntriesReq.cs index e44860f8..18107420 100644 --- a/src/backend/NetAdmin.Domain/Dto/Sys/Cache/GetAllEntriesReq.cs +++ b/src/backend/NetAdmin.Domain/Dto/Sys/Cache/GetAllEntriesReq.cs @@ -8,5 +8,5 @@ public sealed record GetAllEntriesReq : DataAbstraction /// /// 数据库索引号 /// - public uint DbIndex { get; init; } + public int DbIndex { get; init; } } \ No newline at end of file diff --git a/src/backend/NetAdmin.Domain/Dto/Sys/User/EditSingleUserReq.cs b/src/backend/NetAdmin.Domain/Dto/Sys/Config/SetConfigEnabledReq.cs similarity index 61% rename from src/backend/NetAdmin.Domain/Dto/Sys/User/EditSingleUserReq.cs rename to src/backend/NetAdmin.Domain/Dto/Sys/Config/SetConfigEnabledReq.cs index 5091b4f7..73b9d70e 100644 --- a/src/backend/NetAdmin.Domain/Dto/Sys/User/EditSingleUserReq.cs +++ b/src/backend/NetAdmin.Domain/Dto/Sys/Config/SetConfigEnabledReq.cs @@ -1,22 +1,22 @@ using NetAdmin.Domain.DbMaps.Dependency; using NetAdmin.Domain.DbMaps.Dependency.Fields; using NetAdmin.Domain.DbMaps.Sys; -using NetAdmin.Domain.Dto.Sys.UserProfile; -namespace NetAdmin.Domain.Dto.Sys.User; +namespace NetAdmin.Domain.Dto.Sys.Config; /// -/// 请求:编辑用户单体 +/// 请求:启用/禁用配置 /// -public sealed record EditSingleUserReq : CreateEditUserReq +public sealed record SetConfigEnabledReq : Sys_Config { + /// + [JsonIgnore(Condition = JsonIgnoreCondition.Never)] + public override bool Enabled { get; init; } + /// [JsonIgnore(Condition = JsonIgnoreCondition.Never)] public override long Id { get; init; } - /// - public new EditUserProfileReq Profile { get; init; } - /// [JsonIgnore(Condition = JsonIgnoreCondition.Never)] public override long Version { get; init; } diff --git a/src/backend/NetAdmin.Domain/Dto/Sys/Job/FinishJobReq.cs b/src/backend/NetAdmin.Domain/Dto/Sys/Job/FinishJobReq.cs index 891048be..21ba8801 100644 --- a/src/backend/NetAdmin.Domain/Dto/Sys/Job/FinishJobReq.cs +++ b/src/backend/NetAdmin.Domain/Dto/Sys/Job/FinishJobReq.cs @@ -5,4 +5,11 @@ namespace NetAdmin.Domain.Dto.Sys.Job; /// /// 请求:完成计划作业 /// -public sealed record FinishJobReq : Sys_Job; \ No newline at end of file +public sealed record FinishJobReq : Sys_Job, IRegister +{ + /// + public void Register(TypeAdapterConfig config) + { + _ = config.ForType().Map(d => d.LastStatusCode, s => ((Sys_Job)s).LastStatusCode); + } +} \ No newline at end of file diff --git a/src/backend/NetAdmin.Domain/Dto/Sys/Job/QueryJobRsp.cs b/src/backend/NetAdmin.Domain/Dto/Sys/Job/QueryJobRsp.cs index 38aac976..ab35051b 100644 --- a/src/backend/NetAdmin.Domain/Dto/Sys/Job/QueryJobRsp.cs +++ b/src/backend/NetAdmin.Domain/Dto/Sys/Job/QueryJobRsp.cs @@ -12,6 +12,17 @@ namespace NetAdmin.Domain.Dto.Sys.Job; /// public sealed record QueryJobRsp : Sys_Job { + /// + public new string LastStatusCode => + #pragma warning disable IDE0072 + base.LastStatusCode switch { + #pragma warning restore IDE0072 + null => null + , _ => (int)base.LastStatusCode.Value == Numbers.HTTP_STATUS_BIZ_FAIL + ? nameof(ErrorCodes.Unhandled).ToLowerCamelCase() + : base.LastStatusCode.Value.ToString().ToLowerCamelCase() + }; + /// [JsonIgnore(Condition = JsonIgnoreCondition.Never)] public override DateTime CreatedTime { get; init; } @@ -52,10 +63,6 @@ public sealed record QueryJobRsp : Sys_Job [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public override DateTime? LastExecTime { get; init; } - /// - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public override HttpStatusCode? LastStatusCode { get; init; } - /// [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public override DateTime? ModifiedTime { get; init; } diff --git a/src/backend/NetAdmin.Domain/Dto/Sys/JobRecord/QueryJobRecordRsp.cs b/src/backend/NetAdmin.Domain/Dto/Sys/JobRecord/QueryJobRecordRsp.cs index 0d4d375a..70f06d9b 100644 --- a/src/backend/NetAdmin.Domain/Dto/Sys/JobRecord/QueryJobRecordRsp.cs +++ b/src/backend/NetAdmin.Domain/Dto/Sys/JobRecord/QueryJobRecordRsp.cs @@ -1,6 +1,7 @@ using NetAdmin.Domain.DbMaps.Dependency; using NetAdmin.Domain.DbMaps.Dependency.Fields; using NetAdmin.Domain.DbMaps.Sys; +using NetAdmin.Domain.Dto.Sys.Job; using HttpMethods = NetAdmin.Domain.Enums.HttpMethods; namespace NetAdmin.Domain.Dto.Sys.JobRecord; @@ -11,8 +12,10 @@ namespace NetAdmin.Domain.Dto.Sys.JobRecord; public sealed record QueryJobRecordRsp : Sys_JobRecord { /// - [JsonIgnore(Condition = JsonIgnoreCondition.Never)] - public new HttpStatusCode HttpStatusCode => (HttpStatusCode)base.HttpStatusCode; + public new string HttpStatusCode => + base.HttpStatusCode == Numbers.HTTP_STATUS_BIZ_FAIL + ? nameof(ErrorCodes.Unhandled).ToLowerCamelCase() + : ((HttpStatusCode)base.HttpStatusCode).ToString().ToLowerCamelCase(); /// [JsonIgnore(Condition = JsonIgnoreCondition.Never)] @@ -30,6 +33,11 @@ public sealed record QueryJobRecordRsp : Sys_JobRecord [JsonIgnore(Condition = JsonIgnoreCondition.Never)] public override long Id { get; init; } + /// + /// 作业信息 + /// + public new QueryJobRsp Job { get; init; } + /// [JsonIgnore(Condition = JsonIgnoreCondition.Never)] public override long JobId { get; init; } diff --git a/src/backend/NetAdmin.Domain/Dto/Sys/Role/SetDisplayDashboardReq.cs b/src/backend/NetAdmin.Domain/Dto/Sys/Role/SetDisplayDashboardReq.cs new file mode 100644 index 00000000..a4c22f34 --- /dev/null +++ b/src/backend/NetAdmin.Domain/Dto/Sys/Role/SetDisplayDashboardReq.cs @@ -0,0 +1,23 @@ +using NetAdmin.Domain.DbMaps.Dependency; +using NetAdmin.Domain.DbMaps.Dependency.Fields; +using NetAdmin.Domain.DbMaps.Sys; + +namespace NetAdmin.Domain.Dto.Sys.Role; + +/// +/// 请求:设置是否显示仪表板 +/// +public sealed record SetDisplayDashboardReq : Sys_Role +{ + /// + [JsonIgnore(Condition = JsonIgnoreCondition.Never)] + public override bool DisplayDashboard { get; init; } + + /// + [JsonIgnore(Condition = JsonIgnoreCondition.Never)] + public override long Id { get; init; } + + /// + [JsonIgnore(Condition = JsonIgnoreCondition.Never)] + public override long Version { get; init; } +} \ No newline at end of file diff --git a/src/backend/NetAdmin.Domain/Dto/Sys/Role/SetIgnorePermissionControlReq.cs b/src/backend/NetAdmin.Domain/Dto/Sys/Role/SetIgnorePermissionControlReq.cs new file mode 100644 index 00000000..a6d3f4cb --- /dev/null +++ b/src/backend/NetAdmin.Domain/Dto/Sys/Role/SetIgnorePermissionControlReq.cs @@ -0,0 +1,23 @@ +using NetAdmin.Domain.DbMaps.Dependency; +using NetAdmin.Domain.DbMaps.Dependency.Fields; +using NetAdmin.Domain.DbMaps.Sys; + +namespace NetAdmin.Domain.Dto.Sys.Role; + +/// +/// 请求:设置是否忽略权限控制 +/// +public sealed record SetIgnorePermissionControlReq : Sys_Role +{ + /// + [JsonIgnore(Condition = JsonIgnoreCondition.Never)] + public override long Id { get; init; } + + /// + [JsonIgnore(Condition = JsonIgnoreCondition.Never)] + public override bool IgnorePermissionControl { get; init; } + + /// + [JsonIgnore(Condition = JsonIgnoreCondition.Never)] + public override long Version { get; init; } +} \ No newline at end of file diff --git a/src/backend/NetAdmin.Domain/Dto/Sys/UserProfile/GetSessionUserAppConfigRsp.cs b/src/backend/NetAdmin.Domain/Dto/Sys/UserProfile/GetSessionUserAppConfigRsp.cs new file mode 100644 index 00000000..12a390f6 --- /dev/null +++ b/src/backend/NetAdmin.Domain/Dto/Sys/UserProfile/GetSessionUserAppConfigRsp.cs @@ -0,0 +1,23 @@ +using NetAdmin.Domain.DbMaps.Dependency; +using NetAdmin.Domain.DbMaps.Dependency.Fields; +using NetAdmin.Domain.DbMaps.Sys; + +namespace NetAdmin.Domain.Dto.Sys.UserProfile; + +/// +/// 响应:获取当前用户应用配置 +/// +public sealed record GetSessionUserAppConfigRsp : Sys_UserProfile +{ + /// + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public override string AppConfig { get; init; } + + /// + [JsonIgnore(Condition = JsonIgnoreCondition.Never)] + public override long Id { get; init; } + + /// + [JsonIgnore(Condition = JsonIgnoreCondition.Never)] + public override long Version { get; init; } +} \ No newline at end of file diff --git a/src/backend/NetAdmin.Domain/Dto/Sys/UserProfile/SetSessionUserAppConfigReq.cs b/src/backend/NetAdmin.Domain/Dto/Sys/UserProfile/SetSessionUserAppConfigReq.cs new file mode 100644 index 00000000..3da551ae --- /dev/null +++ b/src/backend/NetAdmin.Domain/Dto/Sys/UserProfile/SetSessionUserAppConfigReq.cs @@ -0,0 +1,13 @@ +using NetAdmin.Domain.DbMaps.Sys; + +namespace NetAdmin.Domain.Dto.Sys.UserProfile; + +/// +/// 请求:设置当前用户应用配置 +/// +public record SetSessionUserAppConfigReq : Sys_UserProfile +{ + /// + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public override string AppConfig { get; init; } +} \ No newline at end of file diff --git a/src/backend/NetAdmin.Host/Extensions/UnitOfWorkManagerExtensions.cs b/src/backend/NetAdmin.Host/Extensions/UnitOfWorkManagerExtensions.cs index 1316c5f0..3e26ec09 100644 --- a/src/backend/NetAdmin.Host/Extensions/UnitOfWorkManagerExtensions.cs +++ b/src/backend/NetAdmin.Host/Extensions/UnitOfWorkManagerExtensions.cs @@ -21,7 +21,8 @@ public static class UnitOfWorkManagerExtensions unitOfWork.Commit(); logger?.Info($"{Ln.事务已提交}: {hashCode}"); } - catch { + catch (Exception ex) { + logger?.Warn(ex); unitOfWork.Rollback(); logger?.Warn($"{Ln.事务已回滚}: {hashCode}"); throw; diff --git a/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/IConfigModule.cs b/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/IConfigModule.cs index d7d74c42..b21d9274 100644 --- a/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/IConfigModule.cs +++ b/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/IConfigModule.cs @@ -21,4 +21,9 @@ public interface IConfigModule : ICrudModule Task GetLatestConfigAsync(); + + /// + /// 设置配置启用状态 + /// + Task SetEnabledAsync(SetConfigEnabledReq req); } \ No newline at end of file diff --git a/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/IDeptModule.cs b/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/IDeptModule.cs index 21f0ce00..153d0bd8 100644 --- a/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/IDeptModule.cs +++ b/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/IDeptModule.cs @@ -20,5 +20,5 @@ public interface IDeptModule : ICrudModule /// 启用/禁用部门 /// - Task SetEnabledAsync(SetDeptEnabledReq req); + Task SetEnabledAsync(SetDeptEnabledReq req); } \ No newline at end of file diff --git a/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/IJobModule.cs b/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/IJobModule.cs index da1e070b..4eb1b95e 100644 --- a/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/IJobModule.cs +++ b/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/IJobModule.cs @@ -52,5 +52,5 @@ public interface IJobModule : ICrudModule /// 设置计划作业启用状态 /// - Task SetEnabledAsync(SetJobEnabledReq req); + Task SetEnabledAsync(SetJobEnabledReq req); } \ No newline at end of file diff --git a/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/IRoleModule.cs b/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/IRoleModule.cs index 621dd45e..c3da81b7 100644 --- a/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/IRoleModule.cs +++ b/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/IRoleModule.cs @@ -17,8 +17,18 @@ public interface IRoleModule : ICrudModule Task EditAsync(EditRoleReq req); + /// + /// 设置是否显示仪表板 + /// + Task SetDisplayDashboardAsync(SetDisplayDashboardReq req); + /// /// 启用/禁用角色 /// - Task SetEnabledAsync(SetRoleEnabledReq req); + Task SetEnabledAsync(SetRoleEnabledReq req); + + /// + /// 设置是否忽略权限控制 + /// + Task SetIgnorePermissionControlAsync(SetIgnorePermissionControlReq req); } \ No newline at end of file diff --git a/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/IUserModule.cs b/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/IUserModule.cs index c87e7f0a..d492fb11 100644 --- a/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/IUserModule.cs +++ b/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/IUserModule.cs @@ -8,9 +8,9 @@ namespace NetAdmin.SysComponent.Application.Modules.Sys; /// /// 用户模块 /// -public interface IUserModule : ICrudModule { /// @@ -51,7 +51,7 @@ public interface IUserModule : ICrudModule /// 重设密码 /// - Task ResetPasswordAsync(ResetPasswordReq req); + Task ResetPasswordAsync(ResetPasswordReq req); /// /// 设置用户头像 @@ -66,7 +66,7 @@ public interface IUserModule : ICrudModule /// 启用/禁用用户 /// - Task SetEnabledAsync(SetUserEnabledReq req); + Task SetEnabledAsync(SetUserEnabledReq req); /// /// 设置手机号码 @@ -76,7 +76,7 @@ public interface IUserModule : ICrudModule /// 设置密码 /// - Task SetPasswordAsync(SetPasswordReq req); + Task SetPasswordAsync(SetPasswordReq req); /// /// 当前用户信息 diff --git a/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/Session/IUserModule.cs b/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/Session/IUserModule.cs new file mode 100644 index 00000000..16a7a99e --- /dev/null +++ b/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/Session/IUserModule.cs @@ -0,0 +1,17 @@ +using NetAdmin.Domain.Dto.Sys.UserProfile; + +// ReSharper disable once CheckNamespace +namespace NetAdmin.SysComponent.Application.Modules.Sys; + +public partial interface IUserModule +{ + /// + /// 获取当前用户应用配置 + /// + Task GetSessionUserAppConfigAsync(); + + /// + /// 设置当前用户应用配置 + /// + Task SetSessionUserAppConfigAsync(SetSessionUserAppConfigReq req); +} \ No newline at end of file diff --git a/src/backend/NetAdmin.SysComponent.Application/Services/Sys/ConfigService.cs b/src/backend/NetAdmin.SysComponent.Application/Services/Sys/ConfigService.cs index c02c0ce1..1113f312 100644 --- a/src/backend/NetAdmin.SysComponent.Application/Services/Sys/ConfigService.cs +++ b/src/backend/NetAdmin.SysComponent.Application/Services/Sys/ConfigService.cs @@ -122,6 +122,13 @@ public sealed class ConfigService(BasicRepository rpo) // return ret.Adapt>(); } + /// + public Task SetEnabledAsync(SetConfigEnabledReq req) + { + req.ThrowIfInvalid(); + return UpdateAsync(req, [nameof(req.Enabled)]); + } + private ISelect QueryInternal(QueryReq req) { var ret = Rpo.Select.Include(a => a.UserRegisterDept) diff --git a/src/backend/NetAdmin.SysComponent.Application/Services/Sys/ConstantService.cs b/src/backend/NetAdmin.SysComponent.Application/Services/Sys/ConstantService.cs index 50749517..bc380bb5 100644 --- a/src/backend/NetAdmin.SysComponent.Application/Services/Sys/ConstantService.cs +++ b/src/backend/NetAdmin.SysComponent.Application/Services/Sys/ConstantService.cs @@ -24,16 +24,14 @@ public sealed class ConstantService : ServiceBase, IConstantSe .ToDictionary(x => x.Name, x => // x.GetEnumValues().Cast().ToDictionary(y => y.ToString(), GetDicValue)); - ret.Add( // - $"{nameof(HttpStatusCode)}s" // - , Enum.GetNames() - .ToDictionary( - x => x - , x => new[] { - Convert.ToInt64(Enum.Parse(x), CultureInfo.InvariantCulture) - .ToString(CultureInfo.InvariantCulture) - , x - })); + var httpStatusCodes = Enum.GetNames().ToDictionary(x => x, GetHttpStatusCodeDicValue); + httpStatusCodes.Add( // + nameof(ErrorCodes.Unhandled) + , [ + Numbers.HTTP_STATUS_BIZ_FAIL.ToInvString(), nameof(ErrorCodes.Unhandled) + , nameof(Indicates.Danger).ToLowerInvariant() + ]); + ret.Add($"{nameof(HttpStatusCode)}s", httpStatusCodes); return ret; static string[] GetDicValue(Enum y) @@ -45,6 +43,19 @@ public sealed class ConstantService : ServiceBase, IConstantSe var indicate = y.GetAttributeOfType()?.Indicate.ToLowerInvariant(); return indicate.NullOrEmpty() ? ret : [..ret, indicate]; } + + static string[] GetHttpStatusCodeDicValue(string name) + { + var codeInt = Convert.ToInt64(Enum.Parse(name), CultureInfo.InvariantCulture); + return [ + codeInt.ToString(CultureInfo.InvariantCulture), name + , (codeInt switch { + >= 200 and < 300 => nameof(Indicates.Success) + , < 400 => nameof(Indicates.Warning) + , _ => nameof(Indicates.Danger) + }).ToLowerInvariant() + ]; + } } /// diff --git a/src/backend/NetAdmin.SysComponent.Application/Services/Sys/Dependency/IUserProfileService.cs b/src/backend/NetAdmin.SysComponent.Application/Services/Sys/Dependency/IUserProfileService.cs index 1132d128..db57103b 100644 --- a/src/backend/NetAdmin.SysComponent.Application/Services/Sys/Dependency/IUserProfileService.cs +++ b/src/backend/NetAdmin.SysComponent.Application/Services/Sys/Dependency/IUserProfileService.cs @@ -13,4 +13,14 @@ public interface IUserProfileService : IService, IUserProfileModule /// 编辑用户档案 /// Task EditAsync(EditUserProfileReq req); + + /// + /// 获取当前用户配置 + /// + Task GetSessionUserAppConfigAsync(); + + /// + /// 设置当前用户配置 + /// + Task SetSessionUserAppConfigAsync(SetSessionUserAppConfigReq req); } \ No newline at end of file diff --git a/src/backend/NetAdmin.SysComponent.Application/Services/Sys/DeptService.cs b/src/backend/NetAdmin.SysComponent.Application/Services/Sys/DeptService.cs index aa811ea1..419f4b60 100644 --- a/src/backend/NetAdmin.SysComponent.Application/Services/Sys/DeptService.cs +++ b/src/backend/NetAdmin.SysComponent.Application/Services/Sys/DeptService.cs @@ -120,7 +120,7 @@ public sealed class DeptService(BasicRepository rpo) // } /// - public Task SetEnabledAsync(SetDeptEnabledReq req) + public Task SetEnabledAsync(SetDeptEnabledReq req) { req.ThrowIfInvalid(); return UpdateAsync(req, [nameof(req.Enabled)]); diff --git a/src/backend/NetAdmin.SysComponent.Application/Services/Sys/JobRecordService.cs b/src/backend/NetAdmin.SysComponent.Application/Services/Sys/JobRecordService.cs index 0ed155c3..10711542 100644 --- a/src/backend/NetAdmin.SysComponent.Application/Services/Sys/JobRecordService.cs +++ b/src/backend/NetAdmin.SysComponent.Application/Services/Sys/JobRecordService.cs @@ -165,7 +165,8 @@ public sealed class JobRecordService(BasicRepository rpo) / private ISelect QueryInternal(QueryReq req) { - var ret = Rpo.Select.WhereDynamicFilter(req.DynamicFilter) + var ret = Rpo.Select.Include(a => a.Job) + .WhereDynamicFilter(req.DynamicFilter) .WhereDynamic(req.Filter) .WhereIf( // req.Keywords?.Length > 0 diff --git a/src/backend/NetAdmin.SysComponent.Application/Services/Sys/JobService.cs b/src/backend/NetAdmin.SysComponent.Application/Services/Sys/JobService.cs index a624e0a1..ddc4c703 100644 --- a/src/backend/NetAdmin.SysComponent.Application/Services/Sys/JobService.cs +++ b/src/backend/NetAdmin.SysComponent.Application/Services/Sys/JobService.cs @@ -295,7 +295,7 @@ public sealed class JobService(BasicRepository rpo, IJobRecordSer } /// - public Task SetEnabledAsync(SetJobEnabledReq req) + public Task SetEnabledAsync(SetJobEnabledReq req) { req.ThrowIfInvalid(); return UpdateAsync(req, [nameof(Sys_Job.Enabled)]); diff --git a/src/backend/NetAdmin.SysComponent.Application/Services/Sys/RoleService.cs b/src/backend/NetAdmin.SysComponent.Application/Services/Sys/RoleService.cs index 3000a878..2707f7c2 100644 --- a/src/backend/NetAdmin.SysComponent.Application/Services/Sys/RoleService.cs +++ b/src/backend/NetAdmin.SysComponent.Application/Services/Sys/RoleService.cs @@ -124,12 +124,26 @@ public sealed class RoleService(BasicRepository rpo) // } /// - public Task SetEnabledAsync(SetRoleEnabledReq req) + public Task SetDisplayDashboardAsync(SetDisplayDashboardReq req) + { + req.ThrowIfInvalid(); + return UpdateAsync(req, [nameof(req.DisplayDashboard)]); + } + + /// + public Task SetEnabledAsync(SetRoleEnabledReq req) { req.ThrowIfInvalid(); return UpdateAsync(req, [nameof(req.Enabled)]); } + /// + public Task SetIgnorePermissionControlAsync(SetIgnorePermissionControlReq req) + { + req.ThrowIfInvalid(); + return UpdateAsync(req, [nameof(req.IgnorePermissionControl)]); + } + private ISelect QueryInternal(QueryReq req) { var ret = Rpo.Select.IncludeMany(a => a.Depts.Select(b => new Sys_Dept { Id = b.Id })) diff --git a/src/backend/NetAdmin.SysComponent.Application/Services/Sys/UserProfileService.cs b/src/backend/NetAdmin.SysComponent.Application/Services/Sys/UserProfileService.cs index 3a6f5b83..adbdab7d 100644 --- a/src/backend/NetAdmin.SysComponent.Application/Services/Sys/UserProfileService.cs +++ b/src/backend/NetAdmin.SysComponent.Application/Services/Sys/UserProfileService.cs @@ -56,7 +56,7 @@ public sealed class UserProfileService(BasicRepository rp /// public Task EditAsync(EditUserProfileReq req) { - return UpdateAsync(req, null); + return UpdateAsync(req.Adapt(), null); } /// @@ -80,6 +80,13 @@ public sealed class UserProfileService(BasicRepository rp return ret.Adapt(); } + /// + public async Task GetSessionUserAppConfigAsync() + { + var ret = await Rpo.Select.Where(a => a.Id == UserToken.Id).ToOneAsync().ConfigureAwait(false); + return ret.Adapt(); + } + /// public async Task> PagedQueryAsync(PagedQueryReq req) { @@ -147,6 +154,13 @@ public sealed class UserProfileService(BasicRepository rp }); } + /// + public Task SetSessionUserAppConfigAsync(SetSessionUserAppConfigReq req) + { + req.ThrowIfInvalid(); + return UpdateAsync(req, [nameof(req.AppConfig)], null, a => a.Id == UserToken.Id, null, true); + } + private ISelect QueryInternal( QueryReq req) { diff --git a/src/backend/NetAdmin.SysComponent.Application/Services/Sys/UserService.cs b/src/backend/NetAdmin.SysComponent.Application/Services/Sys/UserService.cs index 5e2d3687..34142a48 100644 --- a/src/backend/NetAdmin.SysComponent.Application/Services/Sys/UserService.cs +++ b/src/backend/NetAdmin.SysComponent.Application/Services/Sys/UserService.cs @@ -163,6 +163,12 @@ public sealed class UserService( return ret.Adapt(); } + /// + public Task GetSessionUserAppConfigAsync() + { + return userProfileService.GetSessionUserAppConfigAsync(); + } + /// /// 用户名或密码错误 public async Task LoginByPwdAsync(LoginByPwdReq req) @@ -259,7 +265,7 @@ public sealed class UserService( /// /// 验证码不正确 /// 用户不存在 - public async Task ResetPasswordAsync(ResetPasswordReq req) + public async Task ResetPasswordAsync(ResetPasswordReq req) { req.ThrowIfInvalid(); if (await verifyCodeService.VerifyAsync(req.VerifySmsCodeReq).ConfigureAwait(false)) { @@ -269,7 +275,7 @@ public sealed class UserService( Password = req.PasswordText.Pwd() .Guid() }; - return (uint)await UpdateAsync(dto, [nameof(Sys_User.Password)]).ConfigureAwait(false); + return await UpdateAsync(dto, [nameof(Sys_User.Password)]).ConfigureAwait(false); } throw new NetAdminInvalidOperationException(Ln.验证码不正确); @@ -335,7 +341,7 @@ public sealed class UserService( } /// - public Task SetEnabledAsync(SetUserEnabledReq req) + public Task SetEnabledAsync(SetUserEnabledReq req) { req.ThrowIfInvalid(); return UpdateAsync(req, [nameof(req.Enabled)]); @@ -386,18 +392,23 @@ public sealed class UserService( } /// - public async Task SetPasswordAsync(SetPasswordReq req) + public async Task SetPasswordAsync(SetPasswordReq req) { req.ThrowIfInvalid(); var version = await Rpo.Where(a => a.Id == UserToken.Id && a.Password == req.OldPassword.Pwd().Guid()) .ToOneAsync(a => new long?(a.Version)) .ConfigureAwait(false) ?? throw new NetAdminInvalidOperationException($"{Ln.旧密码不正确}"); - var ret = await UpdateAsync( + return await UpdateAsync( new Sys_User { Id = UserToken.Id, Password = req.NewPassword.Pwd().Guid(), Version = version } , [nameof(Sys_User.Password)]) .ConfigureAwait(false); - return (uint)ret; + } + + /// + public Task SetSessionUserAppConfigAsync(SetSessionUserAppConfigReq req) + { + return userProfileService.SetSessionUserAppConfigAsync(req); } /// @@ -495,9 +506,9 @@ public sealed class UserService( req.Filter?.RoleId > 0, a => a.Roles.Any(b => b.Id == req.Filter.RoleId)) .WhereIf( // req.Keywords?.Length > 0 - , a => a.Id == req.Keywords.Int64Try(0) || a.UserName.Contains(req.Keywords) || - a.Mobile.Contains(req.Keywords) || a.Email.Contains(req.Keywords) || - a.Summary.Contains(req.Keywords)); + , a => a.Id == req.Keywords.Int64Try(0) || a.UserName == req.Keywords || + a.Mobile == req.Keywords || + a.Email == req.Keywords || a.Summary.Contains(req.Keywords)); switch (req.Order) { case Orders.None: return ret; diff --git a/src/backend/NetAdmin.SysComponent.Cache/Sys/ConfigCache.cs b/src/backend/NetAdmin.SysComponent.Cache/Sys/ConfigCache.cs index f104e061..7d581a75 100644 --- a/src/backend/NetAdmin.SysComponent.Cache/Sys/ConfigCache.cs +++ b/src/backend/NetAdmin.SysComponent.Cache/Sys/ConfigCache.cs @@ -69,4 +69,10 @@ public sealed class ConfigCache(IDistributedCache cache, IConfigService service) { return Service.QueryAsync(req); } + + /// + public Task SetEnabledAsync(SetConfigEnabledReq req) + { + return Service.SetEnabledAsync(req); + } } \ No newline at end of file diff --git a/src/backend/NetAdmin.SysComponent.Cache/Sys/DeptCache.cs b/src/backend/NetAdmin.SysComponent.Cache/Sys/DeptCache.cs index dbb2a453..40db9967 100644 --- a/src/backend/NetAdmin.SysComponent.Cache/Sys/DeptCache.cs +++ b/src/backend/NetAdmin.SysComponent.Cache/Sys/DeptCache.cs @@ -65,7 +65,7 @@ public sealed class DeptCache(IDistributedCache cache, IDeptService service) // } /// - public Task SetEnabledAsync(SetDeptEnabledReq req) + public Task SetEnabledAsync(SetDeptEnabledReq req) { return Service.SetEnabledAsync(req); } diff --git a/src/backend/NetAdmin.SysComponent.Cache/Sys/JobCache.cs b/src/backend/NetAdmin.SysComponent.Cache/Sys/JobCache.cs index 5a461182..f4282727 100644 --- a/src/backend/NetAdmin.SysComponent.Cache/Sys/JobCache.cs +++ b/src/backend/NetAdmin.SysComponent.Cache/Sys/JobCache.cs @@ -123,7 +123,7 @@ public sealed class JobCache(IDistributedCache cache, IJobService service) } /// - public Task SetEnabledAsync(SetJobEnabledReq req) + public Task SetEnabledAsync(SetJobEnabledReq req) { return Service.SetEnabledAsync(req); } diff --git a/src/backend/NetAdmin.SysComponent.Cache/Sys/RoleCache.cs b/src/backend/NetAdmin.SysComponent.Cache/Sys/RoleCache.cs index 3279dd85..afdeb275 100644 --- a/src/backend/NetAdmin.SysComponent.Cache/Sys/RoleCache.cs +++ b/src/backend/NetAdmin.SysComponent.Cache/Sys/RoleCache.cs @@ -65,8 +65,20 @@ public sealed class RoleCache(IDistributedCache cache, IRoleService service) // } /// - public Task SetEnabledAsync(SetRoleEnabledReq req) + public Task SetDisplayDashboardAsync(SetDisplayDashboardReq req) + { + return Service.SetDisplayDashboardAsync(req); + } + + /// + public Task SetEnabledAsync(SetRoleEnabledReq req) { return Service.SetEnabledAsync(req); } + + /// + public Task SetIgnorePermissionControlAsync(SetIgnorePermissionControlReq req) + { + return Service.SetIgnorePermissionControlAsync(req); + } } \ No newline at end of file diff --git a/src/backend/NetAdmin.SysComponent.Cache/Sys/UserCache.cs b/src/backend/NetAdmin.SysComponent.Cache/Sys/UserCache.cs index 1d91b6af..d2497c15 100644 --- a/src/backend/NetAdmin.SysComponent.Cache/Sys/UserCache.cs +++ b/src/backend/NetAdmin.SysComponent.Cache/Sys/UserCache.cs @@ -65,6 +65,12 @@ public sealed class UserCache(IDistributedCache cache, IUserService service, IVe return Service.GetAsync(req); } + /// + public Task GetSessionUserAppConfigAsync() + { + return Service.GetSessionUserAppConfigAsync(); + } + /// public Task LoginByPwdAsync(LoginByPwdReq req) { @@ -157,7 +163,7 @@ public sealed class UserCache(IDistributedCache cache, IUserService service, IVe } /// - public Task ResetPasswordAsync(ResetPasswordReq req) + public Task ResetPasswordAsync(ResetPasswordReq req) { return Service.ResetPasswordAsync(req); } @@ -177,7 +183,7 @@ public sealed class UserCache(IDistributedCache cache, IUserService service, IVe } /// - public Task SetEnabledAsync(SetUserEnabledReq req) + public Task SetEnabledAsync(SetUserEnabledReq req) { return Service.SetEnabledAsync(req); } @@ -189,11 +195,17 @@ public sealed class UserCache(IDistributedCache cache, IUserService service, IVe } /// - public Task SetPasswordAsync(SetPasswordReq req) + public Task SetPasswordAsync(SetPasswordReq req) { return Service.SetPasswordAsync(req); } + /// + public Task SetSessionUserAppConfigAsync(SetSessionUserAppConfigReq req) + { + return Service.SetSessionUserAppConfigAsync(req); + } + /// public Task UserInfoAsync() { diff --git a/src/backend/NetAdmin.SysComponent.Host/Controllers/Sys/ConfigController.cs b/src/backend/NetAdmin.SysComponent.Host/Controllers/Sys/ConfigController.cs index ac1adea7..9d23b847 100644 --- a/src/backend/NetAdmin.SysComponent.Host/Controllers/Sys/ConfigController.cs +++ b/src/backend/NetAdmin.SysComponent.Host/Controllers/Sys/ConfigController.cs @@ -99,4 +99,12 @@ public sealed class ConfigController(IConfigCache cache) : ControllerBase + /// 设置配置启用状态 + /// + public Task SetEnabledAsync(SetConfigEnabledReq req) + { + return Cache.SetEnabledAsync(req); + } } \ No newline at end of file diff --git a/src/backend/NetAdmin.SysComponent.Host/Controllers/Sys/DeptController.cs b/src/backend/NetAdmin.SysComponent.Host/Controllers/Sys/DeptController.cs index b658cc13..2bbee450 100644 --- a/src/backend/NetAdmin.SysComponent.Host/Controllers/Sys/DeptController.cs +++ b/src/backend/NetAdmin.SysComponent.Host/Controllers/Sys/DeptController.cs @@ -95,7 +95,7 @@ public sealed class DeptController(IDeptCache cache) : ControllerBase /// 启用/禁用部门 /// - public Task SetEnabledAsync(SetDeptEnabledReq req) + public Task SetEnabledAsync(SetDeptEnabledReq req) { return Cache.SetEnabledAsync(req); } diff --git a/src/backend/NetAdmin.SysComponent.Host/Controllers/Sys/JobController.cs b/src/backend/NetAdmin.SysComponent.Host/Controllers/Sys/JobController.cs index ca961ae7..b9efaa8f 100644 --- a/src/backend/NetAdmin.SysComponent.Host/Controllers/Sys/JobController.cs +++ b/src/backend/NetAdmin.SysComponent.Host/Controllers/Sys/JobController.cs @@ -144,7 +144,7 @@ public sealed class JobController(IJobCache cache) : ControllerBase /// 启用/禁用作业 /// - public Task SetEnabledAsync(SetJobEnabledReq req) + public Task SetEnabledAsync(SetJobEnabledReq req) { return Cache.SetEnabledAsync(req); } diff --git a/src/backend/NetAdmin.SysComponent.Host/Controllers/Sys/RoleController.cs b/src/backend/NetAdmin.SysComponent.Host/Controllers/Sys/RoleController.cs index bd9ce0d0..86d74533 100644 --- a/src/backend/NetAdmin.SysComponent.Host/Controllers/Sys/RoleController.cs +++ b/src/backend/NetAdmin.SysComponent.Host/Controllers/Sys/RoleController.cs @@ -91,11 +91,27 @@ public sealed class RoleController(IRoleCache cache) : ControllerBase + /// 设置是否显示仪表板 + /// + public Task SetDisplayDashboardAsync(SetDisplayDashboardReq req) + { + return Cache.SetDisplayDashboardAsync(req); + } + /// /// 启用/禁用角色 /// - public Task SetEnabledAsync(SetRoleEnabledReq req) + public Task SetEnabledAsync(SetRoleEnabledReq req) { return Cache.SetEnabledAsync(req); } + + /// + /// 设置是否忽略权限控制 + /// + public Task SetIgnorePermissionControlAsync(SetIgnorePermissionControlReq req) + { + return Cache.SetIgnorePermissionControlAsync(req); + } } \ No newline at end of file diff --git a/src/backend/NetAdmin.SysComponent.Host/Controllers/Sys/UserController.cs b/src/backend/NetAdmin.SysComponent.Host/Controllers/Sys/UserController.cs index 00021d61..a5ac207b 100644 --- a/src/backend/NetAdmin.SysComponent.Host/Controllers/Sys/UserController.cs +++ b/src/backend/NetAdmin.SysComponent.Host/Controllers/Sys/UserController.cs @@ -96,6 +96,14 @@ public sealed class UserController(IUserCache cache, IConfigCache configCache) return Cache.GetAsync(req); } + /// + /// 获取当前用户应用配置 + /// + public Task GetSessionUserAppConfigAsync() + { + return Cache.GetSessionUserAppConfigAsync(); + } + /// /// 密码登录 /// @@ -168,7 +176,7 @@ public sealed class UserController(IUserCache cache, IConfigCache configCache) /// [AllowAnonymous] [Transaction] - public Task ResetPasswordAsync(ResetPasswordReq req) + public Task ResetPasswordAsync(ResetPasswordReq req) { return Cache.ResetPasswordAsync(req); } @@ -195,7 +203,7 @@ public sealed class UserController(IUserCache cache, IConfigCache configCache) /// 启用/禁用用户 /// [Transaction] - public Task SetEnabledAsync(SetUserEnabledReq req) + public Task SetEnabledAsync(SetUserEnabledReq req) { return Cache.SetEnabledAsync(req); } @@ -213,11 +221,19 @@ public sealed class UserController(IUserCache cache, IConfigCache configCache) /// 设置密码 /// [Transaction] - public Task SetPasswordAsync(SetPasswordReq req) + public Task SetPasswordAsync(SetPasswordReq req) { return Cache.SetPasswordAsync(req); } + /// + /// 设置当前用户应用配置 + /// + public Task SetSessionUserAppConfigAsync(SetSessionUserAppConfigReq req) + { + return Cache.SetSessionUserAppConfigAsync(req); + } + /// /// 当前用户信息 /// diff --git a/src/frontend/admin/index.html b/src/frontend/admin/index.html index 02b1ff22..6c752ea6 100644 --- a/src/frontend/admin/index.html +++ b/src/frontend/admin/index.html @@ -68,7 +68,7 @@ } .app-loading__title { - font-family: 'Arial', 'Microsoft YaHei', 'monospace'; + font-family: 'Microsoft YaHei', sans-serif; font-size: 24px; color: #333; margin-top: 30px; @@ -125,7 +125,7 @@ diff --git a/src/frontend/admin/src/api/sys/config.js b/src/frontend/admin/src/api/sys/config.js index 2f5c6115..b112fbc3 100644 --- a/src/frontend/admin/src/api/sys/config.js +++ b/src/frontend/admin/src/api/sys/config.js @@ -103,4 +103,15 @@ export default { return await http.post(this.url, data, config) }, }, + + /** + * 设置配置启用状态 + */ + setEnabled: { + url: `${config.API_URL}/api/sys/config/set.enabled`, + name: `设置配置启用状态`, + post: async function (data = {}, config = {}) { + return await http.post(this.url, data, config) + }, + }, } \ No newline at end of file diff --git a/src/frontend/admin/src/api/sys/role.js b/src/frontend/admin/src/api/sys/role.js index b49b2f9b..a68db880 100644 --- a/src/frontend/admin/src/api/sys/role.js +++ b/src/frontend/admin/src/api/sys/role.js @@ -93,6 +93,17 @@ export default { }, }, + /** + * 设置是否显示仪表板 + */ + setDisplayDashboard: { + url: `${config.API_URL}/api/sys/role/set.display.dashboard`, + name: `设置是否显示仪表板`, + post: async function (data = {}, config = {}) { + return await http.post(this.url, data, config) + }, + }, + /** * 启用/禁用角色 */ @@ -103,4 +114,15 @@ export default { return await http.post(this.url, data, config) }, }, + + /** + * 设置是否忽略权限控制 + */ + setIgnorePermissionControl: { + url: `${config.API_URL}/api/sys/role/set.ignore.permission.control`, + name: `设置是否忽略权限控制`, + post: async function (data = {}, config = {}) { + return await http.post(this.url, data, config) + }, + }, } \ No newline at end of file diff --git a/src/frontend/admin/src/api/sys/user.js b/src/frontend/admin/src/api/sys/user.js index d26c3c47..113f051e 100644 --- a/src/frontend/admin/src/api/sys/user.js +++ b/src/frontend/admin/src/api/sys/user.js @@ -82,6 +82,17 @@ export default { }, }, + /** + * 获取当前用户应用配置 + */ + getSessionUserAppConfig: { + url: `${config.API_URL}/api/sys/user/get.session.user.app.config`, + name: `获取当前用户应用配置`, + post: async function (data = {}, config = {}) { + return await http.post(this.url, data, config) + }, + }, + /** * 密码登录 */ @@ -214,6 +225,17 @@ export default { }, }, + /** + * 设置当前用户应用配置 + */ + setSessionUserAppConfig: { + url: `${config.API_URL}/api/sys/user/set.session.user.app.config`, + name: `设置当前用户应用配置`, + post: async function (data = {}, config = {}) { + return await http.post(this.url, data, config) + }, + }, + /** * 当前用户信息 */ diff --git a/src/frontend/admin/src/components/naButtonAdd/index.vue b/src/frontend/admin/src/components/naButtonAdd/index.vue deleted file mode 100644 index aac69f4f..00000000 --- a/src/frontend/admin/src/components/naButtonAdd/index.vue +++ /dev/null @@ -1,25 +0,0 @@ - - - \ No newline at end of file diff --git a/src/frontend/admin/src/components/naColAvatar/index.vue b/src/frontend/admin/src/components/naColAvatar/index.vue index d52a1682..9ae6beb6 100644 --- a/src/frontend/admin/src/components/naColAvatar/index.vue +++ b/src/frontend/admin/src/components/naColAvatar/index.vue @@ -1,9 +1,9 @@ @@ -36,58 +36,62 @@ diff --git a/src/frontend/admin/src/views/sys/dic/save.vue b/src/frontend/admin/src/views/sys/dic/save.vue index 030eeb0c..530d466e 100644 --- a/src/frontend/admin/src/views/sys/dic/save.vue +++ b/src/frontend/admin/src/views/sys/dic/save.vue @@ -13,39 +13,41 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/frontend/admin/src/views/sys/job/all/index.vue b/src/frontend/admin/src/views/sys/job/all/index.vue new file mode 100644 index 00000000..262c476c --- /dev/null +++ b/src/frontend/admin/src/views/sys/job/all/index.vue @@ -0,0 +1,352 @@ + + + + + \ No newline at end of file diff --git a/src/frontend/admin/src/views/sys/job/save.vue b/src/frontend/admin/src/views/sys/job/all/save.vue similarity index 86% rename from src/frontend/admin/src/views/sys/job/save.vue rename to src/frontend/admin/src/views/sys/job/all/save.vue index aabc192c..fc01234a 100644 --- a/src/frontend/admin/src/views/sys/job/save.vue +++ b/src/frontend/admin/src/views/sys/job/all/save.vue @@ -1,13 +1,7 @@ \ No newline at end of file + + + \ No newline at end of file diff --git a/src/frontend/admin/src/views/sys/job/index.vue b/src/frontend/admin/src/views/sys/job/index.vue index 197e9bc5..d04d4ab8 100644 --- a/src/frontend/admin/src/views/sys/job/index.vue +++ b/src/frontend/admin/src/views/sys/job/index.vue @@ -1,326 +1,35 @@ - \ No newline at end of file diff --git a/src/frontend/admin/src/views/sys/job/record/index.vue b/src/frontend/admin/src/views/sys/job/record/index.vue index 986a5aa5..b3f4d52f 100644 --- a/src/frontend/admin/src/views/sys/job/record/index.vue +++ b/src/frontend/admin/src/views/sys/job/record/index.vue @@ -17,7 +17,7 @@ return { value: x[0], label: x[1][1] } }), placeholder: $t('请求方式'), - style: 'width:10rem', + style: 'width:15rem', }, { multiple: true, @@ -45,9 +45,8 @@ - + + + + - - - diff --git a/src/frontend/admin/src/views/sys/job/record/save.vue b/src/frontend/admin/src/views/sys/job/record/save.vue index f5b6d895..d191c7fb 100644 --- a/src/frontend/admin/src/views/sys/job/record/save.vue +++ b/src/frontend/admin/src/views/sys/job/record/save.vue @@ -1,11 +1,5 @@