@cpzxrobot/sdk 1.1.11 → 1.1.13

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/car_gateway.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Cpzxrobot, Device, Factory } from ".";
1
+ import { Cpzxrobot, Factory } from ".";
2
2
 
3
3
  export class CarGateway extends Object {
4
4
  context: Cpzxrobot;
package/device_gateway.ts CHANGED
@@ -71,7 +71,7 @@ export class DeviceGateway extends Object {
71
71
  let axios = await this.context.ready;
72
72
  return axios.get(`/api/v2/threshold/config`, {
73
73
  params: {
74
- factoryType: factory?.kind
74
+ factoryType: factory?.id
75
75
  },
76
76
  });
77
77
  },
@@ -81,7 +81,7 @@ export class DeviceGateway extends Object {
81
81
  return axios.post(`/api/v2/threshold/config`, data);
82
82
  },
83
83
  //向阈值配置中新增一条规则
84
- addRule: async (configId: string, data: any) => {
84
+ addRule: async (configId: any, data: any) => {
85
85
  let axios = await this.context.ready;
86
86
  return axios.post(`/api/v2/threshold`, {
87
87
  ...data,
@@ -96,7 +96,7 @@ export class DeviceGateway extends Object {
96
96
  });
97
97
  },
98
98
  //读取阈值配置,包括阈值规则列表
99
- get: async (configId: string) => {
99
+ get: async (configId: any) => {
100
100
  let axios = await this.context.ready;
101
101
  return axios.get(`/api/v2/threshold/config/${configId}`);
102
102
  },
@@ -44,7 +44,7 @@ class DeviceGateway extends Object {
44
44
  let axios = await this.context.ready;
45
45
  return axios.get(`/api/v2/threshold/config`, {
46
46
  params: {
47
- factoryType: factory === null || factory === void 0 ? void 0 : factory.kind
47
+ factoryType: factory === null || factory === void 0 ? void 0 : factory.business_kind
48
48
  },
49
49
  });
50
50
  },
@@ -42,7 +42,7 @@ class FactoryGateway extends Object {
42
42
  var axios = await this.context.ready;
43
43
  return axios.post("/api/v2/factory/role", data);
44
44
  }
45
- async deleteRole(id, roleId) {
45
+ async deleteRole(roleId) {
46
46
  var axios = await this.context.ready;
47
47
  return axios.post("/api/v2/factory/role/delete?id=" + roleId);
48
48
  }
@@ -64,7 +64,7 @@ class FactoryGateway extends Object {
64
64
  },
65
65
  types: async (factory) => {
66
66
  var axios = await this.context.ready;
67
- return axios.get(`/api/v2/factory/${factory.kind}/workshop/type`);
67
+ return axios.get(`/api/v2/factory/${factory.business_kind}/workshop/type`);
68
68
  },
69
69
  list: async (factory) => {
70
70
  var axios = await this.context.ready;
@@ -49,6 +49,25 @@ class UnitGateway extends Object {
49
49
  },
50
50
  };
51
51
  }
52
+ get thresholdConfig() {
53
+ return {
54
+ //获取阈值配置
55
+ get: (unit) => {
56
+ return this.context.ready.then((axios) => {
57
+ return axios.get(`/api/v2/unit/${unit.id}/threshold`);
58
+ });
59
+ },
60
+ //绑定阈值配置
61
+ bind: (unit, thresholdConfig) => {
62
+ return this.context.ready.then((axios) => {
63
+ return axios.post(`/api/v2/unit/threshold`, {
64
+ id: unit.id,
65
+ configId: thresholdConfig.id,
66
+ });
67
+ });
68
+ },
69
+ };
70
+ }
52
71
  v2() {
53
72
  return {
54
73
  //新增时必传factoryId, 当上层是workshop时,需要传workshopId
@@ -50,7 +50,7 @@ export class FactoryGateway extends Object {
50
50
  return axios.post("/api/v2/factory/role", data);
51
51
  }
52
52
 
53
- async deleteRole(id: number, roleId: number) {
53
+ async deleteRole( roleId: number) {
54
54
  var axios = await this.context.ready;
55
55
  return axios.post("/api/v2/factory/role/delete?id=" + roleId);
56
56
  }
@@ -74,7 +74,7 @@ export class FactoryGateway extends Object {
74
74
  },
75
75
  types: async (factory: Factory) => {
76
76
  var axios = await this.context.ready;
77
- return axios.get(`/api/v2/factory/${factory.kind}/workshop/type`);
77
+ return axios.get(`/api/v2/factory/${factory.business_kind}/workshop/type`);
78
78
  },
79
79
  list: async (factory: Factory) => {
80
80
  var axios = await this.context.ready;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.1.11",
3
+ "version": "1.1.13",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/readme.md CHANGED
@@ -133,6 +133,8 @@ baseURL: "/"
133
133
  | cpzxrobot().unit.v2.delete | 删除单元,v2版本 |
134
134
  | cpzxrobot().unit.layout.get | 获取单元的展示布局 |
135
135
  | cpzxrobot().unit.layout.post | 设置单元的展示布局 |
136
+ | cpzxrobot().unit.thresholdConfig.get | 获取单元的阈值配置信息 |
137
+ | cpzxrobot().unit.thresholdConfig.post | 设置单元的阈值配置信息 |
136
138
  | cpzxrobot().user.add | 添加用户 |
137
139
  | cpzxrobot().user.update | 更新用户 |
138
140
  | cpzxrobot().user.list | 列出用户(传入工厂) |
package/types.d.ts CHANGED
@@ -78,6 +78,7 @@ type Factory = {
78
78
  type?: string;
79
79
  kind?: string;
80
80
  pid?: number;
81
+ business_kind?: string;
81
82
  };
82
83
  type Unit = {
83
84
  name?: string;
package/unit_gateway.ts CHANGED
@@ -66,6 +66,26 @@ export class UnitGateway extends Object {
66
66
  };
67
67
  }
68
68
 
69
+ get thresholdConfig() {
70
+ return {
71
+ //获取阈值配置
72
+ get: (unit: Unit) => {
73
+ return this.context.ready.then((axios) => {
74
+ return axios.get(`/api/v2/unit/${unit.id}/threshold`);
75
+ });
76
+ },
77
+ //绑定阈值配置
78
+ bind: (unit: Unit, thresholdConfig: any) => {
79
+ return this.context.ready.then((axios) => {
80
+ return axios.post(`/api/v2/unit/threshold`, {
81
+ id: unit.id,
82
+ configId: thresholdConfig.id,
83
+ });
84
+ });
85
+ },
86
+ };
87
+ }
88
+
69
89
  v2() {
70
90
  return {
71
91
  //新增时必传factoryId, 当上层是workshop时,需要传workshopId