From 98b9bdd4fa695a291b8a01def5626fbb48cb5fe2 Mon Sep 17 00:00:00 2001 From: dtsz <314942997@qq.com> Date: Thu, 23 Mar 2023 13:21:01 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix=EF=BC=9A=E6=9D=83=E9=99=90=E6=A0=87?= =?UTF-8?q?=E8=AF=86=E5=90=8D=E7=A7=B0=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/infra/apiErrorLog/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/infra/apiErrorLog/index.vue b/src/views/infra/apiErrorLog/index.vue index 1108651a..cfe4adb1 100644 --- a/src/views/infra/apiErrorLog/index.vue +++ b/src/views/infra/apiErrorLog/index.vue @@ -118,7 +118,7 @@ link type="primary" @click="openDetail(scope.row)" - v-hasPermi="['infra:api-access-log:query']" + v-hasPermi="['infra:api-error-log:query']" > 详细 From aad57e2840b02f5c5a096e3085a28a0ea8fde8fc Mon Sep 17 00:00:00 2001 From: dtsz <314942997@qq.com> Date: Thu, 23 Mar 2023 13:21:38 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=AE=BF=E9=97=AE=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/infra/apiAccessLog/index.ts | 25 +- .../infra/apiAccessLog/ApiAccessLogDetail.vue | 66 +++++ .../infra/apiAccessLog/apiAccessLog.data.ts | 74 ----- src/views/infra/apiAccessLog/index.vue | 261 ++++++++++++++---- 4 files changed, 278 insertions(+), 148 deletions(-) create mode 100644 src/views/infra/apiAccessLog/ApiAccessLogDetail.vue delete mode 100644 src/views/infra/apiAccessLog/apiAccessLog.data.ts diff --git a/src/api/infra/apiAccessLog/index.ts b/src/api/infra/apiAccessLog/index.ts index b46199e4..25997c67 100644 --- a/src/api/infra/apiAccessLog/index.ts +++ b/src/api/infra/apiAccessLog/index.ts @@ -18,33 +18,12 @@ export interface ApiAccessLogVO { resultMsg: string createTime: Date } - -export interface ApiAccessLogPageReqVO extends PageParam { - userId?: number - userType?: number - applicationName?: string - requestUrl?: string - beginTime?: Date[] - duration?: number - resultCode?: number -} - -export interface ApiAccessLogExportReqVO { - userId?: number - userType?: number - applicationName?: string - requestUrl?: string - beginTime?: Date[] - duration?: number - resultCode?: number -} - // 查询列表API 访问日志 -export const getApiAccessLogPageApi = (params: ApiAccessLogPageReqVO) => { +export const getApiAccessLogPage = (params: PageParam) => { return request.get({ url: '/infra/api-access-log/page', params }) } // 导出API 访问日志 -export const exportApiAccessLogApi = (params: ApiAccessLogExportReqVO) => { +export const exportApiAccessLog = (params) => { return request.download({ url: '/infra/api-access-log/export-excel', params }) } diff --git a/src/views/infra/apiAccessLog/ApiAccessLogDetail.vue b/src/views/infra/apiAccessLog/ApiAccessLogDetail.vue new file mode 100644 index 00000000..d70c7ec7 --- /dev/null +++ b/src/views/infra/apiAccessLog/ApiAccessLogDetail.vue @@ -0,0 +1,66 @@ + + + + + {{ detailData.id }} + + + {{ detailData.traceId }} + + + {{ detailData.applicationName }} + + + {{ detailData.userId }} | + + | {{ detailData.userIp }} | {{ detailData.userAgent }} + + + {{ detailData.requestMethod }} | {{ detailData.requestUrl }} + + + {{ detailData.requestParams }} + + + {{ formatDate(detailData.beginTime, 'YYYY-MM-DD HH:mm:ss') }} ~ + {{ formatDate(detailData.endTime, 'YYYY-MM-DD HH:mm:ss') }} | {{ detailData.duration }} ms + + + 正常 + 失败 | {{ detailData.resultCode }} | {{ detailData.resultMsg }} + + + + + + diff --git a/src/views/infra/apiAccessLog/apiAccessLog.data.ts b/src/views/infra/apiAccessLog/apiAccessLog.data.ts deleted file mode 100644 index cb9e97a7..00000000 --- a/src/views/infra/apiAccessLog/apiAccessLog.data.ts +++ /dev/null @@ -1,74 +0,0 @@ -import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas' - -// CrudSchema -const crudSchemas = reactive({ - primaryKey: 'id', - primaryType: 'id', - primaryTitle: '日志编号', - action: true, - actionWidth: '80px', - columns: [ - { - title: '链路追踪', - field: 'traceId', - isTable: false - }, - { - title: '用户编号', - field: 'userId', - isSearch: true - }, - { - title: '用户类型', - field: 'userType', - dictType: DICT_TYPE.USER_TYPE, - dictClass: 'number', - isSearch: true - }, - { - title: '应用名', - field: 'applicationName', - isSearch: true - }, - { - title: '请求方法名', - field: 'requestMethod' - }, - { - title: '请求地址', - field: 'requestUrl', - isSearch: true - }, - { - title: '请求时间', - field: 'beginTime', - formatter: 'formatDate', - search: { - show: true, - itemRender: { - name: 'XDataTimePicker' - } - } - }, - { - title: '执行时长', - field: 'duration', - table: { - slots: { - default: 'duration_default' - } - } - }, - { - title: '操作结果', - field: 'resultCode', - isSearch: true, - table: { - slots: { - default: 'resultCode_default' - } - } - } - ] -}) -export const { allSchemas } = useVxeCrudSchemas(crudSchemas) diff --git a/src/views/infra/apiAccessLog/index.vue b/src/views/infra/apiAccessLog/index.vue index 6a09927d..1b433eb6 100644 --- a/src/views/infra/apiAccessLog/index.vue +++ b/src/views/infra/apiAccessLog/index.vue @@ -1,62 +1,221 @@ - - - - - {{ row.duration + 'ms' }} - - - {{ row.resultCode === 0 ? '成功' : '失败(' + row.resultMsg + ')' }} - - - - + + + + - - - - - - - - {{ row.duration + 'ms' }} - - - {{ row.resultCode === 0 ? '成功' : '失败(' + row.resultMsg + ')' }} - - - - - - - + + + + + + + + + + + + + + + + + + + + 搜索 + 重置 + + 导出 + + + + + + + + + + + + + + + + + + + + {{ formatDate(scope.row.beginTime, 'YYYY-MM-DD HH:mm:ss') }} + + + + + {{ scope.row.duration }} ms + + + + + {{ + scope.row.resultCode === 0 ? '成功' : '失败(' + scope.row.resultMsg + ')' + }} + + + + + + 详细 + + + + + + + + + + + +