@cpzxrobot/sdk 1.2.66 → 1.2.68
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 +12 -2
- package/dist/device_gateway.js +9 -2
- package/dist/index.js +5 -5
- package/dist/project_gateway.js +23 -1
- package/index.ts +6 -6
- package/package.json +1 -1
- package/project_gateway.ts +28 -1
- package/types.d.ts +1 -1
package/device_gateway.ts
CHANGED
|
@@ -202,19 +202,29 @@ export class DeviceGateway extends Object {
|
|
|
202
202
|
return this.getFilter("ElectricMeter", ElectricMeterGateway);
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
|
|
206
|
-
|
|
205
|
+
//获取设备详情
|
|
206
|
+
//ID:点位ID,设备UUID,当type是device时,为设备ID(UUID);当type是datapoint时,为点位ID(number)
|
|
207
|
+
show(id: any, type: "device"|"datapoint" = "datapoint"){
|
|
208
|
+
this.context.showInDeviceManager(id,type);
|
|
207
209
|
}
|
|
208
210
|
|
|
209
211
|
private getFilter<T extends { id: number }>(
|
|
210
212
|
type: string,
|
|
211
213
|
cls: new (context: Cpzxrobot) => DeviceFilter<T>
|
|
212
214
|
): DeviceFilter<T> {
|
|
215
|
+
// 如果filters中已经有对应type的过滤器,则直接返回该过滤器
|
|
213
216
|
if (this.filters.has(type)) {
|
|
214
217
|
return this.filters.get(type) as DeviceFilter<T>;
|
|
215
218
|
}
|
|
219
|
+
|
|
220
|
+
// 否则,创建一个新的过滤器实例
|
|
216
221
|
const filter = new cls(this.context);
|
|
222
|
+
|
|
223
|
+
// 将新创建的过滤器实例添加到filters中,并返回该过滤器实例
|
|
224
|
+
// 将新创建的过滤器实例添加到filters中
|
|
217
225
|
this.filters.set(type, filter);
|
|
226
|
+
|
|
227
|
+
// 返回新创建的过滤器实例
|
|
218
228
|
return filter;
|
|
219
229
|
}
|
|
220
230
|
|
package/dist/device_gateway.js
CHANGED
|
@@ -154,15 +154,22 @@ class DeviceGateway extends Object {
|
|
|
154
154
|
get electricMeter() {
|
|
155
155
|
return this.getFilter("ElectricMeter", electricmeter_1.ElectricMeterGateway);
|
|
156
156
|
}
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
//获取设备详情
|
|
158
|
+
//ID:点位ID,设备UUID,当type是device时,为设备ID(UUID);当type是datapoint时,为点位ID(number)
|
|
159
|
+
show(id, type = "datapoint") {
|
|
160
|
+
this.context.showInDeviceManager(id, type);
|
|
159
161
|
}
|
|
160
162
|
getFilter(type, cls) {
|
|
163
|
+
// 如果filters中已经有对应type的过滤器,则直接返回该过滤器
|
|
161
164
|
if (this.filters.has(type)) {
|
|
162
165
|
return this.filters.get(type);
|
|
163
166
|
}
|
|
167
|
+
// 否则,创建一个新的过滤器实例
|
|
164
168
|
const filter = new cls(this.context);
|
|
169
|
+
// 将新创建的过滤器实例添加到filters中,并返回该过滤器实例
|
|
170
|
+
// 将新创建的过滤器实例添加到filters中
|
|
165
171
|
this.filters.set(type, filter);
|
|
172
|
+
// 返回新创建的过滤器实例
|
|
166
173
|
return filter;
|
|
167
174
|
}
|
|
168
175
|
// addDevice(device: Device) {
|
package/dist/index.js
CHANGED
|
@@ -243,7 +243,7 @@ class Cpzxrobot {
|
|
|
243
243
|
// @ts-ignore
|
|
244
244
|
this.setProgress = window.miniapp.setProgress;
|
|
245
245
|
// @ts-ignore
|
|
246
|
-
this.
|
|
246
|
+
this.showInDeviceManager = window.miniapp.showInDeviceManager;
|
|
247
247
|
}
|
|
248
248
|
else if (domain == "appassets.androidplatform.net" || domain == "webc.cpzxrobot.com" ||
|
|
249
249
|
this.isIosMiniApp(window.location)) {
|
|
@@ -283,8 +283,8 @@ class Cpzxrobot {
|
|
|
283
283
|
this.vibrate = function (time) {
|
|
284
284
|
return platform.callHandler("app.vibrate", time);
|
|
285
285
|
};
|
|
286
|
-
this.
|
|
287
|
-
return platform.callHandler("app.
|
|
286
|
+
this.showInDeviceManager = function (deviceId, type) {
|
|
287
|
+
return platform.callHandler("app.showInDeviceManager", deviceId, type);
|
|
288
288
|
};
|
|
289
289
|
this.reloadGroup = function (group) {
|
|
290
290
|
return platform.callHandler("app.reloadGroup", group);
|
|
@@ -408,8 +408,8 @@ class Cpzxrobot {
|
|
|
408
408
|
}
|
|
409
409
|
});
|
|
410
410
|
};
|
|
411
|
-
this.
|
|
412
|
-
return this.axios.get(
|
|
411
|
+
this.showInDeviceManager = function (deviceId, type) {
|
|
412
|
+
return this.axios.get(`/api/v1/${type}/share/` + deviceId);
|
|
413
413
|
};
|
|
414
414
|
}
|
|
415
415
|
}
|
package/dist/project_gateway.js
CHANGED
|
@@ -88,7 +88,7 @@ class ProjectGateway extends Object {
|
|
|
88
88
|
}
|
|
89
89
|
get document() {
|
|
90
90
|
return {
|
|
91
|
-
//
|
|
91
|
+
// 获取文档列表
|
|
92
92
|
list: (args) => {
|
|
93
93
|
return this.context.ready.then((axios) => {
|
|
94
94
|
return axios.post(`/api/v2/coremde-sale/project/document/list`, args);
|
|
@@ -102,6 +102,28 @@ class ProjectGateway extends Object {
|
|
|
102
102
|
}
|
|
103
103
|
}, fileName);
|
|
104
104
|
});
|
|
105
|
+
},
|
|
106
|
+
// 上传项目文档
|
|
107
|
+
upload: (args) => {
|
|
108
|
+
return this.context.ready.then((axios) => {
|
|
109
|
+
return axios.post(`/api/v2/coremde-sale/project/document/upload`, args);
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
// 预览项目文档
|
|
113
|
+
view: (args) => {
|
|
114
|
+
return this.context.ready.then((axios) => {
|
|
115
|
+
return axios.get(`/api/v2/coremde-sale/project/document/view`, {
|
|
116
|
+
params: args
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
// 下载项目文档
|
|
121
|
+
download: (args) => {
|
|
122
|
+
return this.context.ready.then((axios) => {
|
|
123
|
+
return axios.get(`/api/v2/coremde-sale/project/document/download`, {
|
|
124
|
+
params: args
|
|
125
|
+
});
|
|
126
|
+
});
|
|
105
127
|
}
|
|
106
128
|
};
|
|
107
129
|
}
|
package/index.ts
CHANGED
|
@@ -51,7 +51,7 @@ export class Cpzxrobot {
|
|
|
51
51
|
saveBlob!: (blob: Blob, filename: string) => Promise<void>;
|
|
52
52
|
scanQrcode!: () => Promise<string>;
|
|
53
53
|
vibrate!: (time?: number) => void;
|
|
54
|
-
|
|
54
|
+
showInDeviceManager!: (deviceId: any, type: string) => Promise<void>;
|
|
55
55
|
reloadGroup!: (key: string) => void;
|
|
56
56
|
getGeo!: () => Promise<{
|
|
57
57
|
lat: number;
|
|
@@ -265,7 +265,7 @@ export class Cpzxrobot {
|
|
|
265
265
|
// @ts-ignore
|
|
266
266
|
this.setProgress = window.miniapp.setProgress;
|
|
267
267
|
// @ts-ignore
|
|
268
|
-
this.
|
|
268
|
+
this.showInDeviceManager = window.miniapp.showInDeviceManager;
|
|
269
269
|
} else if (
|
|
270
270
|
domain == "appassets.androidplatform.net" || domain == "webc.cpzxrobot.com" ||
|
|
271
271
|
this.isIosMiniApp(window.location)
|
|
@@ -308,8 +308,8 @@ export class Cpzxrobot {
|
|
|
308
308
|
this.vibrate = function (time?: number) {
|
|
309
309
|
return platform.callHandler("app.vibrate", time);
|
|
310
310
|
};
|
|
311
|
-
this.
|
|
312
|
-
return platform.callHandler("app.
|
|
311
|
+
this.showInDeviceManager = function (deviceId: number,type:string) {
|
|
312
|
+
return platform.callHandler("app.showInDeviceManager", deviceId,type);
|
|
313
313
|
};
|
|
314
314
|
this.reloadGroup = function (group: string) {
|
|
315
315
|
return platform.callHandler("app.reloadGroup", group);
|
|
@@ -437,8 +437,8 @@ export class Cpzxrobot {
|
|
|
437
437
|
}
|
|
438
438
|
});
|
|
439
439
|
};
|
|
440
|
-
this.
|
|
441
|
-
return this.axios.get(
|
|
440
|
+
this.showInDeviceManager = function (deviceId: number,type: string) {
|
|
441
|
+
return this.axios.get(`/api/v1/${type}/share/` + deviceId);
|
|
442
442
|
};
|
|
443
443
|
}
|
|
444
444
|
}
|
package/package.json
CHANGED
package/project_gateway.ts
CHANGED
|
@@ -119,7 +119,7 @@ export class ProjectGateway extends Object {
|
|
|
119
119
|
|
|
120
120
|
get document() {
|
|
121
121
|
return {
|
|
122
|
-
//
|
|
122
|
+
// 获取文档列表
|
|
123
123
|
list: (args: {
|
|
124
124
|
pageNo: number;
|
|
125
125
|
pageSize: number;
|
|
@@ -137,6 +137,33 @@ export class ProjectGateway extends Object {
|
|
|
137
137
|
}
|
|
138
138
|
}, fileName);
|
|
139
139
|
});
|
|
140
|
+
},
|
|
141
|
+
// 上传项目文档
|
|
142
|
+
upload: (args: {
|
|
143
|
+
projectId: number;
|
|
144
|
+
files: any[];
|
|
145
|
+
groupId: number;
|
|
146
|
+
fileType: "base-info" | "inquiry" | "contract";
|
|
147
|
+
}) => {
|
|
148
|
+
return this.context.ready.then((axios) => {
|
|
149
|
+
return axios.post(`/api/v2/coremde-sale/project/document/upload`, args);
|
|
150
|
+
});
|
|
151
|
+
},
|
|
152
|
+
// 预览项目文档
|
|
153
|
+
view: (args: { documentId: number }) => {
|
|
154
|
+
return this.context.ready.then((axios) => {
|
|
155
|
+
return axios.get(`/api/v2/coremde-sale/project/document/view`, {
|
|
156
|
+
params: args
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
},
|
|
160
|
+
// 下载项目文档
|
|
161
|
+
download: (args: { documentId: number }) => {
|
|
162
|
+
return this.context.ready.then((axios) => {
|
|
163
|
+
return axios.get(`/api/v2/coremde-sale/project/document/download`, {
|
|
164
|
+
params: args
|
|
165
|
+
});
|
|
166
|
+
});
|
|
140
167
|
}
|
|
141
168
|
};
|
|
142
169
|
}
|
package/types.d.ts
CHANGED
|
@@ -363,7 +363,7 @@ class Cpzxrobot {
|
|
|
363
363
|
vibrate: (time?: number) => void;
|
|
364
364
|
reloadGroup: (key: string) => void;
|
|
365
365
|
getGeo: () => Promise<{ lat: number; lng: number }>;
|
|
366
|
-
|
|
366
|
+
showInDeviceManager: (deviceId: number, type: string) => Promise<void>;
|
|
367
367
|
}
|
|
368
368
|
|
|
369
369
|
declare global {
|