@cpzxrobot/sdk 1.3.91 → 1.3.93
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 +15 -2
- package/dist/device_gateway.js +13 -0
- package/dist/mobile_platform.js +3 -0
- package/dist/web_platform.js +6 -0
- package/dist/windows_platform.js +3 -0
- package/mobile_platform.ts +5 -0
- package/package.json +1 -1
- package/platform_interface.ts +2 -0
- package/web_platform.ts +6 -0
- package/windows_platform.ts +3 -0
package/device_gateway.ts
CHANGED
|
@@ -216,7 +216,7 @@ export class DeviceGateway extends Object {
|
|
|
216
216
|
// 参数验证
|
|
217
217
|
if (!factoryId) {
|
|
218
218
|
let farm = await this.context.user.getSelectedFarm();
|
|
219
|
-
factoryId = farm?.id || 0;
|
|
219
|
+
factoryId = farm?.id || 0;
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
return axios.get(`/api/v2/device/stat/alarms/rule`, {
|
|
@@ -280,6 +280,19 @@ export class DeviceGateway extends Object {
|
|
|
280
280
|
return res.data;
|
|
281
281
|
});
|
|
282
282
|
},
|
|
283
|
+
/**
|
|
284
|
+
* 删除报警规则
|
|
285
|
+
* @param id - 报警规则ID
|
|
286
|
+
*/
|
|
287
|
+
delete: async (id: number): Promise<any> => {
|
|
288
|
+
const axios = await this.context.ready;
|
|
289
|
+
return axios.delete(`/api/v2/device/stat/alarms/rule/${id}`).then((res) => {
|
|
290
|
+
if (res.data.code !== 200) {
|
|
291
|
+
throw new Error(res.data.message || '删除报警规则失败');
|
|
292
|
+
}
|
|
293
|
+
return res.data;
|
|
294
|
+
});
|
|
295
|
+
},
|
|
283
296
|
};
|
|
284
297
|
}
|
|
285
298
|
|
|
@@ -1264,7 +1277,7 @@ export class DeviceGateway extends Object {
|
|
|
1264
1277
|
params.duration = args.duration;
|
|
1265
1278
|
}
|
|
1266
1279
|
if (args.hourMode !== undefined) {
|
|
1267
|
-
params.perHour = args.hourMode;
|
|
1280
|
+
params.perHour = args.hourMode;
|
|
1268
1281
|
}
|
|
1269
1282
|
|
|
1270
1283
|
return axios.get(`/api/v2/device/stat/alarms/trend`, {
|
package/dist/device_gateway.js
CHANGED
|
@@ -212,6 +212,19 @@ class DeviceGateway extends Object {
|
|
|
212
212
|
return res.data;
|
|
213
213
|
});
|
|
214
214
|
}),
|
|
215
|
+
/**
|
|
216
|
+
* 删除报警规则
|
|
217
|
+
* @param id - 报警规则ID
|
|
218
|
+
*/
|
|
219
|
+
delete: (id) => __awaiter(this, void 0, void 0, function* () {
|
|
220
|
+
const axios = yield this.context.ready;
|
|
221
|
+
return axios.delete(`/api/v2/device/stat/alarms/rule/${id}`).then((res) => {
|
|
222
|
+
if (res.data.code !== 200) {
|
|
223
|
+
throw new Error(res.data.message || '删除报警规则失败');
|
|
224
|
+
}
|
|
225
|
+
return res.data;
|
|
226
|
+
});
|
|
227
|
+
}),
|
|
215
228
|
};
|
|
216
229
|
}
|
|
217
230
|
constructor(context) {
|
package/dist/mobile_platform.js
CHANGED
|
@@ -20,6 +20,9 @@ class MobilePlatform {
|
|
|
20
20
|
// @ts-ignore
|
|
21
21
|
this.platform = window.flutter_inappwebview;
|
|
22
22
|
}
|
|
23
|
+
openFactorySelector() {
|
|
24
|
+
throw new Error("Method not implemented.");
|
|
25
|
+
}
|
|
23
26
|
addMessage(message) {
|
|
24
27
|
if (message.id != undefined) {
|
|
25
28
|
const callback = this.sseCallbacks[message.id];
|
package/dist/web_platform.js
CHANGED
|
@@ -21,6 +21,12 @@ class WebPlatform {
|
|
|
21
21
|
this._defaultSelectedFarm = selectedFarm;
|
|
22
22
|
this._defaultSelectedUnit = selectedUnit;
|
|
23
23
|
}
|
|
24
|
+
openFactorySelector() {
|
|
25
|
+
//call open function of factory-selector
|
|
26
|
+
var factorySelector = document.getElementById("cpzxrobot-factory-selector");
|
|
27
|
+
//@ts-ignore
|
|
28
|
+
factorySelector.open();
|
|
29
|
+
}
|
|
24
30
|
addMessage(_message) {
|
|
25
31
|
throw new Error("Method not implemented.");
|
|
26
32
|
}
|
package/dist/windows_platform.js
CHANGED
|
@@ -18,6 +18,9 @@ class WindwosMiniAppPlatform {
|
|
|
18
18
|
this.appCode = "";
|
|
19
19
|
this.baseURL = "";
|
|
20
20
|
}
|
|
21
|
+
openFactorySelector() {
|
|
22
|
+
throw new Error("Method not implemented.");
|
|
23
|
+
}
|
|
21
24
|
addMessage(message) {
|
|
22
25
|
if (message.id != undefined) {
|
|
23
26
|
const callback = this.sseCallbacks[message.id];
|
package/mobile_platform.ts
CHANGED
|
@@ -16,6 +16,11 @@ export class MobilePlatform implements PlatformInterface {
|
|
|
16
16
|
this.platform = window.flutter_inappwebview;
|
|
17
17
|
|
|
18
18
|
}
|
|
19
|
+
|
|
20
|
+
openFactorySelector(): void {
|
|
21
|
+
throw new Error("Method not implemented.");
|
|
22
|
+
}
|
|
23
|
+
|
|
19
24
|
addMessage(message: any): void {
|
|
20
25
|
if (message.id != undefined) {
|
|
21
26
|
const callback = this.sseCallbacks[message.id];
|
package/package.json
CHANGED
package/platform_interface.ts
CHANGED
|
@@ -31,4 +31,6 @@ export abstract class PlatformInterface {
|
|
|
31
31
|
abstract ready(): Promise<boolean>;
|
|
32
32
|
abstract setSelectedUnit(unit: Unit | String | Number): void;
|
|
33
33
|
abstract setSelectedFarm(farm: Factory | String | Number): void;
|
|
34
|
+
//change factory
|
|
35
|
+
abstract openFactorySelector():void;
|
|
34
36
|
}
|
package/web_platform.ts
CHANGED
|
@@ -18,6 +18,12 @@ export class WebPlatform implements PlatformInterface {
|
|
|
18
18
|
this._defaultSelectedFarm = selectedFarm;
|
|
19
19
|
this._defaultSelectedUnit = selectedUnit;
|
|
20
20
|
}
|
|
21
|
+
openFactorySelector() {
|
|
22
|
+
//call open function of factory-selector
|
|
23
|
+
var factorySelector = document.getElementById("cpzxrobot-factory-selector");
|
|
24
|
+
//@ts-ignore
|
|
25
|
+
factorySelector.open();
|
|
26
|
+
}
|
|
21
27
|
addMessage(_message: any): void {
|
|
22
28
|
throw new Error("Method not implemented.");
|
|
23
29
|
}
|
package/windows_platform.ts
CHANGED