@cpzxrobot/sdk 1.3.89 → 1.3.90
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 +5 -3
- package/dist/device_gateway.js +4 -2
- package/package.json +1 -1
package/device_gateway.ts
CHANGED
|
@@ -210,12 +210,13 @@ export class DeviceGateway extends Object {
|
|
|
210
210
|
* @param factoryId 工厂ID
|
|
211
211
|
* @returns Promise 包含报警规则列表
|
|
212
212
|
*/
|
|
213
|
-
list: async (factoryId
|
|
213
|
+
list: async (factoryId?: number): Promise<AlarmRuleListResponse> => {
|
|
214
214
|
const axios = await this.context.ready;
|
|
215
215
|
|
|
216
216
|
// 参数验证
|
|
217
217
|
if (!factoryId) {
|
|
218
|
-
|
|
218
|
+
let farm = await this.context.user.getSelectedFarm();
|
|
219
|
+
factoryId = farm?.id;
|
|
219
220
|
}
|
|
220
221
|
|
|
221
222
|
return axios.get(`/api/v2/device/stat/alarms/rule`, {
|
|
@@ -259,7 +260,8 @@ export class DeviceGateway extends Object {
|
|
|
259
260
|
|
|
260
261
|
// 参数验证
|
|
261
262
|
if (!request.factoryId) {
|
|
262
|
-
|
|
263
|
+
let farm = await this.context.user.getSelectedFarm();
|
|
264
|
+
request.factoryId = farm?.id;
|
|
263
265
|
}
|
|
264
266
|
if (!request.ruleName) {
|
|
265
267
|
throw new Error('规则名称不能为空');
|
package/dist/device_gateway.js
CHANGED
|
@@ -158,7 +158,8 @@ class DeviceGateway extends Object {
|
|
|
158
158
|
const axios = yield this.context.ready;
|
|
159
159
|
// 参数验证
|
|
160
160
|
if (!factoryId) {
|
|
161
|
-
|
|
161
|
+
let farm = yield this.context.user.getSelectedFarm();
|
|
162
|
+
factoryId = farm === null || farm === void 0 ? void 0 : farm.id;
|
|
162
163
|
}
|
|
163
164
|
return axios.get(`/api/v2/device/stat/alarms/rule`, {
|
|
164
165
|
params: { factoryId }
|
|
@@ -196,7 +197,8 @@ class DeviceGateway extends Object {
|
|
|
196
197
|
const axios = yield this.context.ready;
|
|
197
198
|
// 参数验证
|
|
198
199
|
if (!request.factoryId) {
|
|
199
|
-
|
|
200
|
+
let farm = yield this.context.user.getSelectedFarm();
|
|
201
|
+
request.factoryId = farm === null || farm === void 0 ? void 0 : farm.id;
|
|
200
202
|
}
|
|
201
203
|
if (!request.ruleName) {
|
|
202
204
|
throw new Error('规则名称不能为空');
|