config.ts
1.89 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import { Tag } from 'ant-design-vue';
import { h } from 'vue';
import { findDictItemByCode } from '/@/api/system/dict';
import { BasicColumn, FormSchema } from '/@/components/Table';
import { formatToDateTime } from '/@/utils/dateUtil';
enum EventType {
ERROR = 'ERROR',
INFO = 'INFO',
ALERT = 'ALERT',
}
enum EventTypeColor {
ERROR = 'error',
INFO = 'success',
ALERT = 'warning',
}
enum EventTypeName {
ERROR = '故障',
INFO = '信息',
ALERT = '告警',
}
export const columnSchema: BasicColumn[] = [
{
title: '时间',
dataIndex: 'eventTime',
format(text) {
return formatToDateTime(text, 'YYYY-MM-DD HH:mm:ss');
},
},
{
title: '标识符',
dataIndex: 'eventIdentifier',
helpMessage: ['标识符格式为模块标识符: 功能定义标识符'],
},
{
title: '事件名称',
dataIndex: 'eventName',
},
{
title: '事件类型',
dataIndex: 'eventType',
customRender({ text }) {
return h(
Tag,
{
color: EventTypeColor[text as EventType],
},
() => EventTypeName[text as EventType]
);
},
},
{
title: '输出参数',
dataIndex: 'outputParams',
slots: { customRender: 'outputParams' },
},
];
export const formSchemas: FormSchema[] = [
{
field: 'eventIdentifier',
label: '标识符',
component: 'Input',
componentProps: {
placeholder: '请输入标识符',
},
},
{
field: 'eventType',
label: '告警类型',
component: 'ApiSelect',
componentProps: {
placeholder: '请选择事件类型',
api: findDictItemByCode,
params: {
dictCode: 'event_type',
},
labelField: 'itemText',
valueField: 'itemValue',
},
},
{
field: 'dateRange',
label: '时间范围',
component: 'RangePicker',
colProps: { span: 10 },
componentProps: {
showTime: true,
},
},
];