diff --git a/apps/web-antd/src/api/monitor/operlog/model.d.ts b/apps/web-antd/src/api/monitor/operlog/model.d.ts index 42bc5822..ffb3d16c 100644 --- a/apps/web-antd/src/api/monitor/operlog/model.d.ts +++ b/apps/web-antd/src/api/monitor/operlog/model.d.ts @@ -2,7 +2,7 @@ export interface OperationLog { operId: string; tenantId: string; title: string; - businessType: number; + businessType: string; businessTypes?: any; method: string; requestMethod: string; @@ -14,7 +14,7 @@ export interface OperationLog { operLocation: string; operParam: string; jsonResult: string; - status: number; + status: string; errorMsg: string; operTime: string; costTime: number; diff --git a/apps/web-antd/src/utils/render.tsx b/apps/web-antd/src/utils/render.tsx index 00770529..419daf31 100644 --- a/apps/web-antd/src/utils/render.tsx +++ b/apps/web-antd/src/utils/render.tsx @@ -116,7 +116,7 @@ export function renderHttpMethodTag(type: string) { return {title}; } -export function renderDictTag(value: string, dicts: DictData[]) { +export function renderDictTag(value: number | string, dicts: DictData[]) { return ; } @@ -155,7 +155,7 @@ export function renderDictTags( * @param dictName dictName * @returns tag */ -export function renderDict(value: string, dictName: string) { +export function renderDict(value: number | string, dictName: string) { const dictInfo = getDictOptions(dictName); return renderDictTag(value, dictInfo); } diff --git a/apps/web-antd/src/views/monitor/operlog/data.tsx b/apps/web-antd/src/views/monitor/operlog/data.tsx index d99cbe86..ee1bacea 100644 --- a/apps/web-antd/src/views/monitor/operlog/data.tsx +++ b/apps/web-antd/src/views/monitor/operlog/data.tsx @@ -1,17 +1,10 @@ import type { FormSchemaGetter } from '#/adapter/form'; import type { VxeGridProps } from '#/adapter/vxe-table'; -import type { DescItem } from '#/components/description'; import { DictEnum } from '@vben/constants'; -import { Tag } from 'ant-design-vue'; - import { getDictOptions } from '#/utils/dict'; -import { - renderDict, - renderHttpMethodTag, - renderJsonPreview, -} from '#/utils/render'; +import { renderDict } from '#/utils/render'; export const querySchema: FormSchemaGetter = () => [ { @@ -96,104 +89,3 @@ export const columns: VxeGridProps['columns'] = [ width: 120, }, ]; - -export const descSchema: DescItem[] = [ - { - field: 'operId', - label: '日志编号', - }, - { - field: 'status', - label: '操作结果', - render(value) { - return renderDict(value, DictEnum.SYS_COMMON_STATUS); - }, - }, - { - field: 'title', - label: '操作模块', - labelMinWidth: 80, - render(value, { businessType }) { - const operType = renderDict(businessType, DictEnum.SYS_OPER_TYPE); - return ( -
- {value} - {operType} -
- ); - }, - }, - { - field: 'operIp', - label: '操作信息', - render(_, data) { - return `账号: ${data.operName} / ${data.deptName} / ${data.operIp} / ${data.operLocation}`; - }, - }, - { - field: 'operUrl', - label: '请求信息', - render(_, data) { - const { operUrl, requestMethod } = data; - const methodTag = renderHttpMethodTag(requestMethod); - return ( - - {methodTag} {operUrl} - - ); - }, - }, - { - field: 'errorMsg', - label: '异常信息', - render(value) { - return {value}; - }, - show: (data) => { - return data && data.errorMsg !== ''; - }, - }, - { - field: 'method', - label: '方法', - }, - /** - * 默认word-break: break-word;会导致json预览样式异常 - */ - { - field: 'operParam', - label: '请求参数', - render(value) { - return ( -
- {renderJsonPreview(value)} -
- ); - }, - }, - { - field: 'jsonResult', - label: '响应参数', - render(value) { - return ( -
- {renderJsonPreview(value)} -
- ); - }, - show(data) { - return data && data.jsonResult; - }, - }, - { - field: 'costTime', - label: '耗时', - render(value) { - return `${value} ms`; - }, - }, - { - field: 'operTime', - label: '操作时间', - }, -]; diff --git a/apps/web-antd/src/views/monitor/operlog/operation-preview-drawer.vue b/apps/web-antd/src/views/monitor/operlog/operation-preview-drawer.vue index e924ccac..6831b8bb 100644 --- a/apps/web-antd/src/views/monitor/operlog/operation-preview-drawer.vue +++ b/apps/web-antd/src/views/monitor/operlog/operation-preview-drawer.vue @@ -1,32 +1,94 @@