@cpzxrobot/sdk 1.1.95 → 1.1.97
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 +23 -2
- package/dist/device_gateway.js +21 -2
- package/dist/index.js +2 -2
- package/dist/user_gateway.js +4 -2
- package/index.ts +2 -2
- package/package.json +1 -1
- package/user_gateway.ts +4 -2
package/device_gateway.ts
CHANGED
|
@@ -55,10 +55,31 @@ export class DeviceGateway extends Object {
|
|
|
55
55
|
workshopId?: number;
|
|
56
56
|
factoryId?: number;
|
|
57
57
|
companyId?: number;
|
|
58
|
-
}) => {
|
|
58
|
+
},params:any= undefined) => {
|
|
59
|
+
let axios = await this.context.ready;
|
|
60
|
+
var url = `/api/v2/device/list`;
|
|
61
|
+
if (params) {
|
|
62
|
+
//if params is string
|
|
63
|
+
if (typeof params === "string") {
|
|
64
|
+
url = `/api/v2/device/list?${params}`;
|
|
65
|
+
}
|
|
66
|
+
// if params is object
|
|
67
|
+
else {
|
|
68
|
+
url = `/api/v2/device/list?${Object.keys(params)
|
|
69
|
+
.map((key) => `${key}=${params[key]}`)
|
|
70
|
+
.join("&")}`;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return axios.post(url, condition).then((res) => {
|
|
75
|
+
return res.data;
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
preview: async (type:String, sn:any) => {
|
|
59
80
|
let axios = await this.context.ready;
|
|
60
81
|
|
|
61
|
-
return axios.
|
|
82
|
+
return axios.get(`/api/v2/device/iotValue/${type}/${sn}`).then((res) => {
|
|
62
83
|
return res.data;
|
|
63
84
|
});
|
|
64
85
|
},
|
package/dist/device_gateway.js
CHANGED
|
@@ -30,9 +30,28 @@ class DeviceGateway extends Object {
|
|
|
30
30
|
return res.data;
|
|
31
31
|
});
|
|
32
32
|
},
|
|
33
|
-
list: async (condition) => {
|
|
33
|
+
list: async (condition, params = undefined) => {
|
|
34
34
|
let axios = await this.context.ready;
|
|
35
|
-
|
|
35
|
+
var url = `/api/v2/device/list`;
|
|
36
|
+
if (params) {
|
|
37
|
+
//if params is string
|
|
38
|
+
if (typeof params === "string") {
|
|
39
|
+
url = `/api/v2/device/list?${params}`;
|
|
40
|
+
}
|
|
41
|
+
// if params is object
|
|
42
|
+
else {
|
|
43
|
+
url = `/api/v2/device/list?${Object.keys(params)
|
|
44
|
+
.map((key) => `${key}=${params[key]}`)
|
|
45
|
+
.join("&")}`;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return axios.post(url, condition).then((res) => {
|
|
49
|
+
return res.data;
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
preview: async (type, sn) => {
|
|
53
|
+
let axios = await this.context.ready;
|
|
54
|
+
return axios.get(`/api/v2/device/iotValue/${type}/${sn}`).then((res) => {
|
|
36
55
|
return res.data;
|
|
37
56
|
});
|
|
38
57
|
},
|
package/dist/index.js
CHANGED
|
@@ -338,7 +338,7 @@ class Cpzxrobot {
|
|
|
338
338
|
const token = localStorage.getItem("token");
|
|
339
339
|
if (token) {
|
|
340
340
|
this.token = token;
|
|
341
|
-
this.initAxios(
|
|
341
|
+
this.initAxios(baseURL);
|
|
342
342
|
this.axios.get("/api/v1/user/auth").then((res) => {
|
|
343
343
|
if (res.data.Error) {
|
|
344
344
|
window.location.href = "/login.html?error=" + res.data.Error;
|
|
@@ -370,7 +370,7 @@ class Cpzxrobot {
|
|
|
370
370
|
const access_token = url.searchParams.get("access_token");
|
|
371
371
|
const app_code = url.searchParams.get("app_code");
|
|
372
372
|
if (access_token && app_code) {
|
|
373
|
-
this.initAxios(
|
|
373
|
+
this.initAxios(baseURL);
|
|
374
374
|
this.axios
|
|
375
375
|
.post("/api/v1/user/auth", {
|
|
376
376
|
appCode: app_code,
|
package/dist/user_gateway.js
CHANGED
|
@@ -123,9 +123,11 @@ class UserGateway extends Object {
|
|
|
123
123
|
//当前如果打开的是公司,则说明该应用支持在公司级别打开,则要求该应用应该有对应的公司级别的角色配置,所以并不需要查找公司下属工厂或工厂的对应公司,再去查找用户
|
|
124
124
|
return axios.get(`/api/v2/company/${factory.id}/users?roleCode=${role}`);
|
|
125
125
|
}
|
|
126
|
-
async mypermission() {
|
|
126
|
+
async mypermission(params = undefined) {
|
|
127
127
|
var axios = await this.context.ready;
|
|
128
|
-
return axios.get("/api/v2/user/role/mypermission"
|
|
128
|
+
return axios.get("/api/v2/user/role/mypermission", {
|
|
129
|
+
params
|
|
130
|
+
});
|
|
129
131
|
}
|
|
130
132
|
async delete(id) {
|
|
131
133
|
var axios = await this.context.ready;
|
package/index.ts
CHANGED
|
@@ -386,7 +386,7 @@ export class Cpzxrobot {
|
|
|
386
386
|
const token = localStorage.getItem("token");
|
|
387
387
|
if (token) {
|
|
388
388
|
this.token = token;
|
|
389
|
-
this.initAxios(
|
|
389
|
+
this.initAxios(baseURL);
|
|
390
390
|
this.axios.get("/api/v1/user/auth").then((res) => {
|
|
391
391
|
if (res.data.Error) {
|
|
392
392
|
window.location.href = "/login.html?error=" + res.data.Error;
|
|
@@ -417,7 +417,7 @@ export class Cpzxrobot {
|
|
|
417
417
|
const access_token = url.searchParams.get("access_token");
|
|
418
418
|
const app_code = url.searchParams.get("app_code");
|
|
419
419
|
if (access_token && app_code) {
|
|
420
|
-
this.initAxios(
|
|
420
|
+
this.initAxios(baseURL);
|
|
421
421
|
this.axios
|
|
422
422
|
.post("/api/v1/user/auth", {
|
|
423
423
|
appCode: app_code,
|
package/package.json
CHANGED
package/user_gateway.ts
CHANGED
|
@@ -136,9 +136,11 @@ export class UserGateway extends Object {
|
|
|
136
136
|
return axios.get(`/api/v2/company/${factory.id}/users?roleCode=${role}`);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
async mypermission() {
|
|
139
|
+
async mypermission(params: any = undefined) {
|
|
140
140
|
var axios = await this.context.ready;
|
|
141
|
-
return axios.get("/api/v2/user/role/mypermission"
|
|
141
|
+
return axios.get("/api/v2/user/role/mypermission",{
|
|
142
|
+
params
|
|
143
|
+
});
|
|
142
144
|
}
|
|
143
145
|
|
|
144
146
|
async delete(id: number) {
|