config.ts
880 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { Tag } from 'ant-design-vue';
import { BasicColumn } from '/@/components/Table';
import { formatToDateTime } from '/@/utils/dateUtil';
import { h } from 'vue';
// 表格配置
export const columns: BasicColumn[] = [
{
title: '事件时间',
dataIndex: 'createdTime',
format(text) {
return formatToDateTime(text, 'YYYY-MM-DD HH:mm:ss');
},
},
{
title: '服务器',
dataIndex: 'body.server',
},
{
title: '事件',
dataIndex: 'body.event',
},
{
title: '状态',
dataIndex: 'body.success',
customRender: ({ record }) => {
const color = record.body.success ? 'success' : 'error';
const text = record.body.success ? '成功' : '失败';
return h(Tag, { color: color }, () => text);
},
},
{
title: '错误',
dataIndex: 'error',
slots: { customRender: 'errorDetail' },
},
];