@cpzxrobot/sdk 1.3.104 → 1.3.105
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/device_gateway.ts +21 -0
- package/dist/device_gateway.js +18 -0
- package/package.json +1 -1
package/device_gateway.ts
CHANGED
|
@@ -355,6 +355,27 @@ export class DeviceGateway extends Object {
|
|
|
355
355
|
});
|
|
356
356
|
},
|
|
357
357
|
|
|
358
|
+
/**
|
|
359
|
+
* 激活报警规则
|
|
360
|
+
* @param request 激活报警规则的请求参数
|
|
361
|
+
* @returns Promise 包含激活结果
|
|
362
|
+
*/
|
|
363
|
+
deactiveAlarmRule: async (request: ActiveAlarmRuleRequest): Promise<ActiveAlarmRuleResponse> => {
|
|
364
|
+
const axios = await this.context.ready;
|
|
365
|
+
|
|
366
|
+
// 参数验证
|
|
367
|
+
if (!request.id) {
|
|
368
|
+
throw new Error('规则ID不能为空');
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
return axios.post(`/api/v2/device/stat/alarms/rule/deactivate`, request).then((res) => {
|
|
372
|
+
if (res.data.code !== 200) {
|
|
373
|
+
throw new Error(res.data.message || '停用报警规则失败');
|
|
374
|
+
}
|
|
375
|
+
return res.data;
|
|
376
|
+
});
|
|
377
|
+
},
|
|
378
|
+
|
|
358
379
|
/**
|
|
359
380
|
* 获取已激活工厂列表
|
|
360
381
|
* @param ruleId 规则ID
|
package/dist/device_gateway.js
CHANGED
|
@@ -270,6 +270,24 @@ class DeviceGateway extends Object {
|
|
|
270
270
|
return res.data;
|
|
271
271
|
});
|
|
272
272
|
}),
|
|
273
|
+
/**
|
|
274
|
+
* 激活报警规则
|
|
275
|
+
* @param request 激活报警规则的请求参数
|
|
276
|
+
* @returns Promise 包含激活结果
|
|
277
|
+
*/
|
|
278
|
+
deactiveAlarmRule: (request) => __awaiter(this, void 0, void 0, function* () {
|
|
279
|
+
const axios = yield this.context.ready;
|
|
280
|
+
// 参数验证
|
|
281
|
+
if (!request.id) {
|
|
282
|
+
throw new Error('规则ID不能为空');
|
|
283
|
+
}
|
|
284
|
+
return axios.post(`/api/v2/device/stat/alarms/rule/deactivate`, request).then((res) => {
|
|
285
|
+
if (res.data.code !== 200) {
|
|
286
|
+
throw new Error(res.data.message || '停用报警规则失败');
|
|
287
|
+
}
|
|
288
|
+
return res.data;
|
|
289
|
+
});
|
|
290
|
+
}),
|
|
273
291
|
/**
|
|
274
292
|
* 获取已激活工厂列表
|
|
275
293
|
* @param ruleId 规则ID
|