config.ts
1.96 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
import cloneDeep from 'lodash-es/cloneDeep';
import { SwitchListConfig } from '.';
import {
ConfigType,
CreateComponentType,
PublicComponentOptions,
PublicPresetOptions,
} from '/@/views/visual/packages/index.type';
import { PublicConfigClass, componentInitConfig } from '/@/views/visual/packages/publicConfig';
import { ComponentConfigFieldEnum } from '../../../enum';
import { buildUUID } from '/@/utils/uuid';
export interface SwitchItemType extends Recordable {
id: string;
checked: boolean;
deviceId?: string;
deviceProfileId?: string;
attribute?: string;
deviceName?: string;
attributeName?: string;
openCommand?: string;
closeCommand?: string;
openService?: string;
closeService?: string;
}
export const DEFAULT_VALUE: SwitchItemType[] = [
{
deviceName: '光照设备',
attributeName: '光照',
icon: 'zongfushe',
unit: 'kw',
iconColor: '#367BFF',
fontColor: '#357CFB',
checked: false,
fontSize: 16,
id: buildUUID(),
},
{
value: 53.7,
deviceName: '风机设备',
attributeName: '风机',
icon: 'guangzhaoqiangdu',
unit: '℃',
iconColor: '#FFA000',
fontColor: '#FFA000',
checked: true,
fontSize: 16,
id: buildUUID(),
},
];
export const option: PublicPresetOptions = {
multipleDataSourceComponent: true,
[ComponentConfigFieldEnum.ICON]: 'shuiwen',
[ComponentConfigFieldEnum.ICON_COLOR]: '#377DFF',
[ComponentConfigFieldEnum.SHOW_DEVICE_NAME]: false,
[ComponentConfigFieldEnum.FONT_SIZE]: 14,
[ComponentConfigFieldEnum.PASS_WORD]: '',
};
export default class Config extends PublicConfigClass implements CreateComponentType {
public key: string = SwitchListConfig.key;
public attr = { ...componentInitConfig };
public componentConfig: ConfigType = cloneDeep(SwitchListConfig);
public persetOption = cloneDeep(option);
public option: PublicComponentOptions;
constructor(option: PublicComponentOptions) {
super();
this.option = { ...option };
}
}