feat: 使用 useDescription
This commit is contained in:
@@ -1,6 +1,13 @@
|
||||
import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { DescriptionItemSchema } from '#/components/description';
|
||||
|
||||
import { h } from 'vue';
|
||||
|
||||
import { JsonViewer } from '@vben/common-ui';
|
||||
import { formatDateTime } from '@vben/utils';
|
||||
|
||||
import { DictTag } from '#/components/dict-tag';
|
||||
import {
|
||||
DICT_TYPE,
|
||||
getDictOptions,
|
||||
@@ -121,3 +128,102 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 详情页的字段 */
|
||||
export function useDetailSchema(): DescriptionItemSchema[] {
|
||||
return [
|
||||
{
|
||||
field: 'id',
|
||||
label: '日志编号',
|
||||
},
|
||||
{
|
||||
field: 'traceId',
|
||||
label: '链路追踪',
|
||||
},
|
||||
{
|
||||
field: 'applicationName',
|
||||
label: '应用名',
|
||||
},
|
||||
{
|
||||
field: 'userId',
|
||||
label: '用户Id',
|
||||
},
|
||||
{
|
||||
field: 'userType',
|
||||
label: '用户类型',
|
||||
content: (data) => {
|
||||
return h(DictTag, {
|
||||
type: DICT_TYPE.USER_TYPE,
|
||||
value: data.userType,
|
||||
});
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'userIp',
|
||||
label: '用户IP',
|
||||
},
|
||||
{
|
||||
field: 'userAgent',
|
||||
label: '用户UA',
|
||||
},
|
||||
{
|
||||
field: 'requestMethod',
|
||||
label: '请求信息',
|
||||
content: (data) => {
|
||||
return `${data.requestMethod} ${data.requestUrl}`;
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'requestParams',
|
||||
label: '请求参数',
|
||||
content: (data) => {
|
||||
return h(JsonViewer, {
|
||||
value: data.requestParams,
|
||||
previewMode: true,
|
||||
});
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'exceptionTime',
|
||||
label: '异常时间',
|
||||
content: (data) => {
|
||||
return formatDateTime(data?.exceptionTime) as string;
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'exceptionName',
|
||||
label: '异常名',
|
||||
},
|
||||
{
|
||||
field: 'exceptionStackTrace',
|
||||
label: '异常堆栈',
|
||||
content: (data) => {
|
||||
return h(JsonViewer, {
|
||||
value: data.exceptionStackTrace,
|
||||
previewMode: true,
|
||||
});
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'processStatus',
|
||||
label: '处理状态',
|
||||
content: (data) => {
|
||||
return h(DictTag, {
|
||||
type: DICT_TYPE.INFRA_API_ERROR_LOG_PROCESS_STATUS,
|
||||
value: data?.processStatus,
|
||||
});
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'processUserId',
|
||||
label: '处理人',
|
||||
},
|
||||
{
|
||||
field: 'processTime',
|
||||
label: '处理时间',
|
||||
content: (data) => {
|
||||
return formatDateTime(data?.processTime) as string;
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user