Browse Source

feat: 优化审计日志查询

pull/126/head
王军 3 years ago
parent
commit
38a0a662fd
  1. 2
      aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/IAuditLogAppService.cs
  2. 22
      aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingAuditLogActionOutput.cs
  3. 13
      aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingAuditLogInput.cs
  4. 8
      aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingAuditLogOutput.cs
  5. 28
      aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingEntityChangeOutput.cs
  6. 18
      aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingEntityPropertyChangeOutput.cs
  7. 1
      aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/GlobalUsings.cs
  8. 41
      aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/AuditLogs/AuditLogAppService.cs
  9. 15
      aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/BasicManagementApplicationAutoMapperProfile.cs
  10. 3
      aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Domain/GlobalUsings.cs
  11. 2
      aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.HttpApi/Systems/AuditLogController.cs
  12. 2
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs
  13. 614
      vben28/src/services/ServiceProxies.ts
  14. 54
      vben28/src/views/admin/auditLog/AuditLog.ts
  15. 41
      vben28/src/views/admin/auditLog/AuditLog.vue
  16. 25
      vben28/src/views/admin/auditLog/AuditLogDetail.vue
  17. 63
      vben28/src/views/admin/roles/AbpRole.vue

2
aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/IAuditLogAppService.cs

@ -7,6 +7,6 @@ namespace Lion.AbpPro.BasicManagement.AuditLogs
/// </summary> /// </summary>
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
Task<PagedResultDto<GetAuditLogPageListOutput>> GetListAsync(PagingAuditLogListInput input); Task<PagedResultDto<PagingAuditLogOutput>> GetListAsync(PagingAuditLogInput input);
} }
} }

22
aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingAuditLogActionOutput.cs

@ -0,0 +1,22 @@
namespace Lion.AbpPro.BasicManagement.AuditLogs;
public class PagingAuditLogActionOutput
{
public Guid Id { get; set; }
public Guid? TenantId { get; set; }
public Guid AuditLogId { get; set; }
public string ServiceName { get; set; }
public string MethodName { get; set; }
public string Parameters { get; set; }
public string ExecutionTime { get; set; }
public int ExecutionDuration { get; set; }
public ExtraPropertyDictionary ExtraProperties { get; set; }
}

13
aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingAuditLogListInput.cs → aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingAuditLogInput.cs

@ -2,7 +2,7 @@ using System.Net;
namespace Lion.AbpPro.BasicManagement.AuditLogs namespace Lion.AbpPro.BasicManagement.AuditLogs
{ {
public class PagingAuditLogListInput : PagingBase public class PagingAuditLogInput : PagingBase
{ {
/// <summary> /// <summary>
/// 排序 /// 排序
@ -29,6 +29,12 @@ namespace Lion.AbpPro.BasicManagement.AuditLogs
/// </summary> /// </summary>
public string Url { get; set; } public string Url { get; set; }
/// <summary>
/// 用户Id
/// </summary>
public Guid? UserId { get; set; }
/// <summary> /// <summary>
/// 用户名 /// 用户名
/// </summary> /// </summary>
@ -63,5 +69,10 @@ namespace Lion.AbpPro.BasicManagement.AuditLogs
/// http 状态码 /// http 状态码
/// </summary> /// </summary>
public HttpStatusCode? HttpStatusCode { get; set; } public HttpStatusCode? HttpStatusCode { get; set; }
/// <summary>
/// 客户端IP
/// </summary>
public string ClientIpAddress { get; set; }
} }
} }

8
aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/GetAuditLogPageListOutput.cs → aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingAuditLogOutput.cs

@ -1,6 +1,6 @@
namespace Lion.AbpPro.BasicManagement.AuditLogs namespace Lion.AbpPro.BasicManagement.AuditLogs
{ {
public class GetAuditLogPageListOutput public class PagingAuditLogOutput
{ {
public string ApplicationName { get; set; } public string ApplicationName { get; set; }
@ -16,7 +16,7 @@ namespace Lion.AbpPro.BasicManagement.AuditLogs
public Guid? ImpersonatorTenantId { get; set; } public Guid? ImpersonatorTenantId { get; set; }
public DateTime ExecutionTime { get; set; } public string ExecutionTime { get; set; }
public int ExecutionDuration { get; set; } public int ExecutionDuration { get; set; }
@ -39,5 +39,9 @@ namespace Lion.AbpPro.BasicManagement.AuditLogs
public string Comments { get; set; } public string Comments { get; set; }
public int? HttpStatusCode { get; set; } public int? HttpStatusCode { get; set; }
public List<PagingEntityChangeOutput> EntityChanges { get; set; }
public List<PagingAuditLogActionOutput> Actions { get; set; }
} }
} }

28
aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingEntityChangeOutput.cs

@ -0,0 +1,28 @@
using Volo.Abp.Auditing;
namespace Lion.AbpPro.BasicManagement.AuditLogs;
public class PagingEntityChangeOutput
{
public Guid Id { get; set; }
public Guid AuditLogId { get; set; }
public Guid? TenantId { get; set; }
public string ChangeTime { get; set; }
public EntityChangeType ChangeType { get; set; }
public string ChangeTypeDescription { get; set; }
public Guid? EntityTenantId { get; set; }
public string EntityId { get; set; }
public string EntityTypeFullName { get; set; }
public List<PagingEntityPropertyChangeOutput> PropertyChanges { get; set; }
public ExtraPropertyDictionary ExtraProperties { get; set; }
}

18
aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/AuditLogs/PagingEntityPropertyChangeOutput.cs

@ -0,0 +1,18 @@
namespace Lion.AbpPro.BasicManagement.AuditLogs;
public class PagingEntityPropertyChangeOutput
{
public Guid Id { get; set; }
public Guid? TenantId { get; set; }
public Guid EntityChangeId { get; set; }
public string NewValue { get; set; }
public string OriginalValue { get; set; }
public string PropertyName { get; set; }
public string PropertyTypeFullName { get; set; }
}

1
aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application.Contracts/GlobalUsings.cs

@ -7,5 +7,6 @@ global using Lion.AbpPro.Core;
global using Volo.Abp.Application.Dtos; global using Volo.Abp.Application.Dtos;
global using Volo.Abp.Application.Services; global using Volo.Abp.Application.Services;
global using Volo.Abp.AspNetCore.Mvc.MultiTenancy; global using Volo.Abp.AspNetCore.Mvc.MultiTenancy;
global using Volo.Abp.Data;
global using Volo.Abp.PermissionManagement; global using Volo.Abp.PermissionManagement;
global using Volo.Abp.TenantManagement; global using Volo.Abp.TenantManagement;

41
aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/AuditLogs/AuditLogAppService.cs

@ -10,45 +10,52 @@ namespace Lion.AbpPro.BasicManagement.AuditLogs
_auditLogRepository = auditLogRepository; _auditLogRepository = auditLogRepository;
} }
/// <summary> /// <summary>
/// 分页查询审计日志 /// 分页查询审计日志
/// </summary> /// </summary>
[Authorize(Policy = BasicManagementPermissions.SystemManagement.AuditLog)] [Authorize(Policy = BasicManagementPermissions.SystemManagement.AuditLog)]
public async Task<PagedResultDto<GetAuditLogPageListOutput>> GetListAsync(PagingAuditLogListInput input) public async Task<PagedResultDto<PagingAuditLogOutput>> GetListAsync(PagingAuditLogInput input)
{ {
var list = await _auditLogRepository.GetListAsync( var totalCount = await _auditLogRepository.GetCountAsync(
input.Sorting, input.StartTime,
input.PageSize, input.EndTime,
input.SkipCount,
input.StartTime?.Date,
input.EndTime?.Date,
input.HttpMethod, input.HttpMethod,
input.Url, input.Url,
null, input.UserId,
input.UserName, input.UserName,
input.ApplicationName, input.ApplicationName,
input.ClientIpAddress,
input.CorrelationId, input.CorrelationId,
null,
input.MaxExecutionDuration, input.MaxExecutionDuration,
input.MinExecutionDuration, input.MinExecutionDuration,
input.HasException, input.HasException,
input.HttpStatusCode); input.HttpStatusCode);
var totalCount = await _auditLogRepository.GetCountAsync( if (totalCount == 0)
input.StartTime?.Date, {
input.EndTime?.Date, return new PagedResultDto<PagingAuditLogOutput>();
}
var list = await _auditLogRepository.GetListAsync(
input.Sorting,
input.PageSize,
input.SkipCount,
input.StartTime,
input.EndTime,
input.HttpMethod, input.HttpMethod,
input.Url, input.Url,
null, input.UserId,
input.UserName, input.UserName,
input.ApplicationName, input.ApplicationName,
null, input.ClientIpAddress,
input.CorrelationId, input.CorrelationId,
input.MaxExecutionDuration, input.MaxExecutionDuration,
input.MinExecutionDuration, input.MinExecutionDuration,
input.HasException, input.HasException,
input.HttpStatusCode); input.HttpStatusCode,
return new PagedResultDto<GetAuditLogPageListOutput>(totalCount, true);
ObjectMapper.Map<List<AuditLog>, List<GetAuditLogPageListOutput>>(list));
return new PagedResultDto<PagingAuditLogOutput>(totalCount, ObjectMapper.Map<List<AuditLog>, List<PagingAuditLogOutput>>(list));
} }
} }
} }

15
aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/BasicManagementApplicationAutoMapperProfile.cs

@ -8,7 +8,20 @@ public class BasicManagementApplicationAutoMapperProfile : Profile
{ {
public BasicManagementApplicationAutoMapperProfile() public BasicManagementApplicationAutoMapperProfile()
{ {
CreateMap<AuditLog, GetAuditLogPageListOutput>(); CreateMap<AuditLog, PagingAuditLogOutput>()
.ForMember(dest => dest.ExecutionTime,
opt => opt.MapFrom(s => s.ExecutionTime.ToString("O")));
CreateMap<AuditLogAction, PagingAuditLogActionOutput>()
.ForMember(dest => dest.ExecutionTime,
opt => opt.MapFrom(s => s.ExecutionTime.ToString("O")));
CreateMap<EntityChange, PagingEntityChangeOutput>()
.ForMember(dest => dest.ChangeTypeDescription,
opt => opt.MapFrom(s => s.ChangeType.ToDescription()))
.ForMember(dest => dest.ChangeTime,
opt => opt.MapFrom(s => s.ChangeTime.ToString("O")));
CreateMap<EntityPropertyChange, PagingEntityPropertyChangeOutput>();
CreateMap<Volo.Abp.Identity.IdentityUser, LoginOutput>() CreateMap<Volo.Abp.Identity.IdentityUser, LoginOutput>()
.ForMember(dest => dest.Token, opt => opt.Ignore()); .ForMember(dest => dest.Token, opt => opt.Ignore());
CreateMap<IdentityUser, ExportIdentityUserOutput>() CreateMap<IdentityUser, ExportIdentityUserOutput>()

3
aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Domain/GlobalUsings.cs

@ -1,9 +1,12 @@
// Global using directives // Global using directives
global using System.Net;
global using Volo.Abp.Auditing;
global using Volo.Abp.AuditLogging; global using Volo.Abp.AuditLogging;
global using Volo.Abp.AutoMapper; global using Volo.Abp.AutoMapper;
global using Volo.Abp.BackgroundJobs; global using Volo.Abp.BackgroundJobs;
global using Volo.Abp.Domain; global using Volo.Abp.Domain;
global using Volo.Abp.Domain.Services;
global using Volo.Abp.FeatureManagement; global using Volo.Abp.FeatureManagement;
global using Volo.Abp.Identity; global using Volo.Abp.Identity;
global using Volo.Abp.Modularity; global using Volo.Abp.Modularity;

2
aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.HttpApi/Systems/AuditLogController.cs

@ -12,7 +12,7 @@ namespace Lion.AbpPro.BasicManagement.Systems
[HttpPost("page")] [HttpPost("page")]
[SwaggerOperation(summary: "分页获取审计日志信息", Tags = new[] {"AuditLogs"})] [SwaggerOperation(summary: "分页获取审计日志信息", Tags = new[] {"AuditLogs"})]
public Task<PagedResultDto<GetAuditLogPageListOutput>> GetListAsync(PagingAuditLogListInput input) public Task<PagedResultDto<PagingAuditLogOutput>> GetListAsync(PagingAuditLogInput input)
{ {
return _auditLogAppService.GetListAsync(input); return _auditLogAppService.GetListAsync(input);
} }

2
aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs

@ -355,7 +355,9 @@ namespace Lion.AbpPro
{ {
options.IgnoredUrls.Add("/AuditLogs/page"); options.IgnoredUrls.Add("/AuditLogs/page");
options.IgnoredUrls.Add("/hangfire/stats"); options.IgnoredUrls.Add("/hangfire/stats");
options.IgnoredUrls.Add("/hangfire/recurring/trigger");
options.IgnoredUrls.Add("/cap"); options.IgnoredUrls.Add("/cap");
options.IgnoredUrls.Add("/");
}); });
} }

614
vben28/src/services/ServiceProxies.ts

@ -481,7 +481,7 @@ export class AuditLogsServiceProxy extends ServiceProxyBase {
* @param body (optional) * @param body (optional)
* @return Success * @return Success
*/ */
page(body: PagingAuditLogListInput | undefined , cancelToken?: CancelToken | undefined): Promise<GetAuditLogPageListOutputPagedResultDto> { page(body: PagingAuditLogInput | undefined , cancelToken?: CancelToken | undefined): Promise<PagingAuditLogOutputPagedResultDto> {
let url_ = this.baseUrl + "/AuditLogs/page"; let url_ = this.baseUrl + "/AuditLogs/page";
url_ = url_.replace(/[?&]$/, ""); url_ = url_.replace(/[?&]$/, "");
@ -511,7 +511,7 @@ export class AuditLogsServiceProxy extends ServiceProxyBase {
}); });
} }
protected processPage(response: AxiosResponse): Promise<GetAuditLogPageListOutputPagedResultDto> { protected processPage(response: AxiosResponse): Promise<PagingAuditLogOutputPagedResultDto> {
const status = response.status; const status = response.status;
let _headers: any = {}; let _headers: any = {};
if (response.headers && typeof response.headers === "object") { if (response.headers && typeof response.headers === "object") {
@ -525,8 +525,8 @@ export class AuditLogsServiceProxy extends ServiceProxyBase {
const _responseText = response.data; const _responseText = response.data;
let result200: any = null; let result200: any = null;
let resultData200 = _responseText; let resultData200 = _responseText;
result200 = GetAuditLogPageListOutputPagedResultDto.fromJS(resultData200); result200 = PagingAuditLogOutputPagedResultDto.fromJS(resultData200);
return Promise.resolve<GetAuditLogPageListOutputPagedResultDto>(result200); return Promise.resolve<PagingAuditLogOutputPagedResultDto>(result200);
} else if (status === 403) { } else if (status === 403) {
const _responseText = response.data; const _responseText = response.data;
@ -574,7 +574,7 @@ export class AuditLogsServiceProxy extends ServiceProxyBase {
const _responseText = response.data; const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers); return throwException("An unexpected server error occurred.", status, _responseText, _headers);
} }
return Promise.resolve<GetAuditLogPageListOutputPagedResultDto>(null as any); return Promise.resolve<PagingAuditLogOutputPagedResultDto>(null as any);
} }
} }
@ -8912,6 +8912,12 @@ export interface IDeleteLanguageInput {
id: string; id: string;
} }
export enum EntityChangeType {
Created = 0,
Updated = 1,
Deleted = 2,
}
export class EntityExtensionDto implements IEntityExtensionDto { export class EntityExtensionDto implements IEntityExtensionDto {
properties!: { [key: string]: ExtensionPropertyDto; } | undefined; properties!: { [key: string]: ExtensionPropertyDto; } | undefined;
configuration!: { [key: string]: any; } | undefined; configuration!: { [key: string]: any; } | undefined;
@ -10644,162 +10650,6 @@ export interface IFindTenantResultDto {
isActive: boolean; isActive: boolean;
} }
export class GetAuditLogPageListOutput implements IGetAuditLogPageListOutput {
applicationName!: string | undefined;
userId!: string | undefined;
userName!: string | undefined;
tenantId!: string | undefined;
tenantName!: string | undefined;
impersonatorUserId!: string | undefined;
impersonatorTenantId!: string | undefined;
executionTime!: dayjs.Dayjs;
executionDuration!: number;
clientIpAddress!: string | undefined;
clientName!: string | undefined;
clientId!: string | undefined;
correlationId!: string | undefined;
browserInfo!: string | undefined;
httpMethod!: string | undefined;
url!: string | undefined;
exceptions!: string | undefined;
comments!: string | undefined;
httpStatusCode!: number | undefined;
constructor(data?: IGetAuditLogPageListOutput) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(_data?: any) {
if (_data) {
this.applicationName = _data["applicationName"];
this.userId = _data["userId"];
this.userName = _data["userName"];
this.tenantId = _data["tenantId"];
this.tenantName = _data["tenantName"];
this.impersonatorUserId = _data["impersonatorUserId"];
this.impersonatorTenantId = _data["impersonatorTenantId"];
this.executionTime = _data["executionTime"] ? dayjs(_data["executionTime"].toString()) : <any>undefined;
this.executionDuration = _data["executionDuration"];
this.clientIpAddress = _data["clientIpAddress"];
this.clientName = _data["clientName"];
this.clientId = _data["clientId"];
this.correlationId = _data["correlationId"];
this.browserInfo = _data["browserInfo"];
this.httpMethod = _data["httpMethod"];
this.url = _data["url"];
this.exceptions = _data["exceptions"];
this.comments = _data["comments"];
this.httpStatusCode = _data["httpStatusCode"];
}
}
static fromJS(data: any): GetAuditLogPageListOutput {
data = typeof data === 'object' ? data : {};
let result = new GetAuditLogPageListOutput();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["applicationName"] = this.applicationName;
data["userId"] = this.userId;
data["userName"] = this.userName;
data["tenantId"] = this.tenantId;
data["tenantName"] = this.tenantName;
data["impersonatorUserId"] = this.impersonatorUserId;
data["impersonatorTenantId"] = this.impersonatorTenantId;
data["executionTime"] = this.executionTime ? this.executionTime.toISOString() : <any>undefined;
data["executionDuration"] = this.executionDuration;
data["clientIpAddress"] = this.clientIpAddress;
data["clientName"] = this.clientName;
data["clientId"] = this.clientId;
data["correlationId"] = this.correlationId;
data["browserInfo"] = this.browserInfo;
data["httpMethod"] = this.httpMethod;
data["url"] = this.url;
data["exceptions"] = this.exceptions;
data["comments"] = this.comments;
data["httpStatusCode"] = this.httpStatusCode;
return data;
}
}
export interface IGetAuditLogPageListOutput {
applicationName: string | undefined;
userId: string | undefined;
userName: string | undefined;
tenantId: string | undefined;
tenantName: string | undefined;
impersonatorUserId: string | undefined;
impersonatorTenantId: string | undefined;
executionTime: dayjs.Dayjs;
executionDuration: number;
clientIpAddress: string | undefined;
clientName: string | undefined;
clientId: string | undefined;
correlationId: string | undefined;
browserInfo: string | undefined;
httpMethod: string | undefined;
url: string | undefined;
exceptions: string | undefined;
comments: string | undefined;
httpStatusCode: number | undefined;
}
export class GetAuditLogPageListOutputPagedResultDto implements IGetAuditLogPageListOutputPagedResultDto {
items!: GetAuditLogPageListOutput[] | undefined;
totalCount!: number;
constructor(data?: IGetAuditLogPageListOutputPagedResultDto) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(_data?: any) {
if (_data) {
if (Array.isArray(_data["items"])) {
this.items = [] as any;
for (let item of _data["items"])
this.items!.push(GetAuditLogPageListOutput.fromJS(item));
}
this.totalCount = _data["totalCount"];
}
}
static fromJS(data: any): GetAuditLogPageListOutputPagedResultDto {
data = typeof data === 'object' ? data : {};
let result = new GetAuditLogPageListOutputPagedResultDto();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
if (Array.isArray(this.items)) {
data["items"] = [];
for (let item of this.items)
data["items"].push(item.toJSON());
}
data["totalCount"] = this.totalCount;
return data;
}
}
export interface IGetAuditLogPageListOutputPagedResultDto {
items: GetAuditLogPageListOutput[] | undefined;
totalCount: number;
}
export class GetOrganizationUnitRoleInput implements IGetOrganizationUnitRoleInput { export class GetOrganizationUnitRoleInput implements IGetOrganizationUnitRoleInput {
/** 当前页面.默认从1开始 */ /** 当前页面.默认从1开始 */
pageIndex!: number; pageIndex!: number;
@ -11966,6 +11816,7 @@ export class IdentityUserDto implements IIdentityUserDto {
lockoutEnabled!: boolean; lockoutEnabled!: boolean;
lockoutEnd!: dayjs.Dayjs | undefined; lockoutEnd!: dayjs.Dayjs | undefined;
concurrencyStamp!: string | undefined; concurrencyStamp!: string | undefined;
entityVersion!: number;
constructor(data?: IIdentityUserDto) { constructor(data?: IIdentityUserDto) {
if (data) { if (data) {
@ -12005,6 +11856,7 @@ export class IdentityUserDto implements IIdentityUserDto {
this.lockoutEnabled = _data["lockoutEnabled"]; this.lockoutEnabled = _data["lockoutEnabled"];
this.lockoutEnd = _data["lockoutEnd"] ? dayjs(_data["lockoutEnd"].toString()) : <any>undefined; this.lockoutEnd = _data["lockoutEnd"] ? dayjs(_data["lockoutEnd"].toString()) : <any>undefined;
this.concurrencyStamp = _data["concurrencyStamp"]; this.concurrencyStamp = _data["concurrencyStamp"];
this.entityVersion = _data["entityVersion"];
} }
} }
@ -12044,6 +11896,7 @@ export class IdentityUserDto implements IIdentityUserDto {
data["lockoutEnabled"] = this.lockoutEnabled; data["lockoutEnabled"] = this.lockoutEnabled;
data["lockoutEnd"] = this.lockoutEnd ? this.lockoutEnd.toISOString() : <any>undefined; data["lockoutEnd"] = this.lockoutEnd ? this.lockoutEnd.toISOString() : <any>undefined;
data["concurrencyStamp"] = this.concurrencyStamp; data["concurrencyStamp"] = this.concurrencyStamp;
data["entityVersion"] = this.entityVersion;
return data; return data;
} }
} }
@ -12070,6 +11923,7 @@ export interface IIdentityUserDto {
lockoutEnabled: boolean; lockoutEnabled: boolean;
lockoutEnd: dayjs.Dayjs | undefined; lockoutEnd: dayjs.Dayjs | undefined;
concurrencyStamp: string | undefined; concurrencyStamp: string | undefined;
entityVersion: number;
} }
export class IdentityUserDtoPagedResultDto implements IIdentityUserDtoPagedResultDto { export class IdentityUserDtoPagedResultDto implements IIdentityUserDtoPagedResultDto {
@ -13199,7 +13053,87 @@ export interface IPageLanguageTextOutputPagedResultDto {
totalCount: number; totalCount: number;
} }
export class PagingAuditLogListInput implements IPagingAuditLogListInput { export class PagingAuditLogActionOutput implements IPagingAuditLogActionOutput {
id!: string;
tenantId!: string | undefined;
auditLogId!: string;
serviceName!: string | undefined;
methodName!: string | undefined;
parameters!: string | undefined;
executionTime!: string | undefined;
executionDuration!: number;
extraProperties!: { [key: string]: any; } | undefined;
constructor(data?: IPagingAuditLogActionOutput) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(_data?: any) {
if (_data) {
this.id = _data["id"];
this.tenantId = _data["tenantId"];
this.auditLogId = _data["auditLogId"];
this.serviceName = _data["serviceName"];
this.methodName = _data["methodName"];
this.parameters = _data["parameters"];
this.executionTime = _data["executionTime"];
this.executionDuration = _data["executionDuration"];
if (_data["extraProperties"]) {
this.extraProperties = {} as any;
for (let key in _data["extraProperties"]) {
if (_data["extraProperties"].hasOwnProperty(key))
(<any>this.extraProperties)![key] = _data["extraProperties"][key];
}
}
}
}
static fromJS(data: any): PagingAuditLogActionOutput {
data = typeof data === 'object' ? data : {};
let result = new PagingAuditLogActionOutput();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["id"] = this.id;
data["tenantId"] = this.tenantId;
data["auditLogId"] = this.auditLogId;
data["serviceName"] = this.serviceName;
data["methodName"] = this.methodName;
data["parameters"] = this.parameters;
data["executionTime"] = this.executionTime;
data["executionDuration"] = this.executionDuration;
if (this.extraProperties) {
data["extraProperties"] = {};
for (let key in this.extraProperties) {
if (this.extraProperties.hasOwnProperty(key))
(<any>data["extraProperties"])[key] = (<any>this.extraProperties)[key];
}
}
return data;
}
}
export interface IPagingAuditLogActionOutput {
id: string;
tenantId: string | undefined;
auditLogId: string;
serviceName: string | undefined;
methodName: string | undefined;
parameters: string | undefined;
executionTime: string | undefined;
executionDuration: number;
extraProperties: { [key: string]: any; } | undefined;
}
export class PagingAuditLogInput implements IPagingAuditLogInput {
/** 当前页面.默认从1开始 */ /** 当前页面.默认从1开始 */
pageIndex!: number; pageIndex!: number;
/** 每页多少条.每页显示多少记录 */ /** 每页多少条.每页显示多少记录 */
@ -13216,6 +13150,8 @@ export class PagingAuditLogListInput implements IPagingAuditLogListInput {
httpMethod!: string | undefined; httpMethod!: string | undefined;
/** 请求地址 */ /** 请求地址 */
url!: string | undefined; url!: string | undefined;
/** 用户Id */
userId!: string | undefined;
/** 用户名 */ /** 用户名 */
userName!: string | undefined; userName!: string | undefined;
/** 应用程序名称 */ /** 应用程序名称 */
@ -13229,8 +13165,10 @@ export class PagingAuditLogListInput implements IPagingAuditLogListInput {
/** 是否有异常 */ /** 是否有异常 */
hasException!: boolean | undefined; hasException!: boolean | undefined;
httpStatusCode!: HttpStatusCode; httpStatusCode!: HttpStatusCode;
/** 客户端IP */
clientIpAddress!: string | undefined;
constructor(data?: IPagingAuditLogListInput) { constructor(data?: IPagingAuditLogInput) {
if (data) { if (data) {
for (var property in data) { for (var property in data) {
if (data.hasOwnProperty(property)) if (data.hasOwnProperty(property))
@ -13249,6 +13187,7 @@ export class PagingAuditLogListInput implements IPagingAuditLogListInput {
this.endTime = _data["endTime"] ? dayjs(_data["endTime"].toString()) : <any>undefined; this.endTime = _data["endTime"] ? dayjs(_data["endTime"].toString()) : <any>undefined;
this.httpMethod = _data["httpMethod"]; this.httpMethod = _data["httpMethod"];
this.url = _data["url"]; this.url = _data["url"];
this.userId = _data["userId"];
this.userName = _data["userName"]; this.userName = _data["userName"];
this.applicationName = _data["applicationName"]; this.applicationName = _data["applicationName"];
this.correlationId = _data["correlationId"]; this.correlationId = _data["correlationId"];
@ -13256,12 +13195,13 @@ export class PagingAuditLogListInput implements IPagingAuditLogListInput {
this.minExecutionDuration = _data["minExecutionDuration"]; this.minExecutionDuration = _data["minExecutionDuration"];
this.hasException = _data["hasException"]; this.hasException = _data["hasException"];
this.httpStatusCode = _data["httpStatusCode"]; this.httpStatusCode = _data["httpStatusCode"];
this.clientIpAddress = _data["clientIpAddress"];
} }
} }
static fromJS(data: any): PagingAuditLogListInput { static fromJS(data: any): PagingAuditLogInput {
data = typeof data === 'object' ? data : {}; data = typeof data === 'object' ? data : {};
let result = new PagingAuditLogListInput(); let result = new PagingAuditLogInput();
result.init(data); result.init(data);
return result; return result;
} }
@ -13276,6 +13216,7 @@ export class PagingAuditLogListInput implements IPagingAuditLogListInput {
data["endTime"] = this.endTime ? this.endTime.toISOString() : <any>undefined; data["endTime"] = this.endTime ? this.endTime.toISOString() : <any>undefined;
data["httpMethod"] = this.httpMethod; data["httpMethod"] = this.httpMethod;
data["url"] = this.url; data["url"] = this.url;
data["userId"] = this.userId;
data["userName"] = this.userName; data["userName"] = this.userName;
data["applicationName"] = this.applicationName; data["applicationName"] = this.applicationName;
data["correlationId"] = this.correlationId; data["correlationId"] = this.correlationId;
@ -13283,11 +13224,12 @@ export class PagingAuditLogListInput implements IPagingAuditLogListInput {
data["minExecutionDuration"] = this.minExecutionDuration; data["minExecutionDuration"] = this.minExecutionDuration;
data["hasException"] = this.hasException; data["hasException"] = this.hasException;
data["httpStatusCode"] = this.httpStatusCode; data["httpStatusCode"] = this.httpStatusCode;
data["clientIpAddress"] = this.clientIpAddress;
return data; return data;
} }
} }
export interface IPagingAuditLogListInput { export interface IPagingAuditLogInput {
/** 当前页面.默认从1开始 */ /** 当前页面.默认从1开始 */
pageIndex: number; pageIndex: number;
/** 每页多少条.每页显示多少记录 */ /** 每页多少条.每页显示多少记录 */
@ -13304,6 +13246,8 @@ export interface IPagingAuditLogListInput {
httpMethod: string | undefined; httpMethod: string | undefined;
/** 请求地址 */ /** 请求地址 */
url: string | undefined; url: string | undefined;
/** 用户Id */
userId: string | undefined;
/** 用户名 */ /** 用户名 */
userName: string | undefined; userName: string | undefined;
/** 应用程序名称 */ /** 应用程序名称 */
@ -13317,6 +13261,188 @@ export interface IPagingAuditLogListInput {
/** 是否有异常 */ /** 是否有异常 */
hasException: boolean | undefined; hasException: boolean | undefined;
httpStatusCode: HttpStatusCode; httpStatusCode: HttpStatusCode;
/** 客户端IP */
clientIpAddress: string | undefined;
}
export class PagingAuditLogOutput implements IPagingAuditLogOutput {
applicationName!: string | undefined;
userId!: string | undefined;
userName!: string | undefined;
tenantId!: string | undefined;
tenantName!: string | undefined;
impersonatorUserId!: string | undefined;
impersonatorTenantId!: string | undefined;
executionTime!: string | undefined;
executionDuration!: number;
clientIpAddress!: string | undefined;
clientName!: string | undefined;
clientId!: string | undefined;
correlationId!: string | undefined;
browserInfo!: string | undefined;
httpMethod!: string | undefined;
url!: string | undefined;
exceptions!: string | undefined;
comments!: string | undefined;
httpStatusCode!: number | undefined;
entityChanges!: PagingEntityChangeOutput[] | undefined;
actions!: PagingAuditLogActionOutput[] | undefined;
constructor(data?: IPagingAuditLogOutput) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(_data?: any) {
if (_data) {
this.applicationName = _data["applicationName"];
this.userId = _data["userId"];
this.userName = _data["userName"];
this.tenantId = _data["tenantId"];
this.tenantName = _data["tenantName"];
this.impersonatorUserId = _data["impersonatorUserId"];
this.impersonatorTenantId = _data["impersonatorTenantId"];
this.executionTime = _data["executionTime"];
this.executionDuration = _data["executionDuration"];
this.clientIpAddress = _data["clientIpAddress"];
this.clientName = _data["clientName"];
this.clientId = _data["clientId"];
this.correlationId = _data["correlationId"];
this.browserInfo = _data["browserInfo"];
this.httpMethod = _data["httpMethod"];
this.url = _data["url"];
this.exceptions = _data["exceptions"];
this.comments = _data["comments"];
this.httpStatusCode = _data["httpStatusCode"];
if (Array.isArray(_data["entityChanges"])) {
this.entityChanges = [] as any;
for (let item of _data["entityChanges"])
this.entityChanges!.push(PagingEntityChangeOutput.fromJS(item));
}
if (Array.isArray(_data["actions"])) {
this.actions = [] as any;
for (let item of _data["actions"])
this.actions!.push(PagingAuditLogActionOutput.fromJS(item));
}
}
}
static fromJS(data: any): PagingAuditLogOutput {
data = typeof data === 'object' ? data : {};
let result = new PagingAuditLogOutput();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["applicationName"] = this.applicationName;
data["userId"] = this.userId;
data["userName"] = this.userName;
data["tenantId"] = this.tenantId;
data["tenantName"] = this.tenantName;
data["impersonatorUserId"] = this.impersonatorUserId;
data["impersonatorTenantId"] = this.impersonatorTenantId;
data["executionTime"] = this.executionTime;
data["executionDuration"] = this.executionDuration;
data["clientIpAddress"] = this.clientIpAddress;
data["clientName"] = this.clientName;
data["clientId"] = this.clientId;
data["correlationId"] = this.correlationId;
data["browserInfo"] = this.browserInfo;
data["httpMethod"] = this.httpMethod;
data["url"] = this.url;
data["exceptions"] = this.exceptions;
data["comments"] = this.comments;
data["httpStatusCode"] = this.httpStatusCode;
if (Array.isArray(this.entityChanges)) {
data["entityChanges"] = [];
for (let item of this.entityChanges)
data["entityChanges"].push(item.toJSON());
}
if (Array.isArray(this.actions)) {
data["actions"] = [];
for (let item of this.actions)
data["actions"].push(item.toJSON());
}
return data;
}
}
export interface IPagingAuditLogOutput {
applicationName: string | undefined;
userId: string | undefined;
userName: string | undefined;
tenantId: string | undefined;
tenantName: string | undefined;
impersonatorUserId: string | undefined;
impersonatorTenantId: string | undefined;
executionTime: string | undefined;
executionDuration: number;
clientIpAddress: string | undefined;
clientName: string | undefined;
clientId: string | undefined;
correlationId: string | undefined;
browserInfo: string | undefined;
httpMethod: string | undefined;
url: string | undefined;
exceptions: string | undefined;
comments: string | undefined;
httpStatusCode: number | undefined;
entityChanges: PagingEntityChangeOutput[] | undefined;
actions: PagingAuditLogActionOutput[] | undefined;
}
export class PagingAuditLogOutputPagedResultDto implements IPagingAuditLogOutputPagedResultDto {
items!: PagingAuditLogOutput[] | undefined;
totalCount!: number;
constructor(data?: IPagingAuditLogOutputPagedResultDto) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(_data?: any) {
if (_data) {
if (Array.isArray(_data["items"])) {
this.items = [] as any;
for (let item of _data["items"])
this.items!.push(PagingAuditLogOutput.fromJS(item));
}
this.totalCount = _data["totalCount"];
}
}
static fromJS(data: any): PagingAuditLogOutputPagedResultDto {
data = typeof data === 'object' ? data : {};
let result = new PagingAuditLogOutputPagedResultDto();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
if (Array.isArray(this.items)) {
data["items"] = [];
for (let item of this.items)
data["items"].push(item.toJSON());
}
data["totalCount"] = this.totalCount;
return data;
}
}
export interface IPagingAuditLogOutputPagedResultDto {
items: PagingAuditLogOutput[] | undefined;
totalCount: number;
} }
export class PagingDataDictionaryDetailInput implements IPagingDataDictionaryDetailInput { export class PagingDataDictionaryDetailInput implements IPagingDataDictionaryDetailInput {
@ -13813,6 +13939,162 @@ export interface IPagingElasticSearchLogOutputCustomPagedResultDto {
totalCount: number; totalCount: number;
} }
export class PagingEntityChangeOutput implements IPagingEntityChangeOutput {
id!: string;
auditLogId!: string;
tenantId!: string | undefined;
changeTime!: string | undefined;
changeType!: EntityChangeType;
changeTypeDescription!: string | undefined;
entityTenantId!: string | undefined;
entityId!: string | undefined;
entityTypeFullName!: string | undefined;
propertyChanges!: PagingEntityPropertyChangeOutput[] | undefined;
extraProperties!: { [key: string]: any; } | undefined;
constructor(data?: IPagingEntityChangeOutput) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(_data?: any) {
if (_data) {
this.id = _data["id"];
this.auditLogId = _data["auditLogId"];
this.tenantId = _data["tenantId"];
this.changeTime = _data["changeTime"];
this.changeType = _data["changeType"];
this.changeTypeDescription = _data["changeTypeDescription"];
this.entityTenantId = _data["entityTenantId"];
this.entityId = _data["entityId"];
this.entityTypeFullName = _data["entityTypeFullName"];
if (Array.isArray(_data["propertyChanges"])) {
this.propertyChanges = [] as any;
for (let item of _data["propertyChanges"])
this.propertyChanges!.push(PagingEntityPropertyChangeOutput.fromJS(item));
}
if (_data["extraProperties"]) {
this.extraProperties = {} as any;
for (let key in _data["extraProperties"]) {
if (_data["extraProperties"].hasOwnProperty(key))
(<any>this.extraProperties)![key] = _data["extraProperties"][key];
}
}
}
}
static fromJS(data: any): PagingEntityChangeOutput {
data = typeof data === 'object' ? data : {};
let result = new PagingEntityChangeOutput();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["id"] = this.id;
data["auditLogId"] = this.auditLogId;
data["tenantId"] = this.tenantId;
data["changeTime"] = this.changeTime;
data["changeType"] = this.changeType;
data["changeTypeDescription"] = this.changeTypeDescription;
data["entityTenantId"] = this.entityTenantId;
data["entityId"] = this.entityId;
data["entityTypeFullName"] = this.entityTypeFullName;
if (Array.isArray(this.propertyChanges)) {
data["propertyChanges"] = [];
for (let item of this.propertyChanges)
data["propertyChanges"].push(item.toJSON());
}
if (this.extraProperties) {
data["extraProperties"] = {};
for (let key in this.extraProperties) {
if (this.extraProperties.hasOwnProperty(key))
(<any>data["extraProperties"])[key] = (<any>this.extraProperties)[key];
}
}
return data;
}
}
export interface IPagingEntityChangeOutput {
id: string;
auditLogId: string;
tenantId: string | undefined;
changeTime: string | undefined;
changeType: EntityChangeType;
changeTypeDescription: string | undefined;
entityTenantId: string | undefined;
entityId: string | undefined;
entityTypeFullName: string | undefined;
propertyChanges: PagingEntityPropertyChangeOutput[] | undefined;
extraProperties: { [key: string]: any; } | undefined;
}
export class PagingEntityPropertyChangeOutput implements IPagingEntityPropertyChangeOutput {
id!: string;
tenantId!: string | undefined;
entityChangeId!: string;
newValue!: string | undefined;
originalValue!: string | undefined;
propertyName!: string | undefined;
propertyTypeFullName!: string | undefined;
constructor(data?: IPagingEntityPropertyChangeOutput) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(_data?: any) {
if (_data) {
this.id = _data["id"];
this.tenantId = _data["tenantId"];
this.entityChangeId = _data["entityChangeId"];
this.newValue = _data["newValue"];
this.originalValue = _data["originalValue"];
this.propertyName = _data["propertyName"];
this.propertyTypeFullName = _data["propertyTypeFullName"];
}
}
static fromJS(data: any): PagingEntityPropertyChangeOutput {
data = typeof data === 'object' ? data : {};
let result = new PagingEntityPropertyChangeOutput();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["id"] = this.id;
data["tenantId"] = this.tenantId;
data["entityChangeId"] = this.entityChangeId;
data["newValue"] = this.newValue;
data["originalValue"] = this.originalValue;
data["propertyName"] = this.propertyName;
data["propertyTypeFullName"] = this.propertyTypeFullName;
return data;
}
}
export interface IPagingEntityPropertyChangeOutput {
id: string;
tenantId: string | undefined;
entityChangeId: string;
newValue: string | undefined;
originalValue: string | undefined;
propertyName: string | undefined;
propertyTypeFullName: string | undefined;
}
export class PagingNotificationListInput implements IPagingNotificationListInput { export class PagingNotificationListInput implements IPagingNotificationListInput {
/** 当前页面.默认从1开始 */ /** 当前页面.默认从1开始 */
pageIndex!: number; pageIndex!: number;

54
vben28/src/views/admin/auditLog/AuditLog.ts

@ -1,32 +1,31 @@
import { FormSchema } from '/@/components/Table'; import { FormSchema } from '/@/components/Table';
import { BasicColumn } from '/@/components/Table'; import { BasicColumn } from '/@/components/Table';
import { useI18n } from '/@/hooks/web/useI18n'; import { useI18n } from '/@/hooks/web/useI18n';
import { formatToDateTime, dateUtil } from '/@/utils/dateUtil';
const { t } = useI18n(); const { t } = useI18n();
import { formatToDateTime } from '/@/utils/dateUtil'; import { AuditLogsServiceProxy, PagingAuditLogInput } from '/@/services/ServiceProxies';
import { AuditLogsServiceProxy, PagingAuditLogListInput } from '/@/services/ServiceProxies';
export const searchFormSchema: FormSchema[] = [ export const searchFormSchema: FormSchema[] = [
{ {
field: 'userName', field: 'userName',
label: t('routes.admin.userManagement_userName'), label: t('routes.admin.userManagement_userName'),
component: 'Input', component: 'Input',
colProps: { span: 4 }, colProps: { span: 3 },
}, },
{ {
field: 'time', field: 'time',
component: 'RangePicker', component: 'RangePicker',
label: t('routes.admin.audit_executeTime'), label: t('routes.admin.audit_executeTime'),
labelWidth: 120,
colProps: { colProps: {
span: 6, span: 4,
}, },
defaultValue: [dateUtil().subtract(7, 'days'), dateUtil().add(1, 'days')],
}, },
{ {
field: 'hasException', field: 'hasException',
label: t('routes.admin.audit_hasException'), label: t('routes.admin.audit_hasException'),
component: 'Select', component: 'Select',
colProps: { span: 4 }, colProps: { span: 2 },
componentProps: () => { componentProps: () => {
return { return {
options: [ options: [
@ -37,20 +36,33 @@ export const searchFormSchema: FormSchema[] = [
}; };
}, },
}, },
{
field: 'correlationId',
label: 'CorrelationId',
labelWidth: 95,
component: 'Input',
colProps: { span: 4 },
},
{
field: 'url',
label: 'Url',
component: 'Input',
colProps: { span: 4 },
},
]; ];
export const tableColumns: BasicColumn[] = [ export const tableColumns: BasicColumn[] = [
// {
// title: t('routes.admin.tenant'),
// dataIndex: 'tenantName',
// width: 100,
// },
{ {
title: 'Url', title: 'Url',
dataIndex: 'url', dataIndex: 'url',
width: 350, width: 350,
align: 'left', align: 'left',
}, },
{
title: t('routes.admin.tenant'),
dataIndex: 'tenantName',
width: 100,
},
{ {
title: t('routes.admin.userManagement_userName'), title: t('routes.admin.userManagement_userName'),
dataIndex: 'userName', dataIndex: 'userName',
@ -59,24 +71,32 @@ export const tableColumns: BasicColumn[] = [
{ {
title: t('routes.admin.executionTime'), title: t('routes.admin.executionTime'),
dataIndex: 'executionTime', dataIndex: 'executionTime',
width: 200,
customRender: ({ text }) => { customRender: ({ text }) => {
return formatToDateTime(text); return formatToDateTime(text);
}, },
width: 150,
}, },
{ {
title: t('routes.admin.executionDuration'), title: t('routes.admin.executionDuration'),
dataIndex: 'executionDuration', dataIndex: 'executionDuration',
width: 120,
},
{
title: t('routes.admin.audit_ipAddress'),
dataIndex: 'clientIpAddress',
width: 150, width: 150,
}, },
{
title: 'CorrelationId',
dataIndex: 'correlationId',
width: 280,
},
{ {
title: t('routes.admin.executionMessage'), title: t('routes.admin.executionMessage'),
dataIndex: 'exceptions', dataIndex: 'exceptions',
resizable: false,
width: 350,
customRender: ({ text }) => { customRender: ({ text }) => {
if (text) { if (text) {
return text.toString(); return text.toString().substring(0, 300);
} }
}, },
}, },
@ -87,7 +107,7 @@ export const tableColumns: BasicColumn[] = [
* @param params * @param params
* @returns * @returns
*/ */
export async function getTableListAsync(params: PagingAuditLogListInput) { export async function getTableListAsync(params: PagingAuditLogInput) {
const _auditLogsServiceProxy = new AuditLogsServiceProxy(); const _auditLogsServiceProxy = new AuditLogsServiceProxy();
return _auditLogsServiceProxy.page(params); return _auditLogsServiceProxy.page(params);
} }

41
vben28/src/views/admin/auditLog/AuditLog.vue

@ -10,13 +10,25 @@
<span style="margin-left: 5px">{{ record.url }}</span> <span style="margin-left: 5px">{{ record.url }}</span>
</template> </template>
</template> </template>
<template #action="{ record }">
<TableAction
:actions="[
{
label: t('routes.admin.detail'),
icon: 'ant-design:schedule-outlined',
onClick: handleDetail.bind(null, record),
},
]"
/>
</template>
</BasicTable> </BasicTable>
<AuditLogDetail @register="registerDrawer" />
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
import { BasicTable, useTable } from '/@/components/Table'; import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { import {
tableColumns, tableColumns,
searchFormSchema, searchFormSchema,
@ -24,14 +36,17 @@
httpStatusCodeColor, httpStatusCodeColor,
httpMethodColor, httpMethodColor,
} from '/@/views/admin/auditLog/AuditLog'; } from '/@/views/admin/auditLog/AuditLog';
import AuditLogDetail from './AuditLogDetail.vue';
import { Tag } from 'ant-design-vue'; import { Tag } from 'ant-design-vue';
import { useI18n } from '/@/hooks/web/useI18n'; import { useI18n } from '/@/hooks/web/useI18n';
import { useDrawer } from '/@/components/Drawer';
export default defineComponent({ export default defineComponent({
name: 'AuditLog', name: 'AuditLog',
components: { components: {
BasicTable, BasicTable,
Tag, Tag,
AuditLogDetail,
TableAction,
}, },
setup() { setup() {
const { t } = useI18n(); const { t } = useI18n();
@ -41,9 +56,7 @@
formConfig: { formConfig: {
labelWidth: 70, labelWidth: 70,
schemas: searchFormSchema, schemas: searchFormSchema,
fieldMapToTime: [ fieldMapToTime: [['time', ['startTime', 'endTime'], 'YYYY-MM-DD']],
['time', ['executionBeginTime', 'executionEndTime'], 'YYYY-MM-DD HH:mm:ss'],
],
}, },
api: getTableListAsync, api: getTableListAsync,
showTableSetting: true, showTableSetting: true,
@ -53,14 +66,30 @@
showIndexColumn: true, showIndexColumn: true,
immediate: true, immediate: true,
scroll: { x: true }, scroll: { x: true },
actionColumn: {
width: 200,
title: t('common.action'),
dataIndex: 'action',
slots: {
customRender: 'action',
},
fixed: 'right',
},
}); });
const [registerDrawer, { openDrawer }] = useDrawer();
const handleDetail = (record: Recordable) => {
openDrawer(true, {
record: record,
});
};
return { return {
registerTable, registerTable,
reload, reload,
t, t,
httpStatusCodeColor, httpStatusCodeColor,
httpMethodColor, httpMethodColor,
registerDrawer,
handleDetail,
}; };
}, },
}); });

25
vben28/src/views/admin/auditLog/AuditLogDetail.vue

@ -0,0 +1,25 @@
<template>
<BasicDrawer v-bind="$attrs" @register="register" :title="t('routes.admin.detail')" width="50%">
<JsonPreview :data="auditLogInfo" />
</BasicDrawer>
</template>
<script lang="ts">
import { defineComponent, ref, unref } from 'vue';
import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
import { useI18n } from '/@/hooks/web/useI18n';
import { JsonPreview } from '/@/components/CodeEditor';
export default defineComponent({
components: { BasicDrawer, JsonPreview },
setup() {
const { t } = useI18n();
const auditLogInfo = ref({});
let entityChanges;
const [register] = useDrawerInner((data) => {
console.log(JSON.stringify(data.record));
auditLogInfo.value = unref(data.record);
});
return { t, register, entityChanges, auditLogInfo };
},
});
</script>

63
vben28/src/views/admin/roles/AbpRole.vue

@ -4,7 +4,7 @@
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.key === 'isDefault'"> <template v-if="column.key === 'isDefault'">
<Tag :color="record.isDefault ? 'red' : 'green'"> <Tag :color="record.isDefault ? 'red' : 'green'">
{{ record.isDefault ? "是" : "否" }} {{ record.isDefault ? '是' : '否' }}
</Tag> </Tag>
</template> </template>
</template> </template>
@ -15,7 +15,7 @@
@click="openCreateAbpRoleModal" @click="openCreateAbpRoleModal"
v-auth="'AbpIdentity.Roles.Create'" v-auth="'AbpIdentity.Roles.Create'"
> >
{{ t("common.createText") }} {{ t('common.createText') }}
</a-button> </a-button>
</template> </template>
@ -66,27 +66,32 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent } from "vue"; import { defineComponent } from 'vue';
import { BasicTable, useTable, TableAction } from "/@/components/Table"; import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { tableColumns, searchFormSchema, getTableListAsync, deleteRoleAsync } from "/@/views/admin/roles/AbpRole"; import {
import { useModal } from "/@/components/Modal"; tableColumns,
import CreateAbpRole from "./CreateAbpRole.vue"; searchFormSchema,
import PermissionAbpRole from "./PermissionAbpRole.vue"; getTableListAsync,
import EditAbpRole from "./EditAbpRole.vue"; deleteRoleAsync,
import { useMessage } from "/@/hooks/web/useMessage"; } from '/@/views/admin/roles/AbpRole';
import { useDrawer } from "/@/components/Drawer"; import { useModal } from '/@/components/Modal';
import { useI18n } from "/@/hooks/web/useI18n"; import CreateAbpRole from './CreateAbpRole.vue';
import { Tag } from "ant-design-vue"; import PermissionAbpRole from './PermissionAbpRole.vue';
import EditAbpRole from './EditAbpRole.vue';
import { useMessage } from '/@/hooks/web/useMessage';
import { useDrawer } from '/@/components/Drawer';
import { useI18n } from '/@/hooks/web/useI18n';
import { Tag } from 'ant-design-vue';
export default defineComponent({ export default defineComponent({
name: "AbpRole", name: 'AbpRole',
components: { components: {
BasicTable, BasicTable,
TableAction, TableAction,
CreateAbpRole, CreateAbpRole,
PermissionAbpRole, PermissionAbpRole,
EditAbpRole, EditAbpRole,
Tag Tag,
}, },
setup() { setup() {
const { createConfirm } = useMessage(); const { createConfirm } = useMessage();
@ -103,7 +108,7 @@ export default defineComponent({
columns: tableColumns, columns: tableColumns,
formConfig: { formConfig: {
labelWidth: 70, labelWidth: 70,
schemas: searchFormSchema schemas: searchFormSchema,
}, },
api: getTableListAsync, api: getTableListAsync,
showTableSetting: true, showTableSetting: true,
@ -113,39 +118,39 @@ export default defineComponent({
showIndexColumn: true, showIndexColumn: true,
actionColumn: { actionColumn: {
width: 200, width: 200,
title: t("common.action"), title: t('common.action'),
dataIndex: "action", dataIndex: 'action',
slots: { slots: {
customRender: "action" customRender: 'action',
},
fixed: 'right',
}, },
fixed: "right"
}
}); });
// //
const handleEdit = (record: Recordable) => { const handleEdit = (record: Recordable) => {
openEditAbpRoleModal(true, { openEditAbpRoleModal(true, {
record: record record: record,
}); });
}; };
// //
const handlePermission = (record: Recordable) => { const handlePermission = (record: Recordable) => {
openPermissionAbpRoleDrawer(true, { openPermissionAbpRoleDrawer(true, {
record: record record: record,
}); });
}; };
// //
const handleDelete = async (record: Recordable) => { const handleDelete = async (record: Recordable) => {
let msg = t("common.askDelete"); let msg = t('common.askDelete');
createConfirm({ createConfirm({
iconType: "warning", iconType: 'warning',
title: t("common.tip"), title: t('common.tip'),
content: msg, content: msg,
onOk: async () => { onOk: async () => {
await deleteRoleAsync({ roleId: record.id, reload }); await deleteRoleAsync({ roleId: record.id, reload });
} },
}); });
}; };
@ -160,8 +165,8 @@ export default defineComponent({
openCreateAbpRoleModal, openCreateAbpRoleModal,
registerPermissionAbpRoleModal, registerPermissionAbpRoleModal,
registerEditAbpRoleModal, registerEditAbpRoleModal,
reload reload,
}; };
} },
}); });
</script> </script>

Loading…
Cancel
Save