From e0378d8a7e05dbcdf685c7877822f9ac52966e4e Mon Sep 17 00:00:00 2001 From: Charles7c Date: Sun, 14 Apr 2024 22:51:33 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=B3=BB=E7=BB=9F=E7=AE=A1?= =?UTF-8?q?=E7=90=86/=E7=B3=BB=E7=BB=9F=E6=97=A5=E5=BF=97=20=3D>=20?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E7=9B=91=E6=8E=A7/=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/monitor/index.ts | 1 + src/apis/monitor/log.ts | 24 ++++ src/apis/monitor/type.ts | 37 +++++- src/apis/system/index.ts | 2 +- src/apis/system/log.ts | 22 ---- src/apis/system/type.ts | 37 ------ src/components/JsonPretty/index.vue | 30 +++-- .../{system => monitor}/log/LoginLog.vue | 42 +++---- .../{system => monitor}/log/OperationLog.vue | 42 +++---- .../monitor/log/OperationLogDetailDrawer.vue | 106 ++++++++++++++++++ src/views/{system => monitor}/log/index.vue | 14 ++- .../system/log/OperationLogDetailDrawer.vue | 105 ----------------- 12 files changed, 241 insertions(+), 221 deletions(-) create mode 100644 src/apis/monitor/log.ts delete mode 100644 src/apis/system/log.ts rename src/views/{system => monitor}/log/LoginLog.vue (88%) rename src/views/{system => monitor}/log/OperationLog.vue (90%) create mode 100644 src/views/monitor/log/OperationLogDetailDrawer.vue rename src/views/{system => monitor}/log/index.vue (82%) delete mode 100644 src/views/system/log/OperationLogDetailDrawer.vue diff --git a/src/apis/monitor/index.ts b/src/apis/monitor/index.ts index bbba779..176d5a3 100644 --- a/src/apis/monitor/index.ts +++ b/src/apis/monitor/index.ts @@ -1 +1,2 @@ export * from './online' +export * from './log' diff --git a/src/apis/monitor/log.ts b/src/apis/monitor/log.ts new file mode 100644 index 0000000..9a47cdb --- /dev/null +++ b/src/apis/monitor/log.ts @@ -0,0 +1,24 @@ +import http from '@/utils/http' +import type * as Monitor from './type' + +const BASE_URL = '/system/log' + +/** @desc 查询日志列表 */ +export function listLog(query: Monitor.LogPageQuery) { + return http.get>(`${BASE_URL}`, query) +} + +/** @desc 查询日志详情 */ +export function getLog(id: string) { + return http.get(`${BASE_URL}/${id}`) +} + +/** @desc 导出登录日志 */ +export function exportLoginLog(query: Monitor.LogQuery) { + return http.download(`${BASE_URL}/export/login`, query) +} + +/** @desc 导出操作日志 */ +export function exportOperationLog(query: Monitor.LogQuery) { + return http.download(`${BASE_URL}/export/operation`, query) +} diff --git a/src/apis/monitor/type.ts b/src/apis/monitor/type.ts index d77bc83..eff5cfa 100644 --- a/src/apis/monitor/type.ts +++ b/src/apis/monitor/type.ts @@ -13,8 +13,43 @@ export interface OnlineUserResp { createUserString: string createTime: string } - export interface OnlineUserQuery extends PageQuery { nickname?: string loginTime?: string } + +/** 系统日志类型 */ +export interface LogResp { + id: string + description: string + module: string + timeTaken: number + ip: string + address: string + browser: string + os: string + status: number + errorMsg: string + createUserString: string + createTime: string +} +export interface LogDetailResp extends LogResp { + traceId: string + requestUrl: string + requestMethod: string + requestHeaders: string + requestBody: string + statusCode: number + responseHeaders: string + responseBody: string +} +export interface LogQuery{ + description?: string + module?: string + ip?: string + createUserString?: string + createTime?: string + status?: number + sort: Array +} +export interface LogPageQuery extends PageQuery, LogQuery {} diff --git a/src/apis/system/index.ts b/src/apis/system/index.ts index 753dfaa..5844593 100644 --- a/src/apis/system/index.ts +++ b/src/apis/system/index.ts @@ -2,7 +2,7 @@ export * from './user' export * from './role' export * from './menu' export * from './dept' -export * from './log' +export * from '../monitor/log' export * from './dict' export * from './file' export * from './storage' diff --git a/src/apis/system/log.ts b/src/apis/system/log.ts deleted file mode 100644 index 15d0394..0000000 --- a/src/apis/system/log.ts +++ /dev/null @@ -1,22 +0,0 @@ -import http from '@/utils/http' -import type * as System from './type' - -const BASE_URL = '/system/log' - -/** @desc 查询日志列表 */ -export function listLog(query: System.PageLogQuery) { - return http.get>(`${BASE_URL}`, query) -} - -/** @desc 查询日志详情 */ -export function getLog(id: string) { - return http.get(`${BASE_URL}/${id}`) -} -/** @desc 导出日志列表 */ -export function exportLog(query: System.LogQuery) { - return http.download(`${BASE_URL}/export/login`, query) -} -/**@desc 导出操作日志 */ -export function exportOperateLog(query: System.LogQuery) { - return http.download(`${BASE_URL}/export/operation`, query) -} \ No newline at end of file diff --git a/src/apis/system/type.ts b/src/apis/system/type.ts index 30f0d96..8d0780a 100644 --- a/src/apis/system/type.ts +++ b/src/apis/system/type.ts @@ -119,43 +119,6 @@ export interface DeptQuery { sort: Array } -/** 系统日志类型 */ -export interface LogResp { - id: string - description: string - module: string - timeTaken: number - ip: string - address: string - browser: string - os: string - status: number - errorMsg: string - createUserString: string - createTime: string -} -export interface LogDetailResp extends LogResp { - traceId: string - requestUrl: string - requestMethod: string - requestHeaders: string - requestBody: string - statusCode: number - responseHeaders: string - responseBody: string -} -// 系统日志分页查询条件 -export interface PageLogQuery extends PageQuery,LogQuery{} -// 系统日志查询条件 -export interface LogQuery{ - description?: string - module?: string - ip?: string - createUserString?: string - createTime?: string - status?: number -} - /** 系统字典类型 */ export interface DictResp { id: string diff --git a/src/components/JsonPretty/index.vue b/src/components/JsonPretty/index.vue index e86b348..824782e 100644 --- a/src/components/JsonPretty/index.vue +++ b/src/components/JsonPretty/index.vue @@ -1,29 +1,35 @@ + + diff --git a/src/views/system/log/OperationLog.vue b/src/views/monitor/log/OperationLog.vue similarity index 90% rename from src/views/system/log/OperationLog.vue rename to src/views/monitor/log/OperationLog.vue index f4462b2..8e12de0 100644 --- a/src/views/system/log/OperationLog.vue +++ b/src/views/monitor/log/OperationLog.vue @@ -7,8 +7,8 @@ :scroll="{ x: '100%', y: '100%', minWidth: 1000 }" :pagination="pagination" column-resizable - @filterChange="filterChange" :disabledTools="['setting']" + @filterChange="filterChange" @refresh="search" > + + diff --git a/src/views/system/log/index.vue b/src/views/monitor/log/index.vue similarity index 82% rename from src/views/system/log/index.vue rename to src/views/monitor/log/index.vue index af3caf8..49aae76 100644 --- a/src/views/system/log/index.vue +++ b/src/views/monitor/log/index.vue @@ -1,12 +1,12 @@