config.ts
3.31 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
import { FormSchema } from '/@/components/Table';
/**
* 所使用的枚举值
*/
export enum TriggerEnum {
IS_DEVICE_ACT = 'DEVICE_ACT',
IS_TIME_ACT = 'TIME_ACT',
IS_SCENE_ACT = 'SCENE_ACT',
}
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 formSchema: FormSchema[] = [
{
field: 'detail',
label: '条件类型',
colProps: { span: 24 },
component: 'Select',
componentProps: {
placeholder: '请选择报警日程表',
options: [
{ label: '简单', value: 'DEVICE_ACT' },
{ label: '持续时间', value: 'TIME_ACT' },
{ label: '重复', value: 'SCENE_ACT' },
],
},
},
{
field: 'type1',
label: '动态源类型',
colProps: { span: 24 },
component: 'Select',
componentProps: {
placeholder: '请选择动态源类型',
options: [
{ label: '无动态值', value: 'second' },
{ label: '当前租户', value: 'minute' },
{ label: '当前客户', value: 'hour' },
{ label: '当前设备', value: 'day' },
],
},
ifShow: ({ values }) => isWenDu(Reflect.get(values, 'detail')),
},
{
field: 'time1',
label: '源属性',
colProps: { span: 24 },
component: 'Input',
componentProps: {
placeholder: '源属性',
},
ifShow: ({ values }) => isWenDu(Reflect.get(values, 'detail')),
},
{
field: 'type1',
label: '动态源类型',
colProps: { span: 24 },
component: 'Select',
componentProps: {
placeholder: '请选择动态源类型',
options: [
{ label: '无动态值', value: 'second' },
{ label: '当前租户', value: 'minute' },
{ label: '当前客户', value: 'hour' },
{ label: '当前设备', value: 'day' },
],
},
ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')),
},
{
field: 'time1',
label: '源属性',
colProps: { span: 24 },
component: 'Input',
componentProps: {
placeholder: '源属性',
},
ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')),
},
{
field: 'time',
label: '持续时间值',
colProps: { span: 24 },
component: 'Input',
componentProps: {
placeholder: '请输入持续时间值',
},
ifShow: ({ values }) => isWenDu(Reflect.get(values, 'detail')),
},
{
field: 'r',
label: '时间单位',
colProps: { span: 24 },
component: 'Select',
componentProps: {
placeholder: '请选择报警日程表',
options: [
{ label: '秒', value: 'second' },
{ label: '分钟', value: 'minute' },
{ label: '小时', value: 'hour' },
{ label: '天', value: 'day' },
],
},
ifShow: ({ values }) => isWenDu(Reflect.get(values, 'detail')),
},
{
field: 'time',
label: '事件计数值必填',
colProps: { span: 24 },
component: 'Input',
componentProps: {
placeholder: '请输入事件计数值必填',
},
rules: [{ message: '事件计数应在1到2147483637之间', trigger: 'blur' }],
ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'detail')),
},
];