index.js
7.24 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
class ConfigurationNodeApi {
/**
* @description 获取用户权限
*/
static getUserPermissions() {
return defHttp.get('/yt/role/me/permissions')
}
/**
* @description 获取组态信息
* @param {'CONFIGURE' | 'CONTENT' | 'NODE'} levelType - 组态资源类型
* @param {string} levelId - 组态资源ID
*/
static getConfigurationInfo( levelType, levelId) {
var configurationId = urlParams['configurationId']
return defHttp.get(`/yt/configuration/node/${configurationId}/${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=${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}`)
}
/**
* @description 获取设备物模型属性
* @param {*} deviceProfileId
* @param {*} dataType
* @returns
*/
static getDeviceAttribute(deviceProfileId, dataType) {
return defHttp.get(`/yt/device/attributes/${deviceProfileId}`, { params: { dataType } })
}
/**
* @description 获取产品
* @param {string} deviceType
* @returns
*/
static getProduct(deviceType) {
return defHttp.get('/yt/device_profile/me/list', { params: { deviceType } })
}
/**
* @description 获取满足条件的设备
* @param {{deviceLabel: string, deviceProfileId: string, deviceType: string, organizationId: string }} params
* @returns
*/
static getMeetConditionsDevice(params = {}) {
const { deviceLabel, deviceProfileId, deviceType, organizationId } = params
return defHttp.get('/yt/device/list', { params: { deviceLabel, deviceProfileId, deviceType, organizationId } })
}
/**
* @description 获取字典值
* @param {string} dictCode
* @returns
*/
static getDictionaryValue(dictCode) {
return defHttp.post('/yt/dict_item/find', { dictCode })
}
/**
* @description 获取设备配置详情通过id
* @param {string} id
* @returns
*/
static getDeviceProfileDetailById(id) {
return defHttp.get('/yt/device_profile/' + id)
}
/**
* @description 获取产品服务通过设备配置id
* @param {string} id
* @returns
*/
static getThingsModelServiceByDeviceProfileId(id) {
return defHttp.get('/yt/things_model/get_services/' + id)
}
static getFlvPlay(url, browserId) {
return `/api/yt/rtsp/openFlv?url=${encodeURIComponent(url)}&browserId=${browserId}`
}
static closeFlvPlay(url, browserId) {
return defHttp.get(`/yt/rtsp/closeFlv?url=${encodeURIComponent(url)}&browserId=${browserId}`)
}
/**
*
* @typedef {object} AlarmListRequestParamsType
* @property { number } page
* @property { number } pageSize
* @property { string } status
* @property { string } alarmType
* @property { string } severity
* @property { string[] } deviceIds
* @property { string } organizationId
* @property { string } deviceName
* @property { string } startTime
* @property { string } endTime
* @param {AlarmListRequestParamsType} params
* @returns
*/
static getAlarmList(params) {
return defHttp.post('/yt/alarm/configuration/page', params)
}
static getModbusCommand(params) {
return defHttp.post('/yt/js/modbus', params)
}
}