From e6f95d0cd8ecf2192aec9b1f3d8124b72f4d5a9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com> Date: Sun, 19 Feb 2023 16:49:11 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E5=96=84=E5=90=84=E4=B8=AA?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Json/DateTimeJsonConverter.cs | 29 ++ .../project/BBS/Yi.BBS.Web/YiBBSWebModule.cs | 5 +- .../Yi.Template.Web/YiTemplateWebModule.cs | 5 +- .../project/bbs/Yi.BBS.Web/YiBBSWebModule.cs | 5 +- .../Dtos/Dept/DeptGetListOutputDto.cs | 2 + .../Identity/Dtos/Dept/DeptGetOutputDto.cs | 4 + .../Dtos/Menu/MenuGetListOutputDto.cs | 2 + .../Identity/Dtos/Menu/MenuGetOutputDto.cs | 3 + .../Dtos/Post/PostGetListOutputDto.cs | 2 + .../Identity/Dtos/Post/PostGetOutputDto.cs | 2 + .../Identity/Dtos/User/UserGetListInputVo.cs | 4 +- .../Dtos/User/UserGetListOutputDto.cs | 5 +- .../ApplicationSwaggerDoc.xml | 8 + .../Identity/RoleService.cs | 23 ++ .../Identity/UserService.cs | 18 +- .../rbac/Yi.RBAC.Domain/DomainSwaggerDoc.xml | 18 + .../rbac/Yi.RBAC.Web/YiRBACWebModule.cs | 8 +- .../rbac/Yi.RBAC.Web/yi-sqlsugar-dev.db | Bin 110592 -> 110592 bytes .../Yi.Template.Web/YiTemplateWebModule.cs | 5 +- Yi.RuoYi.Vue3/src/api/system/dept.js | 2 +- Yi.RuoYi.Vue3/src/api/system/menu.js | 2 +- Yi.RuoYi.Vue3/src/api/system/post.js | 2 +- Yi.RuoYi.Vue3/src/api/system/role.js | 2 +- Yi.RuoYi.Vue3/src/views/system/dept/index.vue | 36 +- Yi.RuoYi.Vue3/src/views/system/menu/index.vue | 20 +- Yi.RuoYi.Vue3/src/views/system/post/index.vue | 22 +- Yi.RuoYi.Vue3/src/views/system/role/index.vue | 352 ++++-------------- Yi.RuoYi.Vue3/src/views/system/user/index.vue | 8 +- 28 files changed, 260 insertions(+), 334 deletions(-) create mode 100644 Yi.Framework.Net6/src/framework/Yi.Framework.Data/Json/DateTimeJsonConverter.cs diff --git a/Yi.Framework.Net6/src/framework/Yi.Framework.Data/Json/DateTimeJsonConverter.cs b/Yi.Framework.Net6/src/framework/Yi.Framework.Data/Json/DateTimeJsonConverter.cs new file mode 100644 index 00000000..9935896a --- /dev/null +++ b/Yi.Framework.Net6/src/framework/Yi.Framework.Data/Json/DateTimeJsonConverter.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Threading.Tasks; + +namespace Yi.Framework.Data.Json +{ + public class DateTimeJsonConverter : JsonConverter + { + private readonly string Format; + public DateTimeJsonConverter(string format) + { + Format = format; + } + public override void Write(Utf8JsonWriter writer, DateTime date, JsonSerializerOptions options) + { + writer.WriteStringValue(date.ToString(Format)); + } + public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return DateTime.ParseExact(reader.GetString(), Format, null); + } + } + + +} diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/YiBBSWebModule.cs b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/YiBBSWebModule.cs index d317c9e8..c8bb9f99 100644 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/YiBBSWebModule.cs +++ b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/YiBBSWebModule.cs @@ -9,6 +9,7 @@ using Yi.Framework.AspNetCore.Microsoft.Extensions.DependencyInjection; using Yi.Framework.Core.Autofac; using Yi.RBAC.Application; using Yi.Framework.AspNetCore; +using Yi.Framework.Data.Json; namespace Yi.BBS.Web { @@ -23,7 +24,9 @@ namespace Yi.BBS.Web public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context) { //添加控制器与动态api - services.AddControllers(); + services.AddControllers().AddJsonOptions(opt => { + opt.JsonSerializerOptions.Converters.Add(new DateTimeJsonConverter("yyyy-MM-dd HH:mm:ss")); + }); services.AddAutoApiService(opt => { //NETServiceTest所在程序集添加进动态api配置 diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/YiTemplateWebModule.cs b/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/YiTemplateWebModule.cs index 5ba64864..1fce11c9 100644 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/YiTemplateWebModule.cs +++ b/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/YiTemplateWebModule.cs @@ -5,6 +5,7 @@ using Yi.Framework.Auth.JwtBearer; using Yi.Framework.Core; using Yi.Framework.Core.Attributes; using Yi.Framework.Core.Autofac; +using Yi.Framework.Data.Json; using Yi.Template.Application; using Yi.Template.Sqlsugar; @@ -21,7 +22,9 @@ namespace Yi.Template.Web public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context) { //添加控制器与动态api - services.AddControllers(); + services.AddControllers().AddJsonOptions(opt => { + opt.JsonSerializerOptions.Converters.Add(new DateTimeJsonConverter("yyyy-MM-dd HH:mm:ss")); + }); services.AddAutoApiService(opt => { //NETServiceTest所在程序集添加进动态api配置 diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/YiBBSWebModule.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/YiBBSWebModule.cs index d317c9e8..c8bb9f99 100644 --- a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/YiBBSWebModule.cs +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/YiBBSWebModule.cs @@ -9,6 +9,7 @@ using Yi.Framework.AspNetCore.Microsoft.Extensions.DependencyInjection; using Yi.Framework.Core.Autofac; using Yi.RBAC.Application; using Yi.Framework.AspNetCore; +using Yi.Framework.Data.Json; namespace Yi.BBS.Web { @@ -23,7 +24,9 @@ namespace Yi.BBS.Web public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context) { //添加控制器与动态api - services.AddControllers(); + services.AddControllers().AddJsonOptions(opt => { + opt.JsonSerializerOptions.Converters.Add(new DateTimeJsonConverter("yyyy-MM-dd HH:mm:ss")); + }); services.AddAutoApiService(opt => { //NETServiceTest所在程序集添加进动态api配置 diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Dept/DeptGetListOutputDto.cs b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Dept/DeptGetListOutputDto.cs index 4c94260e..ab227da0 100644 --- a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Dept/DeptGetListOutputDto.cs +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Dept/DeptGetListOutputDto.cs @@ -18,5 +18,7 @@ namespace Yi.RBAC.Application.Contracts.Identity.Dtos public string? Leader { get; set; } public long ParentId { get; set; } public string? Remark { get; set; } + + public int OrderNum { get; set; } } } diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Dept/DeptGetOutputDto.cs b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Dept/DeptGetOutputDto.cs index 78ce84d1..12fcd95f 100644 --- a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Dept/DeptGetOutputDto.cs +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Dept/DeptGetOutputDto.cs @@ -17,5 +17,9 @@ namespace Yi.RBAC.Application.Contracts.Identity.Dtos public string? Remark { get; set; } public long? deptId { get; set; } + + public int OrderNum { get; set; } + + public long ParentId { get; set; } } } diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Menu/MenuGetListOutputDto.cs b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Menu/MenuGetListOutputDto.cs index 01321cc6..5a4eec02 100644 --- a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Menu/MenuGetListOutputDto.cs +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Menu/MenuGetListOutputDto.cs @@ -26,6 +26,8 @@ namespace Yi.RBAC.Application.Contracts.Identity.Dtos public string? Remark { get; set; } public string? Component { get; set; } public string? Query { get; set; } + + public int OrderNum { get; set; } //public List? Children { get; set; } } } diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Menu/MenuGetOutputDto.cs b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Menu/MenuGetOutputDto.cs index 28629ac6..cbfc8a2c 100644 --- a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Menu/MenuGetOutputDto.cs +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Menu/MenuGetOutputDto.cs @@ -26,6 +26,9 @@ namespace Yi.RBAC.Application.Contracts.Identity.Dtos public string? Remark { get; set; } public string? Component { get; set; } public string? Query { get; set; } + + public int OrderNum { get; set; } + //public List? Children { get; set; } } } diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Post/PostGetListOutputDto.cs b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Post/PostGetListOutputDto.cs index 34088d31..86402f91 100644 --- a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Post/PostGetListOutputDto.cs +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Post/PostGetListOutputDto.cs @@ -15,5 +15,7 @@ namespace Yi.RBAC.Application.Contracts.Identity.Dtos public string PostCode { get; set; }=string.Empty; public string PostName { get; set; } = string.Empty; public string? Remark { get; set; } + + public int OrderNum { get; set; } } } diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Post/PostGetOutputDto.cs b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Post/PostGetOutputDto.cs index af7e5c1f..0392c796 100644 --- a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Post/PostGetOutputDto.cs +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/Post/PostGetOutputDto.cs @@ -16,5 +16,7 @@ namespace Yi.RBAC.Application.Contracts.Identity.Dtos public string PostCode { get; set; }=string.Empty; public string PostName { get; set; } = string.Empty; public string? Remark { get; set; } + + public int OrderNum { get; set; } } } diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/User/UserGetListInputVo.cs b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/User/UserGetListInputVo.cs index 64ea4966..159f9358 100644 --- a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/User/UserGetListInputVo.cs +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/User/UserGetListInputVo.cs @@ -14,7 +14,9 @@ namespace Yi.RBAC.Application.Contracts.Identity.Dtos public string? UserName { get; set; } public long? Phone { get; set; } - public bool IsDeleted { get; set; } + public bool? State { get; set; } + + public long? DeptId { get; set; } } } diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/User/UserGetListOutputDto.cs b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/User/UserGetListOutputDto.cs index 7819173d..b9f4ac6d 100644 --- a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/User/UserGetListOutputDto.cs +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application.Contracts/Identity/Dtos/User/UserGetListOutputDto.cs @@ -14,8 +14,6 @@ namespace Yi.RBAC.Application.Contracts.Identity.Dtos public string? Name { get; set; } public int? Age { get; set; } public string UserName { get; set; } = string.Empty; - public string Password { get; set; } = string.Empty; - public string Salt { get; set; } = string.Empty; public string? Icon { get; set; } public string? Nick { get; set; } public string? Email { get; set; } @@ -30,5 +28,8 @@ namespace Yi.RBAC.Application.Contracts.Identity.Dtos public long? CreatorId { get; set; } public bool State { get; set; } + + + public string DeptName { get; set; } } } diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application/ApplicationSwaggerDoc.xml b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application/ApplicationSwaggerDoc.xml index 67079074..8328023d 100644 --- a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application/ApplicationSwaggerDoc.xml +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application/ApplicationSwaggerDoc.xml @@ -120,6 +120,14 @@ + + + 修改角色 + + + + + User服务实现 diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application/Identity/RoleService.cs b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application/Identity/RoleService.cs index 1add1a2d..5c453ef7 100644 --- a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application/Identity/RoleService.cs +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application/Identity/RoleService.cs @@ -41,5 +41,28 @@ namespace Yi.RBAC.Application.Identity return outputDto; } + + /// + /// 修改角色 + /// + /// + /// + /// + public override async Task UpdateAsync(long id, RoleUpdateInputVo input) + { + var dto = new RoleGetOutputDto(); + using (var uow = _unitOfWorkManager.CreateContext()) + { + var entity = await _repository.GetByIdAsync(id); + await MapToEntityAsync(input, entity); + await _repository.UpdateAsync(entity); + + await _roleManager.GiveRoleSetMenuAsync(new List { id }, input.MenuIds); + + dto = await MapToGetOutputDtoAsync(entity); + uow.Commit(); + } + return dto; + } } } diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application/Identity/UserService.cs b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application/Identity/UserService.cs index 729cbb54..252a5686 100644 --- a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application/Identity/UserService.cs +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Application/Identity/UserService.cs @@ -40,13 +40,21 @@ namespace Yi.RBAC.Application.Identity RefAsync total = 0; - var entities = await _DbQueryable.WhereIF(!string.IsNullOrEmpty(input.UserName), x => x.UserName.Contains(input.UserName!)). - WhereIF(input.Phone is not null, x => x.Phone.ToString()!.Contains(input.Phone.ToString()!)). - WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name!.Contains(input.Name!)). - WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime).ToPageListAsync(input.PageNum, input.PageSize, total); + var outPut = await _DbQueryable.WhereIF(!string.IsNullOrEmpty(input.UserName), x => x.UserName.Contains(input.UserName!)) + .WhereIF(input.Phone is not null, x => x.Phone.ToString()!.Contains(input.Phone.ToString()!)) + .WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name!.Contains(input.Name!)) + .WhereIF(input.State is not null, x => x.State == input.State) + .WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime) + + //这个为过滤当前部门,加入数据权限后,将由数据权限控制 + .WhereIF(input.DeptId is not null, x => x.DeptId == input.DeptId) + + .LeftJoin((user, dept) => user.DeptId == dept.Id) + .Select((user, dept) => new UserGetListOutputDto(), true) + .ToPageListAsync(input.PageNum, input.PageSize, total); var result = new PagedResultDto(); - result.Items = await MapToGetListOutputDtosAsync(entities); + result.Items = outPut; result.Total = total; return result; } diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/DomainSwaggerDoc.xml b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/DomainSwaggerDoc.xml index 99550148..ddd32ed0 100644 --- a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/DomainSwaggerDoc.xml +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Domain/DomainSwaggerDoc.xml @@ -123,6 +123,24 @@ + + + 更新密码 + + + + + + + + + + 重置密码 + + + + + 部门表 diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Web/YiRBACWebModule.cs b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Web/YiRBACWebModule.cs index 435c95a1..de6f4604 100644 --- a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Web/YiRBACWebModule.cs +++ b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Web/YiRBACWebModule.cs @@ -1,10 +1,12 @@ using AspNetCore.Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.Options; using StartupModules; using Yi.Framework.AspNetCore; using Yi.Framework.Auth.JwtBearer; using Yi.Framework.Core; using Yi.Framework.Core.Attributes; using Yi.Framework.Core.Autofac; +using Yi.Framework.Data.Json; using Yi.RBAC.Application; using Yi.RBAC.Sqlsugar; @@ -21,7 +23,11 @@ namespace Yi.RBAC.Web public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context) { //添加控制器与动态api - services.AddControllers(); + services.AddControllers().AddJsonOptions(opt => { + + opt.JsonSerializerOptions.Converters.Add(new DateTimeJsonConverter("yyyy-MM-dd HH:mm:ss")); + + }); services.AddAutoApiService(opt => { //NETServiceTest所在程序集添加进动态api配置 diff --git a/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Web/yi-sqlsugar-dev.db b/Yi.Framework.Net6/src/project/rbac/Yi.RBAC.Web/yi-sqlsugar-dev.db index 0e56644380bf4ab67007ed99561d402fbeeb88f7..7bc3ed7d2d2ee4cff2e8033ef2a9fcba7ada3d38 100644 GIT binary patch delta 4357 zcmZA4d2Afz8OQON-JSdN+FoCe?e%@1>)T!*yS{ISB;;^Pph2QlOAzo!1QFvHwSo`< z!Gs_{kSJ}1kcE=2gq;9AXoV_NRrw=IDg+WjNlIJPN>RkoNNqQ3Z~V*i-+cY?qj^2@ zzVq(V7xK~<@{0xH!f}d=3+MK~?aT|WJMTKp_Ep=n+pKkKuO*njFh`AB#vvm|U)OhO z-)N6%S?Zd)Tlrr3xl%7*lAn~r(rGCk_*>v;pw7SQANO7NJ?$$JKM==-e;z*_UpZSm z@7r5_^8Q02CCjop!! zmexqef$MAMuDy}CzV!aJpRHbdVLf#8mr6&>6=M3z#eLa{efvybAbFdy#82;gXdvW# zEcB|q$riQD5+QVS{q=V~a)p&sZ-t!p13!H5;8(}bT)ptz-%tFuHQ~N>bKYB&x&-G- z=a0^>oM)ULJJU|1@Mtk0%W~-D&-F)_-MQO;^0}BRhK^kPx_8;FpuM28 zOv`Bx=nT^`+6_9*w3K$G)Z4i66yp-Q7ltR9hG{401k+;L0XojKh_-`{d5jC`9^g@? zMB6||m=@3i=rGfKng@+q3&_1R?8VBuVnn7bp_0s=(J&au%h2d_d4vm0zF|}zJw3Det@h$b-4#ph=gg$*kd1#M<3Qy*v(Q;B*(8&SRFr#wJC zzzxVr^;0)!JyRcbfz~kj4%0p=0}V0lrBcvr zrae@$p!nvM+&OX?!0A<| z)gT=-z38+`q=BXvomM}opqq=Xa?>o50-RoTT34q2ciz8f>{wBjPUjj|jVs0{#)rmP z`0y{Pv|Fq*Ca}t$GW*i(=Usgk9c-3#LOOu>D>@hyC5d-g_zh0 zF}?$0Y&*p0J*MBgbJvk=K*I|V@p*{Y9K_Hp#NZ6Xz%)ev6hw3qqR*Rv>K%vZ8H4B^ zh3FcA=p2UVh(ol;Alil?B7=9rTXtIq?$ol|(ht!bg=p%7XzYb(=z*y3hN$a;sO^NP z>DY*kZMC``sHzR3G6GT23Q^tyQPvDm+5}P32oY|8D6UUN@>sp`#iFPVsIV4-Y9I=# zA@Zvr@+u*6DpAwp#k*`*#-RtZFA7$R5NU7D6}#VHZGH`4DE_R(P(FyH&29 z1EGZ=)NBYP3qsC>kb)3_3<$pq;d3_Q{@dRsMH@)4HX^m_NhU4Yu(_oI`~7mIltmusuZOE;MMu`5cckyNZ*X%a7{e*gQ}+UkH<>E0elUSF9L HYxe&ia@6-! delta 252 zcmZp8z}E19ZGtqT+e8^>Mz@U#EBM*?H}J>tJ=n}w@RpyovbZEQcas8}0GBcYzcJro z-gmspn*$Yud4(E1SR~mv7#O4*Eo~XZ8GvB2zHQIugSHMr+&~T&uNwoIpuF{Ff%#to1lag}82BIYAK_od z-@%{7@3UFZ!GeFX&;K2pSsrZX-@col@f<&Ek78O;)AT-hMo9>B`x+oqKnN@>z{twO h%*H4N=4`*N&v*f%o@x6Udqy<@um+~>*Zmna69DU)N^k%G diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Web/YiTemplateWebModule.cs b/Yi.Framework.Net6/src/project/template/Yi.Template.Web/YiTemplateWebModule.cs index 5ba64864..1fce11c9 100644 --- a/Yi.Framework.Net6/src/project/template/Yi.Template.Web/YiTemplateWebModule.cs +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Web/YiTemplateWebModule.cs @@ -5,6 +5,7 @@ using Yi.Framework.Auth.JwtBearer; using Yi.Framework.Core; using Yi.Framework.Core.Attributes; using Yi.Framework.Core.Autofac; +using Yi.Framework.Data.Json; using Yi.Template.Application; using Yi.Template.Sqlsugar; @@ -21,7 +22,9 @@ namespace Yi.Template.Web public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context) { //添加控制器与动态api - services.AddControllers(); + services.AddControllers().AddJsonOptions(opt => { + opt.JsonSerializerOptions.Converters.Add(new DateTimeJsonConverter("yyyy-MM-dd HH:mm:ss")); + }); services.AddAutoApiService(opt => { //NETServiceTest所在程序集添加进动态api配置 diff --git a/Yi.RuoYi.Vue3/src/api/system/dept.js b/Yi.RuoYi.Vue3/src/api/system/dept.js index 3976dfa6..7a2721cc 100644 --- a/Yi.RuoYi.Vue3/src/api/system/dept.js +++ b/Yi.RuoYi.Vue3/src/api/system/dept.js @@ -37,7 +37,7 @@ export function addDept(data) { // 修改部门 export function updateDept(data) { return request({ - url: '/dept', + url: `/dept/${data.id}`, method: 'put', data: data }) diff --git a/Yi.RuoYi.Vue3/src/api/system/menu.js b/Yi.RuoYi.Vue3/src/api/system/menu.js index f9536b06..855c7ea2 100644 --- a/Yi.RuoYi.Vue3/src/api/system/menu.js +++ b/Yi.RuoYi.Vue3/src/api/system/menu.js @@ -45,7 +45,7 @@ export function addMenu(data) { // 修改菜单 export function updateMenu(data) { return request({ - url: '/menu', + url: `/menu/${data.id}`, method: 'put', data: data }) diff --git a/Yi.RuoYi.Vue3/src/api/system/post.js b/Yi.RuoYi.Vue3/src/api/system/post.js index 073347dc..5f1c7e04 100644 --- a/Yi.RuoYi.Vue3/src/api/system/post.js +++ b/Yi.RuoYi.Vue3/src/api/system/post.js @@ -29,7 +29,7 @@ export function addPost(data) { // 修改岗位 export function updatePost(data) { return request({ - url: '/post', + url: `/post/${data.id}`, method: 'put', data: data }) diff --git a/Yi.RuoYi.Vue3/src/api/system/role.js b/Yi.RuoYi.Vue3/src/api/system/role.js index f2aa3db4..fd254bc7 100644 --- a/Yi.RuoYi.Vue3/src/api/system/role.js +++ b/Yi.RuoYi.Vue3/src/api/system/role.js @@ -31,7 +31,7 @@ export function addRole(data) { // 修改角色 export function updateRole(data) { return request({ - url: '/role', + url: `/role/${data.id}`, method: 'put', data: data }) diff --git a/Yi.RuoYi.Vue3/src/views/system/dept/index.vue b/Yi.RuoYi.Vue3/src/views/system/dept/index.vue index 4afca6e1..aa065534 100644 --- a/Yi.RuoYi.Vue3/src/views/system/dept/index.vue +++ b/Yi.RuoYi.Vue3/src/views/system/dept/index.vue @@ -9,13 +9,13 @@ @keyup.enter="handleQuery" /> - - + + @@ -56,14 +56,14 @@ > - + - + @@ -134,11 +134,11 @@ - + {{ dict.label }} @@ -174,7 +174,7 @@ const data = reactive({ form: {}, queryParams: { deptName: undefined, - isDeleted: undefined + state: undefined }, rules: { parentId: [{ required: true, message: "上级部门不能为空", trigger: "blur" }], @@ -204,13 +204,13 @@ function cancel() { function reset() { form.value = { id: undefined, - parentId: undefined, + parentId: 0, deptName: undefined, orderNum: 0, leader: undefined, phone: undefined, email: undefined, - isDeleted: false + state: true }; proxy.resetForm("deptRef"); } @@ -227,11 +227,10 @@ function resetQuery() { function handleAdd(row) { reset(); listDept().then(response => { - deptOptions.value = proxy.handleTree(response.data, "deptId"); deptOptions.value = proxy.handleTree(response.data, "id"); }); if (row != undefined) { - form.value.parentId = row.deptId; + console.log(row.deptId); form.value.parentId = row.id; } open.value = true; @@ -248,12 +247,11 @@ function toggleExpandAll() { /** 修改按钮操作 */ function handleUpdate(row) { reset(); - listDeptExcludeChild(row.deptId).then(response => { - deptOptions.value = proxy.handleTree(response.data, "deptId"); + listDept().then(response => { //前端排除自己 - - deptOptions.value = proxy.handleTree(response.data.filter(i=>i.id!=row.id), "id"); + + deptOptions.value = proxy.handleTree(response.data.items.filter(i=>i.id!=row.id), "id"); }); getDept(row.id).then(response => { @@ -261,7 +259,7 @@ function handleUpdate(row) { open.value = true; title.value = "修改部门"; }); -}) + } /** 提交按钮 */ function submitForm() { diff --git a/Yi.RuoYi.Vue3/src/views/system/menu/index.vue b/Yi.RuoYi.Vue3/src/views/system/menu/index.vue index 145d4d88..8ffedc30 100644 --- a/Yi.RuoYi.Vue3/src/views/system/menu/index.vue +++ b/Yi.RuoYi.Vue3/src/views/system/menu/index.vue @@ -9,8 +9,8 @@ @keyup.enter="handleQuery" /> - - + + - + - + @@ -273,7 +273,7 @@ 菜单状态 - + {{dict.label}} @@ -311,7 +311,9 @@ const showChooseIcon = ref(false); const iconSelectRef = ref(null); const data = reactive({ - form: {}, + form: { + + }, queryParams: { menuName: undefined, visible: undefined @@ -359,7 +361,7 @@ function reset() { isLink: false, isCache: false, isShow: true, - isDeleted: false + state: true }; proxy.resetForm("menuRef"); } diff --git a/Yi.RuoYi.Vue3/src/views/system/post/index.vue b/Yi.RuoYi.Vue3/src/views/system/post/index.vue index 62d76580..567ff366 100644 --- a/Yi.RuoYi.Vue3/src/views/system/post/index.vue +++ b/Yi.RuoYi.Vue3/src/views/system/post/index.vue @@ -17,13 +17,13 @@ @keyup.enter="handleQuery" /> - - + + @@ -81,14 +81,14 @@ - + - + @@ -129,8 +129,8 @@ - - + + {{dict.label}} @@ -171,7 +171,7 @@ const data = reactive({ pageSize: 10, postCode: undefined, postName: undefined, - isDeleted: undefined + state: undefined }, rules: { postName: [{ required: true, message: "岗位名称不能为空", trigger: "blur" }], @@ -203,7 +203,7 @@ function reset() { postCode: undefined, postName: undefined, orderNum: 0, - isDeleted: false, + state: false, remark: undefined }; proxy.resetForm("postRef"); diff --git a/Yi.RuoYi.Vue3/src/views/system/role/index.vue b/Yi.RuoYi.Vue3/src/views/system/role/index.vue index 21259a1e..3f54810d 100644 --- a/Yi.RuoYi.Vue3/src/views/system/role/index.vue +++ b/Yi.RuoYi.Vue3/src/views/system/role/index.vue @@ -1,233 +1,100 @@