操作
This commit is contained in:
parent
82acdee645
commit
b11249cd59
|
|
@ -284,33 +284,6 @@ onMounted(() => {
|
|||
{{ row.description || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="请求"
|
||||
width="200"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<div
|
||||
v-if="row.requestMethod || row.requestUrl"
|
||||
class="request-info"
|
||||
>
|
||||
<el-tag
|
||||
v-if="row.requestMethod"
|
||||
:type="getMethodTagType(row.requestMethod)"
|
||||
size="small"
|
||||
>
|
||||
{{ row.requestMethod }}
|
||||
</el-tag>
|
||||
<span
|
||||
v-if="row.requestUrl"
|
||||
class="request-url"
|
||||
:title="row.requestUrl"
|
||||
>
|
||||
{{ row.requestUrl }}
|
||||
</span>
|
||||
</div>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="ip"
|
||||
label="IP地址"
|
||||
|
|
@ -415,76 +388,15 @@ onMounted(() => {
|
|||
>
|
||||
{{ currentLogDetail.description || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="请求方法">
|
||||
<el-tag
|
||||
v-if="currentLogDetail.requestMethod"
|
||||
:type="getMethodTagType(currentLogDetail.requestMethod)"
|
||||
size="small"
|
||||
>
|
||||
{{ currentLogDetail.requestMethod }}
|
||||
</el-tag>
|
||||
<span v-else>-</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="请求URL">
|
||||
{{ currentLogDetail.requestUrl || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="操作目标ID">
|
||||
{{ currentLogDetail.targetId || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="IP地址">
|
||||
{{ currentLogDetail.ip || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="执行耗时">
|
||||
<span v-if="currentLogDetail.executeTime !== null && currentLogDetail.executeTime !== undefined">
|
||||
{{ currentLogDetail.executeTime }}ms
|
||||
</span>
|
||||
<span v-else>-</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="状态">
|
||||
<StatusTag
|
||||
:status="currentLogDetail.status"
|
||||
:options="[
|
||||
{ value: 1, label: '成功', type: 'success' },
|
||||
{ value: 2, label: '失败', type: 'danger' }
|
||||
]"
|
||||
/>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-descriptions
|
||||
v-if="currentLogDetail && currentLogDetail.status === 2"
|
||||
:column="1"
|
||||
border
|
||||
style="margin-top: 16px"
|
||||
>
|
||||
<el-descriptions-item
|
||||
label="操作时间"
|
||||
:span="2"
|
||||
>
|
||||
{{ formatTime(currentLogDetail.createTime) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item
|
||||
label="User-Agent"
|
||||
:span="2"
|
||||
>
|
||||
<div class="text-wrap">
|
||||
{{ currentLogDetail.userAgent || '-' }}
|
||||
</div>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item
|
||||
label="请求参数"
|
||||
:span="2"
|
||||
>
|
||||
<div class="code-block">
|
||||
<pre v-if="currentLogDetail.requestParams">{{ currentLogDetail.requestParams }}</pre>
|
||||
<span v-else>-</span>
|
||||
</div>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item
|
||||
label="响应结果"
|
||||
:span="2"
|
||||
>
|
||||
<div class="code-block">
|
||||
<pre v-if="currentLogDetail.responseResult">{{ currentLogDetail.responseResult }}</pre>
|
||||
<span v-else>-</span>
|
||||
</div>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item
|
||||
v-if="currentLogDetail.status === 2"
|
||||
label="错误信息"
|
||||
:span="2"
|
||||
>
|
||||
<div class="error-msg">
|
||||
{{ currentLogDetail.errorMsg || '-' }}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Security.Claims;
|
||||
using XiangYi.AdminApi.Filters;
|
||||
using XiangYi.Application.DTOs.Requests;
|
||||
using XiangYi.Application.DTOs.Responses;
|
||||
using XiangYi.Application.Interfaces;
|
||||
|
|
@ -41,6 +42,7 @@ public class AdminSystemController : ControllerBase
|
|||
/// 获取管理员列表
|
||||
/// </summary>
|
||||
[HttpGet("admins")]
|
||||
[OperationLog("管理员管理", "查询", Description = "查询管理员列表")]
|
||||
public async Task<ApiResponse<PagedResult<AdminAccountListDto>>> GetAdminList([FromQuery] AdminAccountQueryRequest request)
|
||||
{
|
||||
var result = await _adminAccountService.GetAdminListAsync(request);
|
||||
|
|
@ -51,6 +53,7 @@ public class AdminSystemController : ControllerBase
|
|||
/// 获取管理员详情
|
||||
/// </summary>
|
||||
[HttpGet("admins/{id}")]
|
||||
[OperationLog("管理员管理", "查看", Description = "查看管理员详情")]
|
||||
public async Task<ApiResponse<AdminAccountDetailDto>> GetAdminDetail(long id)
|
||||
{
|
||||
var result = await _adminAccountService.GetAdminDetailAsync(id);
|
||||
|
|
@ -61,6 +64,7 @@ public class AdminSystemController : ControllerBase
|
|||
/// 创建管理员
|
||||
/// </summary>
|
||||
[HttpPost("admins")]
|
||||
[OperationLog("管理员管理", "新增", Description = "创建管理员")]
|
||||
public async Task<ApiResponse<long>> CreateAdmin([FromBody] CreateAdminAccountRequest request)
|
||||
{
|
||||
var result = await _adminAccountService.CreateAdminAsync(request);
|
||||
|
|
@ -71,6 +75,7 @@ public class AdminSystemController : ControllerBase
|
|||
/// 更新管理员
|
||||
/// </summary>
|
||||
[HttpPut("admins/{id}")]
|
||||
[OperationLog("管理员管理", "修改", Description = "更新管理员")]
|
||||
public async Task<ApiResponse> UpdateAdmin(long id, [FromBody] UpdateAdminAccountRequest request)
|
||||
{
|
||||
var result = await _adminAccountService.UpdateAdminAsync(id, request);
|
||||
|
|
@ -81,6 +86,7 @@ public class AdminSystemController : ControllerBase
|
|||
/// 删除管理员
|
||||
/// </summary>
|
||||
[HttpDelete("admins/{id}")]
|
||||
[OperationLog("管理员管理", "删除", Description = "删除管理员")]
|
||||
public async Task<ApiResponse> DeleteAdmin(long id)
|
||||
{
|
||||
var operatorId = GetCurrentAdminId();
|
||||
|
|
@ -92,6 +98,7 @@ public class AdminSystemController : ControllerBase
|
|||
/// 重置管理员密码
|
||||
/// </summary>
|
||||
[HttpPost("admins/{id}/resetPassword")]
|
||||
[OperationLog("管理员管理", "修改", Description = "重置管理员密码", LogRequestParams = false)]
|
||||
public async Task<ApiResponse> ResetAdminPassword(long id, [FromBody] ResetPasswordRequest request)
|
||||
{
|
||||
var result = await _adminAccountService.ResetPasswordAsync(id, request.NewPassword);
|
||||
|
|
@ -102,6 +109,7 @@ public class AdminSystemController : ControllerBase
|
|||
/// 分配管理员角色
|
||||
/// </summary>
|
||||
[HttpPost("admins/{id}/roles")]
|
||||
[OperationLog("管理员管理", "修改", Description = "分配管理员角色")]
|
||||
public async Task<ApiResponse> AssignAdminRoles(long id, [FromBody] AssignAdminRolesRequest request)
|
||||
{
|
||||
var result = await _adminAccountService.AssignRolesAsync(id, request.RoleIds);
|
||||
|
|
@ -126,6 +134,7 @@ public class AdminSystemController : ControllerBase
|
|||
/// 获取角色列表
|
||||
/// </summary>
|
||||
[HttpGet("roles")]
|
||||
[OperationLog("角色管理", "查询", Description = "查询角色列表")]
|
||||
public async Task<ApiResponse<PagedResult<AdminRoleListDto>>> GetRoleList([FromQuery] AdminRoleQueryRequest request)
|
||||
{
|
||||
var result = await _adminRoleService.GetRoleListAsync(request);
|
||||
|
|
@ -156,6 +165,7 @@ public class AdminSystemController : ControllerBase
|
|||
/// 创建角色
|
||||
/// </summary>
|
||||
[HttpPost("roles")]
|
||||
[OperationLog("角色管理", "新增", Description = "创建角色")]
|
||||
public async Task<ApiResponse<long>> CreateRole([FromBody] CreateRoleRequest request)
|
||||
{
|
||||
var result = await _adminRoleService.CreateRoleAsync(request);
|
||||
|
|
@ -166,6 +176,7 @@ public class AdminSystemController : ControllerBase
|
|||
/// 更新角色
|
||||
/// </summary>
|
||||
[HttpPut("roles/{id}")]
|
||||
[OperationLog("角色管理", "修改", Description = "更新角色")]
|
||||
public async Task<ApiResponse> UpdateRole(long id, [FromBody] UpdateRoleRequest request)
|
||||
{
|
||||
var result = await _adminRoleService.UpdateRoleAsync(id, request);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Security.Claims;
|
||||
using XiangYi.AdminApi.Filters;
|
||||
using XiangYi.Application.DTOs.Requests;
|
||||
using XiangYi.Application.DTOs.Responses;
|
||||
using XiangYi.Application.Interfaces;
|
||||
|
|
@ -30,6 +31,7 @@ public class AdminUserController : ControllerBase
|
|||
/// <param name="request">查询请求</param>
|
||||
/// <returns>分页用户列表</returns>
|
||||
[HttpGet]
|
||||
[OperationLog("用户管理", "查询", Description = "查询用户列表")]
|
||||
public async Task<ApiResponse<PagedResult<AdminUserListDto>>> GetUserList([FromQuery] AdminUserQueryRequest request)
|
||||
{
|
||||
var result = await _adminUserService.GetUserListAsync(request);
|
||||
|
|
@ -42,6 +44,7 @@ public class AdminUserController : ControllerBase
|
|||
/// <param name="id">用户ID</param>
|
||||
/// <returns>用户详情</returns>
|
||||
[HttpGet("{id}")]
|
||||
[OperationLog("用户管理", "查看", Description = "查看用户详情")]
|
||||
public async Task<ApiResponse<AdminUserDetailDto>> GetUserDetail(long id)
|
||||
{
|
||||
var result = await _adminUserService.GetUserDetailAsync(id);
|
||||
|
|
@ -55,6 +58,7 @@ public class AdminUserController : ControllerBase
|
|||
/// <param name="request">状态更新请求</param>
|
||||
/// <returns>操作结果</returns>
|
||||
[HttpPut("{id}/status")]
|
||||
[OperationLog("用户管理", "修改", Description = "更新用户状态")]
|
||||
public async Task<ApiResponse> UpdateUserStatus(long id, [FromBody] UpdateUserStatusRequest request)
|
||||
{
|
||||
var adminId = GetCurrentAdminId();
|
||||
|
|
@ -79,6 +83,7 @@ public class AdminUserController : ControllerBase
|
|||
/// <param name="request">创建请求</param>
|
||||
/// <returns>创建的用户ID列表</returns>
|
||||
[HttpPost("test-users")]
|
||||
[OperationLog("用户管理", "新增", Description = "创建测试用户")]
|
||||
public async Task<ApiResponse<List<long>>> CreateTestUsers([FromBody] CreateTestUsersRequest request)
|
||||
{
|
||||
if (request.Count <= 0 || request.Count > 50)
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ public static class ValidationFilterExtensions
|
|||
return services.AddControllers(options =>
|
||||
{
|
||||
options.Filters.Add<ValidationFilter>();
|
||||
options.Filters.Add<OperationLogFilter>();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user