config.ts
3.53 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
import { FormSchema, BasicColumn } from '/@/components/Table';
/**
* 所使用的枚举值
*/
export enum TriggerEnum {
IS_DEVICE_ACT = '',
IS_TIME_ACT = 'TIME_SERIES',
IS_SCENE_ACT = 'CONSTANT',
}
export const isShiDu = (type: string) => {
return type === TriggerEnum.IS_DEVICE_ACT;
};
export const isWenDu = (type: string) => {
return type === TriggerEnum.IS_TIME_ACT;
};
export const isTimeAll = (type: string) => {
return type === TriggerEnum.IS_SCENE_ACT;
};
export const columns: BasicColumn[] = [
{
title: '键名',
dataIndex: 'key',
width: 200,
},
{
title: '键类型',
dataIndex: 'value',
width: 200,
},
];
export const formSchema: FormSchema[] = [
{
field: 'type',
label: '条件类型',
colProps: { span: 24 },
component: 'Select',
componentProps: {
placeholder: '请选择报警日程表',
options: [
{ label: '简单', value: '' },
{ label: '持续时间', value: 'TIME_SERIES' },
{ label: '重复', value: 'CONSTANT' },
],
},
},
{
field: 'valueType',
label: '动态源类型',
colProps: { span: 24 },
component: 'Select',
componentProps: {
placeholder: '请选择动态源类型',
options: [
{ label: '无动态值', value: '' },
{ label: '当前租户', value: 'CURRENT_CUSTOMER' },
{ label: '当前客户', value: 'CURRENT_CUSTOMER' },
{ label: '当前设备', value: 'CURRENT_DEVICE' },
],
},
ifShow: ({ values }) => isWenDu(Reflect.get(values, 'type')),
},
{
field: 'value',
label: '源属性',
colProps: { span: 24 },
component: 'Input',
componentProps: {
placeholder: '源属性',
},
ifShow: ({ values }) => isWenDu(Reflect.get(values, 'type')),
},
{
field: 'valueType',
label: '动态源类型',
colProps: { span: 24 },
component: 'Select',
componentProps: {
placeholder: '请选择动态源类型',
options: [
{ label: '无动态值', value: '' },
{ label: '当前租户', value: 'CURRENT_TENANT' },
{ label: '当前客户', value: 'CURRENT_CUSTOMER' },
{ label: '当前设备', value: 'CURRENT_DEVICE' },
],
},
ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')),
},
{
field: 'value',
label: '源属性',
colProps: { span: 24 },
component: 'Input',
componentProps: {
placeholder: '源属性',
},
ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')),
},
{
field: 'predicate',
label: '持续时间值',
colProps: { span: 24 },
component: 'Input',
componentProps: {
placeholder: '请输入持续时间值',
},
ifShow: ({ values }) => isWenDu(Reflect.get(values, 'type')),
},
{
field: 'spec',
label: '时间单位',
colProps: { span: 24 },
component: 'Select',
componentProps: {
placeholder: '请选择报警日程表',
options: [
{ label: '秒', value: 'SECONDS' },
{ label: '分钟', value: 'MINUTES' },
{ label: '小时', value: 'HOURS' },
{ label: '天', value: 'DAYS' },
],
},
ifShow: ({ values }) => isWenDu(Reflect.get(values, 'type')),
},
{
field: '',
label: '事件计数值必填',
colProps: { span: 24 },
component: 'Input',
componentProps: {
placeholder: '请输入事件计数值必填',
},
rules: [{ message: '事件计数应在1到2147483637之间', trigger: 'blur' }],
ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'type')),
},
];