index.js
4.38 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
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 {string} orgId
* @returns
*/
static getAllGatewayDeviceAndConnectionDevice(orgId) {
return defHttp.get(`/yt/device/list/master/${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)
}
/**
* @description 下发指令 单向
* @param {string} deviceId - tbDeviceId
* @param {object} data - 数据
*/
static sendInstructionOneWay(deviceId, data) {
return defHttp.post(`/rpc/oneway/${deviceId}`, data)
}
/**
* @description 下发指令 单向
* @param {string} deviceId - tbDeviceId
* @param {object} data - 数据
*/
static sendInstructionTwoWay(deviceId, data) {
return defHttp.post(`/rpc/twoway/${deviceId}`, data)
}
/**
* @description 下发指令
* @param {'oneway' | 'twoway'} way
* @param deviceId
* @param data
* @return {*}
*/
static sendInstruction(way, deviceId, data) {
return defHttp.post(`/rpc/${way}/${deviceId}`, data)
}
/**
* @description 判断设备是否在线
* @param deviceId
* @return {*}
*/
static deviceIsOnLine(deviceId) {
return defHttp.get(`/plugins/telemetry/DEVICE/${deviceId}/values/attributes?keys=active`)
}
/**
* @description 上传图片
* @param data
* @returns {*}
*/
static uploadImg(data) {
return defHttp.post('/yt/oss/upload', data)
}
/**
* @description 获取流媒体
* @param {number} page
* @param {number} pageSize
* @returns
*/
static getStreamingMediaList(organizationId, page = 1, pageSize = 100) {
return defHttp.get(`/yt/video`, { params: { organizationId, page, pageSize } })
}
/**
* @description 获取流媒体播放地址
* @param {string} id
* @returns
*/
static getStreamingVideoPlayUrl(id) {
return defHttp.get(`/yt/video/url/${id}`)
}
}