config.ts
2.22 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
import { TaskTargetEnum } from '../../config';
import { FormSchema } from '/@/components/Form';
export enum FormFieldsEnum {
RUN_TARGET_TYPE = 'runTargetType',
TASK_TYPE = 'taskType',
ASSIGN_TARGET = 'assignTarget',
TASK_TARGET_TYPE = 'taskTargetType',
TASK_TARGET_VALUE = 'taskTargetValue',
}
export enum TargetType {
ALL = 'ALL',
ASSIGN = 'ASSIGN',
}
export enum TargetNameType {
ALL = '所有目标设备',
ASSIGN = '指定目标设备',
}
export const formSchemas: FormSchema[] = [
{
field: 'taskName',
component: 'Input',
label: '任务名称',
slot: 'taskName',
},
{
field: FormFieldsEnum.TASK_TYPE,
component: 'Input',
label: '任务类型',
slot: 'taskType',
},
{
field: FormFieldsEnum.TASK_TARGET_TYPE,
component: 'Input',
label: '目标类型',
show: false,
},
{
field: FormFieldsEnum.TASK_TARGET_VALUE,
component: 'Input',
label: '目标值',
show: false,
},
{
field: FormFieldsEnum.TASK_TYPE,
component: 'Input',
label: '任务类型',
renderComponentContent: 'taskType',
show: false,
},
{
field: FormFieldsEnum.RUN_TARGET_TYPE,
component: 'RadioGroup',
label: '选择目标类型',
helpMessage: [
'您可以对该任务关联的所有设备批量执行任务,也可以指定其中的一个或多个关联的设备来执行任务。',
],
defaultValue: TargetType.ALL,
componentProps: {
options: [
{ label: TargetNameType.ALL, value: TargetType.ALL },
{ label: TargetNameType.ASSIGN, value: TargetType.ASSIGN },
],
},
},
{
field: FormFieldsEnum.ASSIGN_TARGET,
component: 'ApiSelect',
label: '制定目标设备',
ifShow: ({ model }) => model[FormFieldsEnum.RUN_TARGET_TYPE] === TargetType.ASSIGN,
componentProps: ({ formModel }) => {
const taskTargetType = formModel[FormFieldsEnum.TASK_TARGET_TYPE];
const isDevices = taskTargetType === TaskTargetEnum.DEVICES;
return {
api: async () => {
try {
if (isDevices) {
} else {
}
} catch (error) {
return [];
}
},
getPopupContainer: () => document.body,
};
},
},
];