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 + ')' + }} + + + + + + 详细 + + + + + + + + + + + +