@cpzxrobot/sdk 1.1.4 → 1.1.6
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_filter.ts +16 -16
- package/dist/factory_gateway.js +23 -0
- package/dist/pigfarm_gateway.js +13 -0
- package/dist/user_gateway.js +1 -5
- package/factory_gateway.ts +27 -0
- package/package.json +1 -1
- package/pigfarm_gateway.ts +19 -0
- package/readme.md +5 -0
- package/user_gateway.ts +1 -6
package/device_filter.ts
CHANGED
|
@@ -330,22 +330,22 @@ export abstract class DeviceFilter<T extends { id: number }> {
|
|
|
330
330
|
options:
|
|
331
331
|
| undefined
|
|
332
332
|
| {
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
333
|
+
id?: Number | null | undefined;
|
|
334
|
+
data?:
|
|
335
|
+
| "diffPerDay"
|
|
336
|
+
| "sumPerDay"
|
|
337
|
+
| "latest"
|
|
338
|
+
| "weekoverweek"
|
|
339
|
+
| "last"
|
|
340
|
+
| "rangeOfDay"
|
|
341
|
+
| "rangeToday"
|
|
342
|
+
| null; //如果data为null,则不获取数据,只获取设备列表,否则获取设备列表和数据
|
|
343
|
+
status?: string;
|
|
344
|
+
unit?: Number;
|
|
345
|
+
detail?: boolean;
|
|
346
|
+
type?: string;
|
|
347
|
+
supplier?: string; //供应商,可用于过滤设备
|
|
348
|
+
} = undefined
|
|
349
349
|
): Promise<T[]> {
|
|
350
350
|
// if (this.devices.length > 0) {
|
|
351
351
|
// return Promise.resolve(this.devices)
|
package/dist/factory_gateway.js
CHANGED
|
@@ -23,6 +23,29 @@ class FactoryGateway extends Object {
|
|
|
23
23
|
const response = await axios.get(`/api/v1/workshop/unit/${id}`);
|
|
24
24
|
return response.data;
|
|
25
25
|
}
|
|
26
|
+
//获得工厂的应用信息, 如果指定withRoles为true,则返回app和app的详细角色信息
|
|
27
|
+
async apps(id, withRoles = false) {
|
|
28
|
+
var axios = await this.context.ready;
|
|
29
|
+
var url = `/api/v2/factory/${id}/apps`;
|
|
30
|
+
if (withRoles) {
|
|
31
|
+
url += "/roles";
|
|
32
|
+
}
|
|
33
|
+
const response = await axios.get(url);
|
|
34
|
+
return response.data;
|
|
35
|
+
}
|
|
36
|
+
async roles(id) {
|
|
37
|
+
var axios = await this.context.ready;
|
|
38
|
+
return axios.get("/api/v2/factory/" + id + "/roles");
|
|
39
|
+
}
|
|
40
|
+
async addRole(id, data) {
|
|
41
|
+
data.factoryId = id;
|
|
42
|
+
var axios = await this.context.ready;
|
|
43
|
+
return axios.post("/api/v2/factory/role", data);
|
|
44
|
+
}
|
|
45
|
+
async users(id) {
|
|
46
|
+
var axios = await this.context.ready;
|
|
47
|
+
return axios.get("/api/v2/factory/" + id + "/users");
|
|
48
|
+
}
|
|
26
49
|
//获得工厂的车间信息
|
|
27
50
|
get workshop() {
|
|
28
51
|
return {
|
package/dist/pigfarm_gateway.js
CHANGED
|
@@ -198,6 +198,19 @@ class PigfarmGateway extends Object {
|
|
|
198
198
|
var axios = await this.context.ready;
|
|
199
199
|
return axios.post(`/api/v1/pigfarm/heatLamp/config/list?unitId=${unit.id}`);
|
|
200
200
|
},
|
|
201
|
+
template: {
|
|
202
|
+
//获取配置模版列表
|
|
203
|
+
list: async (factory) => {
|
|
204
|
+
var axios = await this.context.ready;
|
|
205
|
+
return axios.get(`/api/v1/pigfarm/heatLamp/config/template/list/${factory.id}`);
|
|
206
|
+
},
|
|
207
|
+
//增加模板
|
|
208
|
+
add: (factory, name, data) => {
|
|
209
|
+
return this.context.ready.then((axios) => {
|
|
210
|
+
return axios.post(`/api/v1/pigfarm/heatLamp/config/add`, Object.assign(Object.assign({}, data), { factoryId: factory.id, templateName: name }));
|
|
211
|
+
});
|
|
212
|
+
},
|
|
213
|
+
},
|
|
201
214
|
list: async (unit) => {
|
|
202
215
|
var axios = await this.context.ready;
|
|
203
216
|
return axios.post(`/api/v1/pigfarm/heatLamp/list/${unit.id}`);
|
package/dist/user_gateway.js
CHANGED
|
@@ -105,11 +105,7 @@ class UserGateway extends Object {
|
|
|
105
105
|
}
|
|
106
106
|
async list(factory) {
|
|
107
107
|
var axios = await this.context.ready;
|
|
108
|
-
return axios.get("/api/v2/
|
|
109
|
-
}
|
|
110
|
-
async roles() {
|
|
111
|
-
var axios = await this.context.ready;
|
|
112
|
-
return axios.get("/api/v2/user/role/list");
|
|
108
|
+
return axios.get("/api/v2/" + factory.id + "/users");
|
|
113
109
|
}
|
|
114
110
|
async mypermission() {
|
|
115
111
|
var axios = await this.context.ready;
|
package/factory_gateway.ts
CHANGED
|
@@ -28,6 +28,33 @@ export class FactoryGateway extends Object {
|
|
|
28
28
|
return response.data;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
//获得工厂的应用信息, 如果指定withRoles为true,则返回app和app的详细角色信息
|
|
32
|
+
async apps(id: number, withRoles = false): Promise<any> {
|
|
33
|
+
var axios = await this.context.ready;
|
|
34
|
+
var url = `/api/v2/factory/${id}/apps`;
|
|
35
|
+
if (withRoles) {
|
|
36
|
+
url += "/roles";
|
|
37
|
+
}
|
|
38
|
+
const response = await axios.get(url);
|
|
39
|
+
return response.data;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async roles(id: number) {
|
|
43
|
+
var axios = await this.context.ready;
|
|
44
|
+
return axios.get("/api/v2/factory/" + id+"/roles");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async addRole(id: number, data: any) {
|
|
48
|
+
data.factoryId = id;
|
|
49
|
+
var axios = await this.context.ready;
|
|
50
|
+
return axios.post("/api/v2/factory/role", data);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async users(id: number) {
|
|
54
|
+
var axios = await this.context.ready;
|
|
55
|
+
return axios.get("/api/v2/factory/" + id+"/users");
|
|
56
|
+
}
|
|
57
|
+
|
|
31
58
|
//获得工厂的车间信息
|
|
32
59
|
get workshop() {
|
|
33
60
|
return {
|
package/package.json
CHANGED
package/pigfarm_gateway.ts
CHANGED
|
@@ -247,6 +247,25 @@ export class PigfarmGateway extends Object {
|
|
|
247
247
|
`/api/v1/pigfarm/heatLamp/config/list?unitId=${unit.id}`
|
|
248
248
|
);
|
|
249
249
|
},
|
|
250
|
+
template: {
|
|
251
|
+
//获取配置模版列表
|
|
252
|
+
list: async (factory: Factory): Promise<any> => {
|
|
253
|
+
var axios = await this.context.ready;
|
|
254
|
+
return axios.get(
|
|
255
|
+
`/api/v1/pigfarm/heatLamp/config/template/list/${factory.id }`
|
|
256
|
+
);
|
|
257
|
+
},
|
|
258
|
+
//增加模板
|
|
259
|
+
add: (factory: Factory, name:String,data: HeatLamp) => {
|
|
260
|
+
return this.context.ready.then((axios) => {
|
|
261
|
+
return axios.post(`/api/v1/pigfarm/heatLamp/config/add`, {
|
|
262
|
+
...data,
|
|
263
|
+
factoryId: factory.id,
|
|
264
|
+
templateName: name,
|
|
265
|
+
});
|
|
266
|
+
});
|
|
267
|
+
},
|
|
268
|
+
},
|
|
250
269
|
list: async (unit: Unit): Promise<any> => {
|
|
251
270
|
var axios = await this.context.ready;
|
|
252
271
|
return axios.post(`/api/v1/pigfarm/heatLamp/list/${unit.id}`);
|
package/readme.md
CHANGED
|
@@ -87,6 +87,9 @@ baseURL: "/"
|
|
|
87
87
|
| cpzxrobot().camera.xxx | 获得摄像头的相关信息 |
|
|
88
88
|
| cpzxrobot().camera.control | 控制摄像头,例如:左移,右移,上移,下移等,如果传输start为true,则开始控制,如果传输stop为true,则停止控制,如果都没传输,则执行3秒后自动停止,传输start为true时,前端必须在需要停止时自行发送stop为true的消息 |
|
|
89
89
|
| cpzxrobot().factory.entry | 获得工厂的可显示动态信息 |
|
|
90
|
+
| cpzxrobot().factory.apps | 获得工厂的应用列表,如果指定withRoles为true,则返回app和app的详细角色信息 |
|
|
91
|
+
| cpzxrobot().factory.roles | 获得工厂的角色列表 |
|
|
92
|
+
| cpzxrobot().factory.addRole | 添加工厂的角色 |
|
|
90
93
|
| cpzxrobot().factory.info.get | 获得工厂的附加信息 |
|
|
91
94
|
| cpzxrobot().factory.info.post | 更新或更新工厂的附加信息 |
|
|
92
95
|
| cpzxrobot().factory.banner.add | 添加工厂的banner图片,提交formdata,需要传入file参数 |
|
|
@@ -112,6 +115,8 @@ baseURL: "/"
|
|
|
112
115
|
| cpzxrobot().pigfarm.heatlamp.set | 设置保温灯的当前工作日龄,调用时,action传"dayage",argc传天数 |
|
|
113
116
|
| cpzxrobot().pigfarm.heatlamp.switch | 设置保温灯的当前工作日龄,调用时,action"on"或"off" |
|
|
114
117
|
| cpzxrobot().pigfarm.heatlamp.iotFields | 获取保温灯用于获取iot的字段列表 |
|
|
118
|
+
| cpzxrobot().pigfarm.heatlamp.template.add | 添加保温灯的模板 |
|
|
119
|
+
| cpzxrobot().pigfarm.heatlamp.template.list | 获取保温灯的模板列表 |
|
|
115
120
|
| cpzxrobot().pigfarm.threshold | 获取单元中特定类型的阈值信息 |
|
|
116
121
|
| cpzxrobot().scanQrcode | 调用扫码功能,获得扫码文字 |
|
|
117
122
|
| cpzxrobot().vibrate | 调用震动功能 |
|
package/user_gateway.ts
CHANGED
|
@@ -113,12 +113,7 @@ export class UserGateway extends Object {
|
|
|
113
113
|
|
|
114
114
|
async list(factory: Factory) {
|
|
115
115
|
var axios = await this.context.ready;
|
|
116
|
-
return axios.get("/api/v2/
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
async roles() {
|
|
120
|
-
var axios = await this.context.ready;
|
|
121
|
-
return axios.get("/api/v2/user/role/list");
|
|
116
|
+
return axios.get("/api/v2/" + factory.id+"/users");
|
|
122
117
|
}
|
|
123
118
|
|
|
124
119
|
async mypermission() {
|