From fd4bc8ccf4fd824bc3d7244dd962de455878002a Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Mon, 21 Nov 2022 15:27:06 +0800 Subject: [PATCH] refactor: vxe --- .../src/api/infra/apiAccessLog/index.ts | 15 ++ .../src/api/infra/apiAccessLog/types.ts | 14 -- .../src/api/infra/apiErrorLog/index.ts | 18 ++ .../src/api/infra/apiErrorLog/types.ts | 17 -- .../vxeTable/renderer/dataTimePicker.tsx | 1 + .../infra/apiAccessLog/apiAccessLog.data.ts | 150 +++++++------- .../src/views/infra/apiAccessLog/index.vue | 106 ++++------ .../infra/apiErrorLog/apiErrorLog.data.ts | 162 +++++++-------- .../src/views/infra/apiErrorLog/index.vue | 185 ++++++++---------- .../views/system/errorCode/errorCode.data.ts | 2 +- 10 files changed, 298 insertions(+), 372 deletions(-) delete mode 100644 yudao-ui-admin-vue3/src/api/infra/apiAccessLog/types.ts delete mode 100644 yudao-ui-admin-vue3/src/api/infra/apiErrorLog/types.ts diff --git a/yudao-ui-admin-vue3/src/api/infra/apiAccessLog/index.ts b/yudao-ui-admin-vue3/src/api/infra/apiAccessLog/index.ts index e058abd21..761b13f18 100644 --- a/yudao-ui-admin-vue3/src/api/infra/apiAccessLog/index.ts +++ b/yudao-ui-admin-vue3/src/api/infra/apiAccessLog/index.ts @@ -1,5 +1,20 @@ import request from '@/config/axios' +export interface ApiAccessLogVO { + id: number + traceId: string + userId: string + userType: string + applicationName: string + requestMethod: string + requestParams: string + requestUrl: string + beginTime: string + endTIme: string + duration: string + resultCode: number +} + // 查询列表API 访问日志 export const getApiAccessLogPageApi = (params) => { return request.get({ url: '/infra/api-access-log/page', params }) diff --git a/yudao-ui-admin-vue3/src/api/infra/apiAccessLog/types.ts b/yudao-ui-admin-vue3/src/api/infra/apiAccessLog/types.ts deleted file mode 100644 index 5e2a42c98..000000000 --- a/yudao-ui-admin-vue3/src/api/infra/apiAccessLog/types.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type ApiAccessLogVO = { - id: number - traceId: string - userId: string - userType: string - applicationName: string - requestMethod: string - requestParams: string - requestUrl: string - beginTime: string - endTIme: string - duration: string - resultCode: number -} diff --git a/yudao-ui-admin-vue3/src/api/infra/apiErrorLog/index.ts b/yudao-ui-admin-vue3/src/api/infra/apiErrorLog/index.ts index e38a1de88..fb249d540 100644 --- a/yudao-ui-admin-vue3/src/api/infra/apiErrorLog/index.ts +++ b/yudao-ui-admin-vue3/src/api/infra/apiErrorLog/index.ts @@ -1,5 +1,23 @@ import request from '@/config/axios' +export interface ApiErrorLogVO { + id: number + userId: string + userIp: string + userAgent: string + userType: string + applicationName: string + requestMethod: string + requestParams: string + requestUrl: string + exceptionTime: string + exceptionName: string + exceptionStackTrace: string + processUserId: string + processStatus: number + resultCode: number +} + // 查询列表API 访问日志 export const getApiErrorLogPageApi = (params) => { return request.get({ url: '/infra/api-error-log/page', params }) diff --git a/yudao-ui-admin-vue3/src/api/infra/apiErrorLog/types.ts b/yudao-ui-admin-vue3/src/api/infra/apiErrorLog/types.ts deleted file mode 100644 index dfc871032..000000000 --- a/yudao-ui-admin-vue3/src/api/infra/apiErrorLog/types.ts +++ /dev/null @@ -1,17 +0,0 @@ -export type ApiErrorLogVO = { - id: number - userId: string - userIp: string - userAgent: string - userType: string - applicationName: string - requestMethod: string - requestParams: string - requestUrl: string - exceptionTime: string - exceptionName: string - exceptionStackTrace: string - processUserId: string - processStatus: number - resultCode: number -} diff --git a/yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/dataTimePicker.tsx b/yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/dataTimePicker.tsx index 819c1aaac..5bab45d68 100644 --- a/yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/dataTimePicker.tsx +++ b/yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/dataTimePicker.tsx @@ -13,6 +13,7 @@ VXETable.renderer.add('XDataTimePicker', { ([ - { - label: t('common.index'), - field: 'id', - type: 'index' - }, - { - label: '链路追踪', - field: 'traceId' - }, - { - label: '用户编号', - field: 'userId', - search: { - show: true - } - }, - { - label: '用户类型', - field: 'userType', - dictType: DICT_TYPE.USER_TYPE, - dictClass: 'number', - search: { - show: true - } - }, - { - label: '应用名', - field: 'applicationName', - search: { - show: true - } - }, - { - label: '请求方法名', - field: 'requestMethod' - }, - { - label: '请求地址', - field: 'requestUrl', - search: { - show: true - } - }, - { - label: '请求时间', - field: 'beginTime', - search: { - show: true, - component: 'DatePicker', - componentProps: { - type: 'datetimerange', - valueFormat: 'YYYY-MM-DD HH:mm:ss', - defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)] +const crudSchemas = reactive({ + primaryKey: 'id', + primaryType: 'seq', + action: true, + actionWidth: '80px', + columns: [ + { + title: '链路追踪', + field: 'traceId' + }, + { + 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' + } } } - }, - { - label: '执行时长', - field: 'duration' - }, - { - label: '操作结果', - field: 'resultCode', - search: { - show: true - } - }, - { - label: t('table.action'), - field: 'action', - width: '300px', - form: { - show: false - }, - detail: { - show: false - } - } -]) -export const { allSchemas } = useCrudSchemas(crudSchemas) + ] +}) +export const { allSchemas } = useVxeCrudSchemas(crudSchemas) diff --git a/yudao-ui-admin-vue3/src/views/infra/apiAccessLog/index.vue b/yudao-ui-admin-vue3/src/views/infra/apiAccessLog/index.vue index fa8317905..a05c1b0e2 100644 --- a/yudao-ui-admin-vue3/src/views/infra/apiAccessLog/index.vue +++ b/yudao-ui-admin-vue3/src/views/infra/apiAccessLog/index.vue @@ -1,80 +1,24 @@ - -