@cpzxrobot/sdk 1.3.74 → 1.3.75
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 +4 -4
- package/dist/device_gateway.js +3 -2
- package/package.json +1 -1
- package/production_gateway.ts +1 -1
package/device_gateway.ts
CHANGED
|
@@ -993,14 +993,14 @@ export class DeviceGateway extends Object {
|
|
|
993
993
|
*/
|
|
994
994
|
async getAlarmStats(factoryId: number | undefined = undefined): Promise<DeviceAlarmStatsResponse> {
|
|
995
995
|
const axios = await this.context.ready;
|
|
996
|
-
|
|
996
|
+
var _factoryId = factoryId || 0;
|
|
997
997
|
if (!factoryId) {
|
|
998
|
-
const farm
|
|
999
|
-
|
|
998
|
+
const farm = await this.context.user.getSelectedFarm();
|
|
999
|
+
_factoryId = farm?.id || 0;
|
|
1000
1000
|
}
|
|
1001
1001
|
|
|
1002
1002
|
return axios.get(`/api/v2/device/stat/alarms`, {
|
|
1003
|
-
params: { factoryId }
|
|
1003
|
+
params: { factoryId: _factoryId }
|
|
1004
1004
|
}).then((res) => {
|
|
1005
1005
|
if (res.data.code !== 200) {
|
|
1006
1006
|
throw new Error(res.data.message || '获取设备告警统计信息失败');
|
package/dist/device_gateway.js
CHANGED
|
@@ -788,12 +788,13 @@ class DeviceGateway extends Object {
|
|
|
788
788
|
getAlarmStats() {
|
|
789
789
|
return __awaiter(this, arguments, void 0, function* (factoryId = undefined) {
|
|
790
790
|
const axios = yield this.context.ready;
|
|
791
|
+
var _factoryId = factoryId || 0;
|
|
791
792
|
if (!factoryId) {
|
|
792
793
|
const farm = yield this.context.user.getSelectedFarm();
|
|
793
|
-
|
|
794
|
+
_factoryId = (farm === null || farm === void 0 ? void 0 : farm.id) || 0;
|
|
794
795
|
}
|
|
795
796
|
return axios.get(`/api/v2/device/stat/alarms`, {
|
|
796
|
-
params: { factoryId }
|
|
797
|
+
params: { factoryId: _factoryId }
|
|
797
798
|
}).then((res) => {
|
|
798
799
|
if (res.data.code !== 200) {
|
|
799
800
|
throw new Error(res.data.message || '获取设备告警统计信息失败');
|
package/package.json
CHANGED
package/production_gateway.ts
CHANGED