control.config.ts
1.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
import { DataComponentRecord, DataSource } from '/@/api/dataBoard/model';
import { DeviceTypeEnum } from '/@/api/device/model/deviceModel';
export interface ControlComponentLayout {
[key: string]: any;
}
export interface ControlComponentValue {
value?: boolean;
attribute?: string;
attributeRename?: string;
icon?: string;
iconColor?: string;
deviceId?: string;
fontColor?: string;
slaveDeviceId?: string;
deviceProfileId?: string;
deviceType?: DeviceTypeEnum;
organizationId?: string;
dataSource?: DataSource;
[key: string]: any;
}
export const ControlComponentDefaultConfig: ControlComponentValue = {
icon: 'shuiwen',
iconColor: '#367BFF',
fontColor: '#000',
};
export const transformControlConfig = (
_ComponentConfig: Recordable,
_record: DataComponentRecord,
dataSourceRecord: DataSource
) => {
return {
value: {
...dataSourceRecord.componentInfo,
attribute: dataSourceRecord.attribute,
attributeRename: dataSourceRecord.attributeRename,
deviceProfileId: dataSourceRecord.deviceProfileId,
deviceId: dataSourceRecord.deviceId,
deviceType: dataSourceRecord.deviceType,
slaveDeviceId: dataSourceRecord.slaveDeviceId,
organizationId: dataSourceRecord.organizationId,
dataSource: dataSourceRecord,
} as ControlComponentValue,
};
};