config.ts
1.69 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
import { FormSchema, useComponentRegister } from '/@/components/Form';
import { OrgTreeSelect } from '/@/views/common/OrgTreeSelect';
useComponentRegister('OrgTreeSelect', OrgTreeSelect);
export enum FormFieldsEnum {
  NAME = 'name',
  ORGANIZATION_ID = 'organizationId',
  DESCRIPTION = 'description',
}
export enum FormFieldsNameEnum {
  NAME = '场景联动名称',
  ORGANIZATION_ID = '所属组织',
  DESCRIPTION = '描述',
}
export const getFormSchemas = (
  onOrgTreeSelectChange: Fn,
  onOrgTreeSelectOptionsChange: Fn
): FormSchema[] => {
  return [
    {
      field: FormFieldsEnum.NAME,
      component: 'Input',
      label: FormFieldsNameEnum.NAME,
      required: true,
      componentProps: {
        placeholder: `请输入${FormFieldsNameEnum.NAME}`,
      },
    },
    {
      field: FormFieldsEnum.ORGANIZATION_ID,
      component: 'OrgTreeSelect',
      label: FormFieldsNameEnum.ORGANIZATION_ID,
      required: true,
      componentProps: {
        placeholder: `请输入${FormFieldsNameEnum.NAME}`,
        onChange: onOrgTreeSelectChange,
        onOptionsChange: onOrgTreeSelectOptionsChange,
      },
    },
    {
      field: FormFieldsEnum.DESCRIPTION,
      component: 'InputTextArea',
      label: FormFieldsNameEnum.DESCRIPTION,
      componentProps: {
        placeholder: `请输入${FormFieldsNameEnum.DESCRIPTION}`,
      },
    },
    {
      field: 'flipFlop',
      component: 'Input',
      label: '',
      slot: 'flipFlop',
    },
    {
      field: 'executionCondition',
      component: 'Input',
      label: '',
      slot: 'executionCondition',
    },
    {
      field: 'executionAction',
      component: 'Input',
      label: '',
      slot: 'executionAction',
    },
  ];
};