index.js
2.46 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
class ConfigurationNodeApi {
/**
* @description 获取组态信息
* @param {'CONFIGURE' | 'CONTENT' | 'NODE'} levelType - 组态资源类型
* @param {string} levelId - 组态资源ID
*/
static getConfigurationInfo(levelType, levelId) {
return defHttp.get(`/yt/configuration/node/${levelType}/${levelId}`)
}
/**
* @description 获取组织节点树
* @returns
*/
static getOrgTree() {
return defHttp.get('/yt/organization/me/list')
}
/**
* @description 通过设备ID 获取 设备属性
* @param tbDeviceId
* @returns {Promise<*>}
*/
static getDeviceAttr(tbDeviceId) {
return defHttp.get(`/plugins/telemetry/DEVICE/${tbDeviceId}/keys/timeseries`)
}
/**
* @description 获取组织下的设备
* @param {'DIRECT_CONNECTION' | 'GATEWAY' | 'SENDOR'} deviceType - 'DIRECT_CONNECTION' 直连设备 'GATEWAY' 网关设备 'SENDOR' 传感器
* @param {string} orgId - 组织ID
* @returns {Promise<*>}
*/
static getDeviceUnderTheOrg(deviceType, orgId) {
return defHttp.get(`/yt/device/list/${deviceType}?organizationId=${orgId}`)
}
/**
* @description 查询设备的子设备
* @param deviceId 设备ID
* @returns {Promise<*>}
*/
static getDeviceChildDevice(deviceId) {
return defHttp.get(`/yt/device/relation?page=1&pageSize=10&fromId=${deviceId}`)
}
/**
* @description 查询所有主设备列表
* @param orgId
* @returns {Promise<*>}
*/
static getMasterDevice(orgId) {
return defHttp.get(`/yt/device/list/master/${orgId}`)
}
/**
* @description 查询所有从设备
* @param orgId
* @param masterDeviceId
* @returns {Promise<*>}
*/
static getSlaveDevice(orgId, masterDeviceId) {
return defHttp.get(`/yt/device/list/slave/${orgId}?masterId=${masterDeviceId}`)
}
/**
* @description 编辑数据交互
*/
static updateNodeEvent(data) {
return defHttp.post('/yt/configuration/node/event', data)
}
/**
* @description 编辑动画效果
* @param {*} data
* @returns
*/
static updateNodeAct(data) {
return defHttp.post('/yt/configuration/node/act', data)
}
/**
* @description 更新节点绑定信息
* @param {*} data
* @returns
*/
static updateNodeInfo(data) {
return defHttp.post('/yt/configuration/node', data)
}
}