@cpzxrobot/sdk 1.3.68 → 1.3.70

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.
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.DeviceGateway = void 0;
4
13
  const device_type_gateway_1 = require("./device_type_gateway");
@@ -53,26 +62,26 @@ const normal_type_1 = require("./device_types/normal_type");
53
62
  class DeviceGateway extends Object {
54
63
  get v2() {
55
64
  return {
56
- update: async (data) => {
57
- let axios = await this.context.ready;
65
+ update: (data) => __awaiter(this, void 0, void 0, function* () {
66
+ let axios = yield this.context.ready;
58
67
  return axios.post(`/api/v2/device/update`, data).then((res) => {
59
68
  return res.data;
60
69
  });
61
- },
62
- add: async (data) => {
63
- let axios = await this.context.ready;
70
+ }),
71
+ add: (data) => __awaiter(this, void 0, void 0, function* () {
72
+ let axios = yield this.context.ready;
64
73
  return axios.post(`/api/v2/device/add`, data).then((res) => {
65
74
  return res.data;
66
75
  });
67
- },
68
- delete: async (id) => {
69
- let axios = await this.context.ready;
76
+ }),
77
+ delete: (id) => __awaiter(this, void 0, void 0, function* () {
78
+ let axios = yield this.context.ready;
70
79
  return axios.post(`/api/v2/device/delete?id=${id}`).then((res) => {
71
80
  return res.data;
72
81
  });
73
- },
74
- list: async (condition, params = undefined) => {
75
- let axios = await this.context.ready;
82
+ }),
83
+ list: (condition_1, ...args_1) => __awaiter(this, [condition_1, ...args_1], void 0, function* (condition, params = undefined) {
84
+ let axios = yield this.context.ready;
76
85
  var url = `/api/v2/device/list`;
77
86
  if (params) {
78
87
  //if params is string
@@ -89,53 +98,53 @@ class DeviceGateway extends Object {
89
98
  return axios.post(url, condition).then((res) => {
90
99
  return res.data;
91
100
  });
92
- },
93
- preview: async (type, sn) => {
94
- let axios = await this.context.ready;
101
+ }),
102
+ preview: (type, sn) => __awaiter(this, void 0, void 0, function* () {
103
+ let axios = yield this.context.ready;
95
104
  return axios.get(`/api/v2/device/iotValue/${type}/${sn}`).then((res) => {
96
105
  return res.data;
97
106
  });
98
- },
107
+ }),
99
108
  };
100
109
  }
101
110
  get thresholdConfig() {
102
111
  return {
103
- list: async (factory) => {
104
- let axios = await this.context.ready;
112
+ list: (factory) => __awaiter(this, void 0, void 0, function* () {
113
+ let axios = yield this.context.ready;
105
114
  return axios.get(`/api/v2/threshold/config`, {
106
115
  params: {
107
116
  factoryId: factory === null || factory === void 0 ? void 0 : factory.id
108
117
  },
109
118
  });
110
- },
119
+ }),
111
120
  //新增或更新阈值配置,用于基础信息的更新或新增
112
- post: async (data) => {
113
- let axios = await this.context.ready;
121
+ post: (data) => __awaiter(this, void 0, void 0, function* () {
122
+ let axios = yield this.context.ready;
114
123
  return axios.post(`/api/v2/threshold/config`, data);
115
- },
124
+ }),
116
125
  //向阈值配置中新增一条规则
117
- addRule: async (configId, data) => {
118
- let axios = await this.context.ready;
126
+ addRule: (configId, data) => __awaiter(this, void 0, void 0, function* () {
127
+ let axios = yield this.context.ready;
119
128
  return axios.post(`/api/v2/threshold`, Object.assign(Object.assign({}, data), { configId: configId }));
120
- },
129
+ }),
121
130
  //删除阈值配置
122
- deleteRule: async (id) => {
123
- let axios = await this.context.ready;
131
+ deleteRule: (id) => __awaiter(this, void 0, void 0, function* () {
132
+ let axios = yield this.context.ready;
124
133
  return axios.post(`/api/v2/threshold/delete`, {
125
134
  id: id,
126
135
  });
127
- },
136
+ }),
128
137
  //读取阈值配置,包括阈值规则列表
129
- get: async (configId) => {
130
- let axios = await this.context.ready;
138
+ get: (configId) => __awaiter(this, void 0, void 0, function* () {
139
+ let axios = yield this.context.ready;
131
140
  return axios.get(`/api/v2/threshold/config/${configId}`);
132
- },
133
- delete: async (id) => {
134
- let axios = await this.context.ready;
141
+ }),
142
+ delete: (id) => __awaiter(this, void 0, void 0, function* () {
143
+ let axios = yield this.context.ready;
135
144
  return axios.post(`/api/v2/threshold/config/delete`, {
136
145
  id: id
137
146
  });
138
- },
147
+ }),
139
148
  };
140
149
  }
141
150
  constructor(context) {
@@ -173,19 +182,21 @@ class DeviceGateway extends Object {
173
182
  show(id, type = "datapoint") {
174
183
  this.context.platform.showInDeviceManager(id, type);
175
184
  }
176
- async watch(ids, fn, showLast = true) {
177
- var axios = await this.context.ready;
178
- var idQuery = "";
179
- if (Array.isArray(ids)) {
180
- idQuery = ids.map(x => `ids=${x}`).join("&");
181
- }
182
- else {
183
- idQuery = `ids=${ids}`;
184
- }
185
- if (showLast) {
186
- idQuery += "&show-last=true";
187
- }
188
- return axios.getAsSse(`/api/v1/device/watch?` + idQuery, fn);
185
+ watch(ids_1, fn_1) {
186
+ return __awaiter(this, arguments, void 0, function* (ids, fn, showLast = true) {
187
+ var axios = yield this.context.ready;
188
+ var idQuery = "";
189
+ if (Array.isArray(ids)) {
190
+ idQuery = ids.map(x => `ids=${x}`).join("&");
191
+ }
192
+ else {
193
+ idQuery = `ids=${ids}`;
194
+ }
195
+ if (showLast) {
196
+ idQuery += "&show-last=true";
197
+ }
198
+ return axios.getAsSse(`/api/v1/device/watch?` + idQuery, fn);
199
+ });
189
200
  }
190
201
  getFilter(type, cls) {
191
202
  // 如果filters中已经有对应type的过滤器,则直接返回该过滤器
@@ -226,61 +237,69 @@ class DeviceGateway extends Object {
226
237
  }) {
227
238
  return this.normalFilter.getData(id, args);
228
239
  }
229
- async info(id) {
230
- let axios = await this.context.ready;
231
- return axios.get(`/api/v1/device/info/${id}`);
240
+ info(id) {
241
+ return __awaiter(this, void 0, void 0, function* () {
242
+ let axios = yield this.context.ready;
243
+ return axios.get(`/api/v1/device/info/${id}`);
244
+ });
232
245
  }
233
- async validate(serialNumbers, type = "pywl") {
234
- let axios = await this.context.ready;
235
- return axios.post(`/api/v2/device/validateSerialNumber`, {
236
- serialNumbers,
237
- type,
246
+ validate(serialNumbers_1) {
247
+ return __awaiter(this, arguments, void 0, function* (serialNumbers, type = "pywl") {
248
+ let axios = yield this.context.ready;
249
+ return axios.post(`/api/v2/device/validateSerialNumber`, {
250
+ serialNumbers,
251
+ type,
252
+ });
238
253
  });
239
254
  }
240
- async batchValidate(serialNumbers, type = "pywl") {
241
- let axios = await this.context.ready;
242
- return axios.upload(`/api/v2/device/batchValidate`, {
243
- serialNumbers,
244
- type,
255
+ batchValidate(serialNumbers_1) {
256
+ return __awaiter(this, arguments, void 0, function* (serialNumbers, type = "pywl") {
257
+ let axios = yield this.context.ready;
258
+ return axios.upload(`/api/v2/device/batchValidate`, {
259
+ serialNumbers,
260
+ type,
261
+ });
245
262
  });
246
263
  }
247
- async faults(deviceId, startTime, endTime) {
248
- let axios = await this.context.ready;
249
- const startTimeRfc3339 = startTime.toISOString();
250
- const endTimeRfc3339 = endTime.toISOString();
251
- const response = await axios.get(`/api/v1/device/${deviceId}/faults?start=${startTimeRfc3339}&stop=${endTimeRfc3339}`);
252
- const json = response.data;
253
- var faultsData = json.faults;
254
- // #group,false,false,true,true,false,false,true,true,true,true,true,true
255
- // #datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,boolean,string,string,string,string,string,string
256
- // #default,last,,,,,,,,,,,
257
- // ,result,table,_start,_stop,_time,_value,DeviceId,_field,_measurement,category,field,status
258
- // ,,0,2025-04-20T22:07:43.623582865Z,2025-04-21T04:07:43.623582865Z,2025-04-21T00:27:00Z,false,004a05c1-7b5b-471c-ab68-f583039ddcfe,bool_value,DeviceStatus,离线报警,online,fault
259
- // ,,0,2025-04-20T22:07:43.623582865Z,2025-04-21T04:07:43.623582865Z,2025-04-21T00:30:00Z,true,004a05c1-7b5b-471c-ab68-f583039ddcfe,bool_value,DeviceStatus,离线报警,online,fault
260
- // ,,1,2025-04-20T22:07:43.623582865Z,2025-04-21T04:07:43.623582865Z,2025-04-21T00:27:00Z,false,004a05c1-7b5b-471c-ab68-f583039ddcfe,repeated,DeviceStatus,离线报警,online,fault
261
- // ,,1,2025-04-20T22:07:43.623582865Z,2025-04-21T04:07:43.623582865Z,2025-04-21T00:30:00Z,false,004a05c1-7b5b-471c-ab68-f583039ddcfe,repeated,DeviceStatus,离线报警,online,fault
262
- // ,,2,2025-04-20T22:07:43.623582865Z,2025-04-21T04:07:43.623582865Z,2025-04-21T00:27:00Z,false,004a05c1-7b5b-471c-ab68-f583039ddcfe,resolved,DeviceStatus,离线报警,online,fault
263
- // ,,2,2025-04-20T22:07:43.623582865Z,2025-04-21T04:07:43.623582865Z,2025-04-21T00:30:00Z,true,004a05c1-7b5b-471c-ab68-f583039ddcfe,resolved,DeviceStatus,离线报警,online,fault
264
- faultsData = faultsData.replace(/\r/g, "");
265
- var arr = faultsData.split("\n");
266
- var inAnnotation = false;
267
- var columns = [];
268
- var faults = [];
269
- for (var i = 0; i < arr.length; i++) {
270
- var values = arr[i].split(",");
271
- if (arr[i].startsWith("#")) {
272
- }
273
- else if (arr[i] != "") {
274
- if (inAnnotation) {
275
- inAnnotation = false;
276
- columns = values;
264
+ faults(deviceId, startTime, endTime) {
265
+ return __awaiter(this, void 0, void 0, function* () {
266
+ let axios = yield this.context.ready;
267
+ const startTimeRfc3339 = startTime.toISOString();
268
+ const endTimeRfc3339 = endTime.toISOString();
269
+ const response = yield axios.get(`/api/v1/device/${deviceId}/faults?start=${startTimeRfc3339}&stop=${endTimeRfc3339}`);
270
+ const json = response.data;
271
+ var faultsData = json.faults;
272
+ // #group,false,false,true,true,false,false,true,true,true,true,true,true
273
+ // #datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,boolean,string,string,string,string,string,string
274
+ // #default,last,,,,,,,,,,,
275
+ // ,result,table,_start,_stop,_time,_value,DeviceId,_field,_measurement,category,field,status
276
+ // ,,0,2025-04-20T22:07:43.623582865Z,2025-04-21T04:07:43.623582865Z,2025-04-21T00:27:00Z,false,004a05c1-7b5b-471c-ab68-f583039ddcfe,bool_value,DeviceStatus,离线报警,online,fault
277
+ // ,,0,2025-04-20T22:07:43.623582865Z,2025-04-21T04:07:43.623582865Z,2025-04-21T00:30:00Z,true,004a05c1-7b5b-471c-ab68-f583039ddcfe,bool_value,DeviceStatus,离线报警,online,fault
278
+ // ,,1,2025-04-20T22:07:43.623582865Z,2025-04-21T04:07:43.623582865Z,2025-04-21T00:27:00Z,false,004a05c1-7b5b-471c-ab68-f583039ddcfe,repeated,DeviceStatus,离线报警,online,fault
279
+ // ,,1,2025-04-20T22:07:43.623582865Z,2025-04-21T04:07:43.623582865Z,2025-04-21T00:30:00Z,false,004a05c1-7b5b-471c-ab68-f583039ddcfe,repeated,DeviceStatus,离线报警,online,fault
280
+ // ,,2,2025-04-20T22:07:43.623582865Z,2025-04-21T04:07:43.623582865Z,2025-04-21T00:27:00Z,false,004a05c1-7b5b-471c-ab68-f583039ddcfe,resolved,DeviceStatus,离线报警,online,fault
281
+ // ,,2,2025-04-20T22:07:43.623582865Z,2025-04-21T04:07:43.623582865Z,2025-04-21T00:30:00Z,true,004a05c1-7b5b-471c-ab68-f583039ddcfe,resolved,DeviceStatus,离线报警,online,fault
282
+ faultsData = faultsData.replace(/\r/g, "");
283
+ var arr = faultsData.split("\n");
284
+ var inAnnotation = false;
285
+ var columns = [];
286
+ var faults = [];
287
+ for (var i = 0; i < arr.length; i++) {
288
+ var values = arr[i].split(",");
289
+ if (arr[i].startsWith("#")) {
277
290
  }
278
- else {
279
- faults.push(new DeviceFault(values, columns));
291
+ else if (arr[i] != "") {
292
+ if (inAnnotation) {
293
+ inAnnotation = false;
294
+ columns = values;
295
+ }
296
+ else {
297
+ faults.push(new DeviceFault(values, columns));
298
+ }
280
299
  }
281
300
  }
282
- }
283
- return faults;
301
+ return faults;
302
+ });
284
303
  }
285
304
  // 报告设备问题
286
305
  report(id, status, description) {
@@ -405,9 +424,9 @@ class DeviceGateway extends Object {
405
424
  //v1的设备实际是点位,v3的设备才是真正的设备
406
425
  return {
407
426
  list: (args = {}) => {
408
- return this.context.ready.then(async () => {
427
+ return this.context.ready.then(() => __awaiter(this, void 0, void 0, function* () {
409
428
  if (args.factoryId == undefined) {
410
- var farm = await this.context.user.getSelectedFarm();
429
+ var farm = yield this.context.user.getSelectedFarm();
411
430
  args.factoryId = farm.id;
412
431
  }
413
432
  return this.context.axios.get(`/api/v3/device/list`, {
@@ -417,7 +436,7 @@ class DeviceGateway extends Object {
417
436
  factory_id: args.factoryId
418
437
  }
419
438
  });
420
- });
439
+ }));
421
440
  },
422
441
  detail: (id) => {
423
442
  return this.context.ready.then(() => {
@@ -537,18 +556,18 @@ class DeviceGateway extends Object {
537
556
  }
538
557
  get trouble() {
539
558
  return {
540
- list: async (args = {
559
+ list: (...args_1) => __awaiter(this, [...args_1], void 0, function* (args = {
541
560
  sourceType: "device",
542
561
  pageNum: 1,
543
562
  pageSize: 10,
544
- }) => {
545
- const axios = await this.context.ready;
563
+ }) {
564
+ const axios = yield this.context.ready;
546
565
  return axios.get('/api/v3/device/trouble/list', {
547
566
  params: args
548
567
  });
549
- },
550
- create: async (data) => {
551
- const axios = await this.context.ready;
568
+ }),
569
+ create: (data) => __awaiter(this, void 0, void 0, function* () {
570
+ const axios = yield this.context.ready;
552
571
  return axios.post('/api/v3/device/trouble/create', data)
553
572
  .then((res) => {
554
573
  if (res.data.code !== 200) {
@@ -556,9 +575,9 @@ class DeviceGateway extends Object {
556
575
  }
557
576
  return res.data;
558
577
  });
559
- },
560
- history: async (troubleId) => {
561
- const axios = await this.context.ready;
578
+ }),
579
+ history: (troubleId) => __awaiter(this, void 0, void 0, function* () {
580
+ const axios = yield this.context.ready;
562
581
  return axios.get(`/api/v3/device/trouble/${troubleId}/handle-records`)
563
582
  .then((res) => {
564
583
  if (res.data.code !== 200) {
@@ -566,9 +585,9 @@ class DeviceGateway extends Object {
566
585
  }
567
586
  return res.data;
568
587
  });
569
- },
570
- delete: async (troubleIds) => {
571
- const axios = await this.context.ready;
588
+ }),
589
+ delete: (troubleIds) => __awaiter(this, void 0, void 0, function* () {
590
+ const axios = yield this.context.ready;
572
591
  return axios.delete('/api/v3/device/trouble/delete', troubleIds)
573
592
  .then((res) => {
574
593
  if (res.data.code !== 200) {
@@ -576,112 +595,112 @@ class DeviceGateway extends Object {
576
595
  }
577
596
  return res.data;
578
597
  });
579
- },
598
+ }),
580
599
  };
581
600
  }
582
601
  get troubleType() {
583
602
  return {
584
603
  // 获取根节点(原list方法)
585
- list: async () => {
586
- var axios = await this.context.ready;
604
+ list: () => __awaiter(this, void 0, void 0, function* () {
605
+ var axios = yield this.context.ready;
587
606
  return axios.get('/api/v3/device/trouble-type');
588
- },
607
+ }),
589
608
  // 获取直接子节点
590
- getDirectChildren: async (id) => {
591
- var axios = await this.context.ready;
609
+ getDirectChildren: (id) => __awaiter(this, void 0, void 0, function* () {
610
+ var axios = yield this.context.ready;
592
611
  return axios.get(`/api/v3/device/trouble-type/${id}`);
593
- },
612
+ }),
594
613
  // 获取所有子节点
595
- getAllChildren: async (id) => {
596
- var axios = await this.context.ready;
614
+ getAllChildren: (id) => __awaiter(this, void 0, void 0, function* () {
615
+ var axios = yield this.context.ready;
597
616
  return axios.get(`/api/v3/device/trouble-type/${id}/all`);
598
- },
617
+ }),
599
618
  // 获取完整树结构
600
- getTree: async () => {
601
- var axios = await this.context.ready;
619
+ getTree: () => __awaiter(this, void 0, void 0, function* () {
620
+ var axios = yield this.context.ready;
602
621
  return axios.get('/api/v3/device/trouble-type/tree');
603
- },
622
+ }),
604
623
  // 创建节点
605
- create: async (data) => {
606
- var axios = await this.context.ready;
624
+ create: (data) => __awaiter(this, void 0, void 0, function* () {
625
+ var axios = yield this.context.ready;
607
626
  return axios.post('/api/v3/device/trouble-type', data);
608
- },
627
+ }),
609
628
  // 删除节点(根据Java控制器的DeleteMapping)
610
- delete: async (id) => {
611
- var axios = await this.context.ready;
629
+ delete: (id) => __awaiter(this, void 0, void 0, function* () {
630
+ var axios = yield this.context.ready;
612
631
  return axios.delete(`/api/v3/device/trouble-type/${id}`);
613
- }
632
+ })
614
633
  };
615
634
  }
616
635
  get model() {
617
636
  return {
618
- list: async (manufacturerId) => {
619
- var axios = await this.context.ready;
637
+ list: (manufacturerId) => __awaiter(this, void 0, void 0, function* () {
638
+ var axios = yield this.context.ready;
620
639
  if (manufacturerId === undefined) {
621
640
  return axios.get('/api/v3/device/model');
622
641
  }
623
642
  else {
624
643
  return axios.get(`/api/v3/device/manufacturer/${manufacturerId}/models`);
625
644
  }
626
- },
627
- create: async (data) => {
628
- var axios = await this.context.ready;
645
+ }),
646
+ create: (data) => __awaiter(this, void 0, void 0, function* () {
647
+ var axios = yield this.context.ready;
629
648
  return axios.post('/api/v3/device/model', data);
630
- },
631
- update: async (id, data) => {
632
- var axios = await this.context.ready;
649
+ }),
650
+ update: (id, data) => __awaiter(this, void 0, void 0, function* () {
651
+ var axios = yield this.context.ready;
633
652
  return axios.put(`/api/v3/device/model/${id}`, data);
634
- },
635
- delete: async (id) => {
636
- var axios = await this.context.ready;
653
+ }),
654
+ delete: (id) => __awaiter(this, void 0, void 0, function* () {
655
+ var axios = yield this.context.ready;
637
656
  return axios.delete(`/api/v3/device/model/${id}`);
638
- },
639
- detail: async (id) => {
640
- var axios = await this.context.ready;
657
+ }),
658
+ detail: (id) => __awaiter(this, void 0, void 0, function* () {
659
+ var axios = yield this.context.ready;
641
660
  return axios.get(`/api/v3/device/model/${id}`);
642
- }
661
+ })
643
662
  };
644
663
  }
645
664
  get maintenanceGroup() {
646
665
  return {
647
666
  // 获取维护组列表
648
- list: async (factoryId) => {
649
- const axios = await this.context.ready;
667
+ list: (factoryId) => __awaiter(this, void 0, void 0, function* () {
668
+ const axios = yield this.context.ready;
650
669
  return axios.get('/api/v3/device/maintenance-groups', {
651
670
  params: { factoryId }
652
671
  });
653
- },
672
+ }),
654
673
  // 创建维护组
655
- create: async (factoryId, group) => {
656
- const axios = await this.context.ready;
674
+ create: (factoryId, group) => __awaiter(this, void 0, void 0, function* () {
675
+ const axios = yield this.context.ready;
657
676
  return axios.post(`/api/v3/device/maintenance-groups?factoryId=${factoryId}`, group);
658
- },
677
+ }),
659
678
  // 删除维护组
660
- delete: async (factoryId, groupId) => {
661
- const axios = await this.context.ready;
679
+ delete: (factoryId, groupId) => __awaiter(this, void 0, void 0, function* () {
680
+ const axios = yield this.context.ready;
662
681
  return axios.delete(`/api/v3/device/maintenance-groups/${groupId}`, {
663
682
  params: { factoryId }
664
683
  });
665
- },
684
+ }),
666
685
  };
667
686
  }
668
687
  generateFunctionsForDict(dictName) {
669
688
  return {
670
689
  // 获取维护类型列表
671
- list: async (factoryId) => {
672
- const axios = await this.context.ready;
690
+ list: (factoryId) => __awaiter(this, void 0, void 0, function* () {
691
+ const axios = yield this.context.ready;
673
692
  return axios.get(`/api/v3/device/${dictName}`, {
674
693
  params: { factoryId }
675
694
  });
676
- },
677
- create: async (data) => {
678
- var axios = await this.context.ready;
695
+ }),
696
+ create: (data) => __awaiter(this, void 0, void 0, function* () {
697
+ var axios = yield this.context.ready;
679
698
  return axios.post(`/api/v3/device/${dictName}`, data);
680
- },
681
- delete: async (id) => {
682
- var axios = await this.context.ready;
699
+ }),
700
+ delete: (id) => __awaiter(this, void 0, void 0, function* () {
701
+ var axios = yield this.context.ready;
683
702
  return axios.delete(`/api/v3/device/${dictName}/${id}`);
684
- }
703
+ })
685
704
  };
686
705
  }
687
706
  get usage() {
@@ -691,8 +710,8 @@ class DeviceGateway extends Object {
691
710
  * @param deviceId 设备ID
692
711
  * @returns Promise 包含设备使用情况的数据
693
712
  */
694
- get: async (deviceId) => {
695
- const axios = await this.context.ready;
713
+ get: (deviceId) => __awaiter(this, void 0, void 0, function* () {
714
+ const axios = yield this.context.ready;
696
715
  return axios.get(`/api/v3/device/usage/${deviceId}`)
697
716
  .then((res) => {
698
717
  if (res.data.code !== 200) {
@@ -700,15 +719,15 @@ class DeviceGateway extends Object {
700
719
  }
701
720
  return res.data;
702
721
  });
703
- },
722
+ }),
704
723
  /**
705
724
  * 更新设备使用情况
706
725
  * @param deviceId 设备ID
707
726
  * @param usageData 使用情况数据
708
727
  * @returns Promise 包含更新后的设备使用情况数据
709
728
  */
710
- update: async (deviceId, usageData) => {
711
- const axios = await this.context.ready;
729
+ update: (deviceId, usageData) => __awaiter(this, void 0, void 0, function* () {
730
+ const axios = yield this.context.ready;
712
731
  return axios.put(`/api/v3/device/usage/${deviceId}`, usageData)
713
732
  .then((res) => {
714
733
  if (res.data.code !== 200) {
@@ -716,39 +735,39 @@ class DeviceGateway extends Object {
716
735
  }
717
736
  return res.data;
718
737
  });
719
- }
738
+ })
720
739
  };
721
740
  }
722
741
  get disinfect() {
723
742
  return {
724
- openDoor: async (deviceId, door, open) => {
725
- var axios = await this.context.ready;
743
+ openDoor: (deviceId, door, open) => __awaiter(this, void 0, void 0, function* () {
744
+ var axios = yield this.context.ready;
726
745
  return axios.post(`/api/v2/disinfect/${deviceId}`, { door, open });
727
- },
728
- action: async (deviceId, action) => {
729
- var axios = await this.context.ready;
746
+ }),
747
+ action: (deviceId, action) => __awaiter(this, void 0, void 0, function* () {
748
+ var axios = yield this.context.ready;
730
749
  return axios.post(`/api/v2/disinfect/${deviceId}`, { action });
731
- },
750
+ }),
732
751
  config: {
733
- set: async (deviceId, config) => {
734
- let axios = await this.context.ready;
752
+ set: (deviceId, config) => __awaiter(this, void 0, void 0, function* () {
753
+ let axios = yield this.context.ready;
735
754
  return axios.post(`/api/v2/disinfect/${deviceId}/params`, config).then((res) => {
736
755
  return res.data;
737
756
  });
738
- },
739
- get: async (deviceId) => {
740
- let axios = await this.context.ready;
757
+ }),
758
+ get: (deviceId) => __awaiter(this, void 0, void 0, function* () {
759
+ let axios = yield this.context.ready;
741
760
  return axios.get(`/api/v2/disinfect/${deviceId}/params`).then((res) => {
742
761
  return res.data;
743
762
  });
744
- }
763
+ })
745
764
  },
746
- history: async (deviceId, pageNum, pageSize) => {
747
- let axios = await this.context.ready;
765
+ history: (deviceId, pageNum, pageSize) => __awaiter(this, void 0, void 0, function* () {
766
+ let axios = yield this.context.ready;
748
767
  return axios.get(`/api/v2/disinfect/${deviceId}`, { params: { pageNum, pageSize } }).then((res) => {
749
768
  return res.data;
750
769
  });
751
- }
770
+ })
752
771
  };
753
772
  }
754
773
  }