@cpzxrobot/sdk 1.2.17 → 1.2.18

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 CHANGED
@@ -329,52 +329,6 @@ export abstract class DeviceFilter<T extends { id: number }> {
329
329
  return `${year}-${String(month).padStart(2, "0")}`;
330
330
  }
331
331
 
332
- // 报告设备问题
333
- report(id: number, status: number, description: string): Promise<any> {
334
- return this.context.ready.then(() => {
335
- return this.context.axios.post("/api/v3/device/report", {
336
- id,
337
- status,
338
- description
339
- }).then((res) => {
340
- if (res.data.code != 200) {
341
- throw res.data.message;
342
- }
343
- return res.data;
344
- });
345
- });
346
- }
347
-
348
- get ctrl() {
349
- return {
350
- // 获取设备控制参数
351
- get: (deviceId: number,type: string, no: any ): Promise<any> => {
352
- return this.context.ready.then(() => {
353
- return this.context.axios.get(`/api/v2/device/ctrl/${deviceId}/${type}/${no}`)
354
- .then((res) => {
355
- if (res.data.code != 200) {
356
- throw res.data.message;
357
- }
358
- return res.data;
359
- });
360
- });
361
- },
362
-
363
- // 配置设备控制参数
364
- set: (deviceId: number,type: string, no: any,params: any): Promise<any> => {
365
- return this.context.ready.then(() => {
366
- return this.context.axios.post(`/api/v2/device/ctrl/${deviceId}/${type}/${no}`, params)
367
- .then((res) => {
368
- if (res.data.code != 200) {
369
- throw res.data.message;
370
- }
371
- return res.data;
372
- });
373
- });
374
- }
375
- };
376
- }
377
-
378
332
  //获取设备列表,如果options.id为空,则获取用户选中工厂的设备列表,否则获取指定id的工厂的设备
379
333
  //last:获取最新数据
380
334
  // rangeToday:获取今天的第一个数据和最后一个数据
package/device_gateway.ts CHANGED
@@ -319,4 +319,51 @@ export class DeviceGateway extends Object {
319
319
  return faults;
320
320
 
321
321
  }
322
+
323
+
324
+ // 报告设备问题
325
+ report(id: number, status: number, description: string): Promise<any> {
326
+ return this.context.ready.then(() => {
327
+ return this.context.axios.post("/api/v3/device/report", {
328
+ id,
329
+ status,
330
+ description
331
+ }).then((res) => {
332
+ if (res.data.code != 200) {
333
+ throw res.data.message;
334
+ }
335
+ return res.data;
336
+ });
337
+ });
338
+ }
339
+
340
+ get ctrl() {
341
+ return {
342
+ // 获取设备控制参数
343
+ get: (deviceId: number,type: string, no: any ): Promise<any> => {
344
+ return this.context.ready.then(() => {
345
+ return this.context.axios.get(`/api/v2/device/ctrl/${deviceId}/${type}/${no}`)
346
+ .then((res) => {
347
+ if (res.data.code != 200) {
348
+ throw res.data.message;
349
+ }
350
+ return res.data;
351
+ });
352
+ });
353
+ },
354
+
355
+ // 配置设备控制参数
356
+ set: (deviceId: number,type: string, no: any,params: any): Promise<any> => {
357
+ return this.context.ready.then(() => {
358
+ return this.context.axios.post(`/api/v2/device/ctrl/${deviceId}/${type}/${no}`, params)
359
+ .then((res) => {
360
+ if (res.data.code != 200) {
361
+ throw res.data.message;
362
+ }
363
+ return res.data;
364
+ });
365
+ });
366
+ }
367
+ };
368
+ }
322
369
  }
@@ -293,49 +293,6 @@ class DeviceFilter {
293
293
  // 使用 `padStart` 方法来确保月份和日期总是两位数
294
294
  return `${year}-${String(month).padStart(2, "0")}`;
295
295
  }
296
- // 报告设备问题
297
- report(id, status, description) {
298
- return this.context.ready.then(() => {
299
- return this.context.axios.post("/api/v3/device/report", {
300
- id,
301
- status,
302
- description
303
- }).then((res) => {
304
- if (res.data.code != 200) {
305
- throw res.data.message;
306
- }
307
- return res.data;
308
- });
309
- });
310
- }
311
- get ctrl() {
312
- return {
313
- // 获取设备控制参数
314
- get: (deviceId, type, no) => {
315
- return this.context.ready.then(() => {
316
- return this.context.axios.get(`/api/v2/device/ctrl/${deviceId}/${type}/${no}`)
317
- .then((res) => {
318
- if (res.data.code != 200) {
319
- throw res.data.message;
320
- }
321
- return res.data;
322
- });
323
- });
324
- },
325
- // 配置设备控制参数
326
- set: (deviceId, type, no, params) => {
327
- return this.context.ready.then(() => {
328
- return this.context.axios.post(`/api/v2/device/ctrl/${deviceId}/${type}/${no}`, params)
329
- .then((res) => {
330
- if (res.data.code != 200) {
331
- throw res.data.message;
332
- }
333
- return res.data;
334
- });
335
- });
336
- }
337
- };
338
- }
339
296
  //获取设备列表,如果options.id为空,则获取用户选中工厂的设备列表,否则获取指定id的工厂的设备
340
297
  //last:获取最新数据
341
298
  // rangeToday:获取今天的第一个数据和最后一个数据
@@ -233,5 +233,48 @@ class DeviceGateway extends Object {
233
233
  }
234
234
  return faults;
235
235
  }
236
+ // 报告设备问题
237
+ report(id, status, description) {
238
+ return this.context.ready.then(() => {
239
+ return this.context.axios.post("/api/v3/device/report", {
240
+ id,
241
+ status,
242
+ description
243
+ }).then((res) => {
244
+ if (res.data.code != 200) {
245
+ throw res.data.message;
246
+ }
247
+ return res.data;
248
+ });
249
+ });
250
+ }
251
+ get ctrl() {
252
+ return {
253
+ // 获取设备控制参数
254
+ get: (deviceId, type, no) => {
255
+ return this.context.ready.then(() => {
256
+ return this.context.axios.get(`/api/v2/device/ctrl/${deviceId}/${type}/${no}`)
257
+ .then((res) => {
258
+ if (res.data.code != 200) {
259
+ throw res.data.message;
260
+ }
261
+ return res.data;
262
+ });
263
+ });
264
+ },
265
+ // 配置设备控制参数
266
+ set: (deviceId, type, no, params) => {
267
+ return this.context.ready.then(() => {
268
+ return this.context.axios.post(`/api/v2/device/ctrl/${deviceId}/${type}/${no}`, params)
269
+ .then((res) => {
270
+ if (res.data.code != 200) {
271
+ throw res.data.message;
272
+ }
273
+ return res.data;
274
+ });
275
+ });
276
+ }
277
+ };
278
+ }
236
279
  }
237
280
  exports.DeviceGateway = DeviceGateway;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.2.17",
3
+ "version": "1.2.18",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {