@cpzxrobot/sdk 1.3.27 → 1.3.29
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 +123 -1
- package/dist/device_gateway.js +95 -0
- package/dist/project_gateway.js +10 -0
- package/package.json +1 -1
- package/project_gateway.ts +13 -0
package/device_gateway.ts
CHANGED
|
@@ -433,6 +433,18 @@ export class DeviceGateway extends Object {
|
|
|
433
433
|
});
|
|
434
434
|
},
|
|
435
435
|
|
|
436
|
+
// 获取控制点信息
|
|
437
|
+
point: (deviceId: number, paramType: string, partName: string, pointId: string): Promise<any> => {
|
|
438
|
+
return this.context.ready.then(() => {
|
|
439
|
+
return this.context.axios.get(`/api/v2/device/ctrl/${deviceId}/${paramType}/${partName}/point/${pointId}`)
|
|
440
|
+
.then((res) => {
|
|
441
|
+
if (res.data.code != 200) {
|
|
442
|
+
throw res.data.message;
|
|
443
|
+
}
|
|
444
|
+
return res.data;
|
|
445
|
+
});
|
|
446
|
+
});
|
|
447
|
+
},
|
|
436
448
|
// 设置控制点值
|
|
437
449
|
setPoint: (deviceId: number, paramType: string, partName: string, pointId: string, value: any): Promise<any> => {
|
|
438
450
|
return this.context.ready.then(() => {
|
|
@@ -473,7 +485,6 @@ export class DeviceGateway extends Object {
|
|
|
473
485
|
}
|
|
474
486
|
};
|
|
475
487
|
}
|
|
476
|
-
|
|
477
488
|
get v3() {
|
|
478
489
|
//v1的设备实际是点位,v3的设备才是真正的设备
|
|
479
490
|
return {
|
|
@@ -512,10 +523,104 @@ export class DeviceGateway extends Object {
|
|
|
512
523
|
return this.context.ready.then(() => {
|
|
513
524
|
return this.context.axios.get(`/api/v3/device/manufacturer/list`);
|
|
514
525
|
});
|
|
526
|
+
},
|
|
527
|
+
/**
|
|
528
|
+
* 修改设备信息
|
|
529
|
+
* @param configId 设备配置ID
|
|
530
|
+
* @param data 更新数据
|
|
531
|
+
* @returns Promise
|
|
532
|
+
*/
|
|
533
|
+
edit: (configId: string, data: {
|
|
534
|
+
name: string;
|
|
535
|
+
manufacturer_id: number;
|
|
536
|
+
model_id: number;
|
|
537
|
+
timeout: number;
|
|
538
|
+
uuid: string;
|
|
539
|
+
}): Promise<any> => {
|
|
540
|
+
return this.context.ready.then(() => {
|
|
541
|
+
return this.context.axios.post(
|
|
542
|
+
`/api/v3/device/update/${configId}`,
|
|
543
|
+
data
|
|
544
|
+
);
|
|
545
|
+
});
|
|
515
546
|
}
|
|
516
547
|
}
|
|
517
548
|
}
|
|
518
549
|
|
|
550
|
+
get supplier() {
|
|
551
|
+
return {
|
|
552
|
+
/**
|
|
553
|
+
* 获取供应商详情
|
|
554
|
+
* @param id 供应商ID
|
|
555
|
+
* @returns Promise
|
|
556
|
+
*/
|
|
557
|
+
get: (id: number): Promise<any> => {
|
|
558
|
+
return this.context.ready.then(() => {
|
|
559
|
+
return this.context.axios.get(`/api/v3/device/suppliers/${id}`);
|
|
560
|
+
});
|
|
561
|
+
},
|
|
562
|
+
/**
|
|
563
|
+
* 获取所有供应商列表
|
|
564
|
+
* @param keyword 搜索关键词(可选)
|
|
565
|
+
* @returns Promise
|
|
566
|
+
*/
|
|
567
|
+
list: (keyword?: string): Promise<any> => {
|
|
568
|
+
return this.context.ready.then(() => {
|
|
569
|
+
return this.context.axios.get(`/api/v3/device/suppliers`, {
|
|
570
|
+
params: {
|
|
571
|
+
keyword: keyword
|
|
572
|
+
}
|
|
573
|
+
});
|
|
574
|
+
});
|
|
575
|
+
},
|
|
576
|
+
/**
|
|
577
|
+
* 创建新供应商
|
|
578
|
+
* @param data 供应商数据
|
|
579
|
+
* @returns Promise
|
|
580
|
+
*/
|
|
581
|
+
create: (data: {
|
|
582
|
+
name: string;
|
|
583
|
+
code?: string;
|
|
584
|
+
contact?: string;
|
|
585
|
+
phone?: string;
|
|
586
|
+
address?: string;
|
|
587
|
+
remark?: string;
|
|
588
|
+
}): Promise<any> => {
|
|
589
|
+
return this.context.ready.then(() => {
|
|
590
|
+
return this.context.axios.post(`/api/v3/device/suppliers`, data);
|
|
591
|
+
});
|
|
592
|
+
},
|
|
593
|
+
/**
|
|
594
|
+
* 更新供应商信息
|
|
595
|
+
* @param id 供应商ID
|
|
596
|
+
* @param data 更新数据
|
|
597
|
+
* @returns Promise
|
|
598
|
+
*/
|
|
599
|
+
update: (id: number, data: {
|
|
600
|
+
name?: string;
|
|
601
|
+
code?: string;
|
|
602
|
+
contact?: string;
|
|
603
|
+
phone?: string;
|
|
604
|
+
address?: string;
|
|
605
|
+
remark?: string;
|
|
606
|
+
}): Promise<any> => {
|
|
607
|
+
return this.context.ready.then(() => {
|
|
608
|
+
return this.context.axios.put(`/api/v3/device/suppliers/${id}`, data);
|
|
609
|
+
});
|
|
610
|
+
},
|
|
611
|
+
/**
|
|
612
|
+
* 删除供应商
|
|
613
|
+
* @param id 供应商ID
|
|
614
|
+
* @returns Promise
|
|
615
|
+
*/
|
|
616
|
+
delete: (id: number): Promise<any> => {
|
|
617
|
+
return this.context.ready.then(() => {
|
|
618
|
+
return this.context.axios.delete(`/api/v3/device/suppliers/${id}`);
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
|
|
519
624
|
get purpose() {
|
|
520
625
|
return {
|
|
521
626
|
list: (parentId: number | undefined): Promise<any> => {
|
|
@@ -551,6 +656,23 @@ export class DeviceGateway extends Object {
|
|
|
551
656
|
}
|
|
552
657
|
}
|
|
553
658
|
|
|
659
|
+
get trouble() {
|
|
660
|
+
return {
|
|
661
|
+
list: async (
|
|
662
|
+
pageNum: number = 1,
|
|
663
|
+
pageSize: number = 10
|
|
664
|
+
): Promise<any> => {
|
|
665
|
+
const axios = await this.context.ready;
|
|
666
|
+
return axios.get('/api/v3/device/trouble/list', {
|
|
667
|
+
params: {
|
|
668
|
+
pageNum,
|
|
669
|
+
pageSize
|
|
670
|
+
}
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
|
|
554
676
|
get model() {
|
|
555
677
|
return {
|
|
556
678
|
list: async (manufacturerId: Number | undefined): Promise<any> => {
|
package/dist/device_gateway.js
CHANGED
|
@@ -327,6 +327,18 @@ class DeviceGateway extends Object {
|
|
|
327
327
|
});
|
|
328
328
|
});
|
|
329
329
|
},
|
|
330
|
+
// 获取控制点信息
|
|
331
|
+
point: (deviceId, paramType, partName, pointId) => {
|
|
332
|
+
return this.context.ready.then(() => {
|
|
333
|
+
return this.context.axios.get(`/api/v2/device/ctrl/${deviceId}/${paramType}/${partName}/point/${pointId}`)
|
|
334
|
+
.then((res) => {
|
|
335
|
+
if (res.data.code != 200) {
|
|
336
|
+
throw res.data.message;
|
|
337
|
+
}
|
|
338
|
+
return res.data;
|
|
339
|
+
});
|
|
340
|
+
});
|
|
341
|
+
},
|
|
330
342
|
// 设置控制点值
|
|
331
343
|
setPoint: (deviceId, paramType, partName, pointId, value) => {
|
|
332
344
|
return this.context.ready.then(() => {
|
|
@@ -397,6 +409,76 @@ class DeviceGateway extends Object {
|
|
|
397
409
|
return this.context.ready.then(() => {
|
|
398
410
|
return this.context.axios.get(`/api/v3/device/manufacturer/list`);
|
|
399
411
|
});
|
|
412
|
+
},
|
|
413
|
+
/**
|
|
414
|
+
* 修改设备信息
|
|
415
|
+
* @param configId 设备配置ID
|
|
416
|
+
* @param data 更新数据
|
|
417
|
+
* @returns Promise
|
|
418
|
+
*/
|
|
419
|
+
edit: (configId, data) => {
|
|
420
|
+
return this.context.ready.then(() => {
|
|
421
|
+
return this.context.axios.post(`/api/v3/device/update/${configId}`, data);
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
get supplier() {
|
|
427
|
+
return {
|
|
428
|
+
/**
|
|
429
|
+
* 获取供应商详情
|
|
430
|
+
* @param id 供应商ID
|
|
431
|
+
* @returns Promise
|
|
432
|
+
*/
|
|
433
|
+
get: (id) => {
|
|
434
|
+
return this.context.ready.then(() => {
|
|
435
|
+
return this.context.axios.get(`/api/v3/device/suppliers/${id}`);
|
|
436
|
+
});
|
|
437
|
+
},
|
|
438
|
+
/**
|
|
439
|
+
* 获取所有供应商列表
|
|
440
|
+
* @param keyword 搜索关键词(可选)
|
|
441
|
+
* @returns Promise
|
|
442
|
+
*/
|
|
443
|
+
list: (keyword) => {
|
|
444
|
+
return this.context.ready.then(() => {
|
|
445
|
+
return this.context.axios.get(`/api/v3/device/suppliers`, {
|
|
446
|
+
params: {
|
|
447
|
+
keyword: keyword
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
});
|
|
451
|
+
},
|
|
452
|
+
/**
|
|
453
|
+
* 创建新供应商
|
|
454
|
+
* @param data 供应商数据
|
|
455
|
+
* @returns Promise
|
|
456
|
+
*/
|
|
457
|
+
create: (data) => {
|
|
458
|
+
return this.context.ready.then(() => {
|
|
459
|
+
return this.context.axios.post(`/api/v3/device/suppliers`, data);
|
|
460
|
+
});
|
|
461
|
+
},
|
|
462
|
+
/**
|
|
463
|
+
* 更新供应商信息
|
|
464
|
+
* @param id 供应商ID
|
|
465
|
+
* @param data 更新数据
|
|
466
|
+
* @returns Promise
|
|
467
|
+
*/
|
|
468
|
+
update: (id, data) => {
|
|
469
|
+
return this.context.ready.then(() => {
|
|
470
|
+
return this.context.axios.put(`/api/v3/device/suppliers/${id}`, data);
|
|
471
|
+
});
|
|
472
|
+
},
|
|
473
|
+
/**
|
|
474
|
+
* 删除供应商
|
|
475
|
+
* @param id 供应商ID
|
|
476
|
+
* @returns Promise
|
|
477
|
+
*/
|
|
478
|
+
delete: (id) => {
|
|
479
|
+
return this.context.ready.then(() => {
|
|
480
|
+
return this.context.axios.delete(`/api/v3/device/suppliers/${id}`);
|
|
481
|
+
});
|
|
400
482
|
}
|
|
401
483
|
};
|
|
402
484
|
}
|
|
@@ -424,6 +506,19 @@ class DeviceGateway extends Object {
|
|
|
424
506
|
}
|
|
425
507
|
};
|
|
426
508
|
}
|
|
509
|
+
get trouble() {
|
|
510
|
+
return {
|
|
511
|
+
list: async (pageNum = 1, pageSize = 10) => {
|
|
512
|
+
const axios = await this.context.ready;
|
|
513
|
+
return axios.get('/api/v3/device/trouble/list', {
|
|
514
|
+
params: {
|
|
515
|
+
pageNum,
|
|
516
|
+
pageSize
|
|
517
|
+
}
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
};
|
|
521
|
+
}
|
|
427
522
|
get model() {
|
|
428
523
|
return {
|
|
429
524
|
list: async (manufacturerId) => {
|
package/dist/project_gateway.js
CHANGED
|
@@ -368,6 +368,16 @@ class ProjectGateway extends Object {
|
|
|
368
368
|
return axios.get(`/api/v2/coremde-sale/project/bom-config/history?id=${id}`);
|
|
369
369
|
});
|
|
370
370
|
},
|
|
371
|
+
/**
|
|
372
|
+
* 查看历史报价配置单详情(产品明细、审核结果、文件资料等)
|
|
373
|
+
* @param id 历史报价配置单ID
|
|
374
|
+
* @returns Promise
|
|
375
|
+
*/
|
|
376
|
+
historyDetail: (id) => {
|
|
377
|
+
return this.context.ready.then((axios) => {
|
|
378
|
+
return axios.get(`/api/v2/coremde-sale/project/bom-config/history-detail?id=${id}`);
|
|
379
|
+
});
|
|
380
|
+
},
|
|
371
381
|
};
|
|
372
382
|
}
|
|
373
383
|
get plan() {
|
package/package.json
CHANGED
package/project_gateway.ts
CHANGED
|
@@ -555,6 +555,19 @@ export class ProjectGateway extends Object {
|
|
|
555
555
|
)
|
|
556
556
|
})
|
|
557
557
|
},
|
|
558
|
+
/**
|
|
559
|
+
* 查看历史报价配置单详情(产品明细、审核结果、文件资料等)
|
|
560
|
+
* @param id 历史报价配置单ID
|
|
561
|
+
* @returns Promise
|
|
562
|
+
*/
|
|
563
|
+
historyDetail: (id: number) => {
|
|
564
|
+
return this.context.ready.then((axios) => {
|
|
565
|
+
return axios.get(
|
|
566
|
+
`/api/v2/coremde-sale/project/bom-config/history-detail?id=${id}`
|
|
567
|
+
)
|
|
568
|
+
})
|
|
569
|
+
},
|
|
570
|
+
|
|
558
571
|
}
|
|
559
572
|
}
|
|
560
573
|
|