@cpzxrobot/sdk 1.2.61 → 1.2.62
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/construction_gateway.ts +51 -0
- package/dist/construction_gateway.js +35 -0
- package/dist/energy_gateway.js +1 -1
- package/dist/index.js +3 -1
- package/dist/project_gateway.js +19 -0
- package/energy_gateway.ts +1 -1
- package/index.ts +3 -1
- package/package.json +1 -1
- package/project_gateway.readme.md +55 -0
- package/project_gateway.ts +26 -0
- package/readme.md +1 -0
- package/types.d.ts +2 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Cpzxrobot } from "./types";
|
|
2
|
+
|
|
3
|
+
export class ConstructionGateway extends Object {
|
|
4
|
+
context: Cpzxrobot;
|
|
5
|
+
|
|
6
|
+
constructor(context: Cpzxrobot) {
|
|
7
|
+
super();
|
|
8
|
+
this.context = context;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 创建工程
|
|
13
|
+
* @param args 创建参数
|
|
14
|
+
* @returns Promise
|
|
15
|
+
*/
|
|
16
|
+
add(args: {
|
|
17
|
+
customerId: number;
|
|
18
|
+
name: string;
|
|
19
|
+
groupId: number;
|
|
20
|
+
}) {
|
|
21
|
+
return this.context.ready.then((axios) => {
|
|
22
|
+
return axios.post(`/api/v2/coremde-sale/construction/add`, args);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 分页获取工程列表
|
|
28
|
+
* @param args 查询参数
|
|
29
|
+
* @returns Promise
|
|
30
|
+
*/
|
|
31
|
+
list(args: {
|
|
32
|
+
pageNo: number;
|
|
33
|
+
pageSize: number;
|
|
34
|
+
createTimeStart?: string;
|
|
35
|
+
createTimeEnd?: string;
|
|
36
|
+
companyId?: number;
|
|
37
|
+
customerId?: number;
|
|
38
|
+
}) {
|
|
39
|
+
return this.context.ready.then((axios) => {
|
|
40
|
+
return axios.post(`/api/v2/coremde-sale/construction/list`, args);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
listAll(args: {
|
|
45
|
+
companyId?: number;
|
|
46
|
+
}) {
|
|
47
|
+
return this.context.ready.then((axios) => {
|
|
48
|
+
return axios.post(`/api/v2/coremde-sale/construction/list`, args);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConstructionGateway = void 0;
|
|
4
|
+
class ConstructionGateway extends Object {
|
|
5
|
+
constructor(context) {
|
|
6
|
+
super();
|
|
7
|
+
this.context = context;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 创建工程
|
|
11
|
+
* @param args 创建参数
|
|
12
|
+
* @returns Promise
|
|
13
|
+
*/
|
|
14
|
+
add(args) {
|
|
15
|
+
return this.context.ready.then((axios) => {
|
|
16
|
+
return axios.post(`/api/v2/coremde-sale/construction/add`, args);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 分页获取工程列表
|
|
21
|
+
* @param args 查询参数
|
|
22
|
+
* @returns Promise
|
|
23
|
+
*/
|
|
24
|
+
list(args) {
|
|
25
|
+
return this.context.ready.then((axios) => {
|
|
26
|
+
return axios.post(`/api/v2/coremde-sale/construction/list`, args);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
listAll(args) {
|
|
30
|
+
return this.context.ready.then((axios) => {
|
|
31
|
+
return axios.post(`/api/v2/coremde-sale/construction/list`, args);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.ConstructionGateway = ConstructionGateway;
|
package/dist/energy_gateway.js
CHANGED
|
@@ -20,7 +20,7 @@ class EnergyGateway extends Object {
|
|
|
20
20
|
* @param type 统计类型
|
|
21
21
|
* @param factoryId 工厂ID
|
|
22
22
|
*/
|
|
23
|
-
async stat(type, factoryId =
|
|
23
|
+
async stat(type, factoryId = undefined) {
|
|
24
24
|
if (!factoryId) {
|
|
25
25
|
var factory = await this.context.user.getSelectedFarm();
|
|
26
26
|
factoryId = factory.id;
|
package/dist/index.js
CHANGED
|
@@ -46,6 +46,7 @@ const logs_gateway_1 = require("./logs_gateway");
|
|
|
46
46
|
const robot_gateway_1 = require("./robot_gateway");
|
|
47
47
|
const quotation_gateway_1 = require("./quotation_gateway");
|
|
48
48
|
const ai_gateway_1 = require("./ai_gateway");
|
|
49
|
+
const construction_gateway_1 = require("./construction_gateway");
|
|
49
50
|
class Cpzxrobot {
|
|
50
51
|
constructor(appCode) {
|
|
51
52
|
this.pigfarm = new pigfarm_gateway_1.PigfarmGateway(this);
|
|
@@ -65,6 +66,7 @@ class Cpzxrobot {
|
|
|
65
66
|
this.robot = new robot_gateway_1.RobotGateway(this);
|
|
66
67
|
this.quotation = new quotation_gateway_1.QuotationGateway(this);
|
|
67
68
|
this.ai = new ai_gateway_1.AiGateway(this);
|
|
69
|
+
this.construction = new construction_gateway_1.ConstructionGateway(this);
|
|
68
70
|
//获取当前浏览器的域名
|
|
69
71
|
this.ready = new Promise((resolve, reject) => {
|
|
70
72
|
this.resolveReady = resolve;
|
|
@@ -106,7 +108,7 @@ class Cpzxrobot {
|
|
|
106
108
|
};
|
|
107
109
|
const instance = {
|
|
108
110
|
get: async (url, config) => {
|
|
109
|
-
if (config.params) {
|
|
111
|
+
if (config && config.params) {
|
|
110
112
|
url += "?" + new URLSearchParams(config.params).toString();
|
|
111
113
|
delete config.params;
|
|
112
114
|
}
|
package/dist/project_gateway.js
CHANGED
|
@@ -239,6 +239,25 @@ class ProjectGateway extends Object {
|
|
|
239
239
|
params: { groupId }
|
|
240
240
|
});
|
|
241
241
|
});
|
|
242
|
+
},
|
|
243
|
+
details: (projectId) => {
|
|
244
|
+
return this.context.ready.then((axios) => {
|
|
245
|
+
return axios.get(`/api/v2/coremde-sale/project/stage/details?projectId=${projectId}`);
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
get bom() {
|
|
251
|
+
return {
|
|
252
|
+
/**
|
|
253
|
+
* 技术部制作BOM单
|
|
254
|
+
* @param args BOM配置参数
|
|
255
|
+
* @returns Promise
|
|
256
|
+
*/
|
|
257
|
+
add: (args) => {
|
|
258
|
+
return this.context.ready.then((axios) => {
|
|
259
|
+
return axios.post(`/api/v2/coremde-sale/project/bom-config/add`, args);
|
|
260
|
+
});
|
|
242
261
|
}
|
|
243
262
|
};
|
|
244
263
|
}
|
package/energy_gateway.ts
CHANGED
|
@@ -22,7 +22,7 @@ export class EnergyGateway extends Object {
|
|
|
22
22
|
* @param type 统计类型
|
|
23
23
|
* @param factoryId 工厂ID
|
|
24
24
|
*/
|
|
25
|
-
async stat(type: string, factoryId: number |
|
|
25
|
+
async stat(type: string, factoryId: number | undefined = undefined): Promise<any> {
|
|
26
26
|
if (!factoryId) {
|
|
27
27
|
var factory = await this.context.user.getSelectedFarm();
|
|
28
28
|
factoryId = factory.id;
|
package/index.ts
CHANGED
|
@@ -21,6 +21,7 @@ import { LogsGateway } from "./logs_gateway";
|
|
|
21
21
|
import { RobotGateway } from "./robot_gateway";
|
|
22
22
|
import { QuotationGateway } from "./quotation_gateway";
|
|
23
23
|
import { AiGateway } from "./ai_gateway";
|
|
24
|
+
import { ConstructionGateway } from "./construction_gateway";
|
|
24
25
|
|
|
25
26
|
export class Cpzxrobot {
|
|
26
27
|
private static factorySelectorLoaded = false;
|
|
@@ -74,6 +75,7 @@ export class Cpzxrobot {
|
|
|
74
75
|
robot: RobotGateway = new RobotGateway(this);
|
|
75
76
|
quotation: QuotationGateway = new QuotationGateway(this);
|
|
76
77
|
ai: AiGateway = new AiGateway(this);
|
|
78
|
+
construction: ConstructionGateway = new ConstructionGateway(this);
|
|
77
79
|
|
|
78
80
|
|
|
79
81
|
constructor(appCode: string) {
|
|
@@ -125,7 +127,7 @@ export class Cpzxrobot {
|
|
|
125
127
|
|
|
126
128
|
const instance = {
|
|
127
129
|
get: async (url: string, config?: any) => {
|
|
128
|
-
if (config.params) {
|
|
130
|
+
if (config && config.params) {
|
|
129
131
|
url += "?" + new URLSearchParams(config.params).toString();
|
|
130
132
|
delete config.params;
|
|
131
133
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# ProjectGateway 类文档
|
|
2
|
+
|
|
3
|
+
## 概述
|
|
4
|
+
ProjectGateway 是项目管理系统中的核心网关类,提供了与项目相关的各种API接口封装。
|
|
5
|
+
|
|
6
|
+
## 主要功能
|
|
7
|
+
|
|
8
|
+
### 基础项目操作
|
|
9
|
+
- `list()`: 获取项目列表
|
|
10
|
+
- `get()`: 获取单个项目详情
|
|
11
|
+
- `add()`: 创建新项目
|
|
12
|
+
- `update()`: 更新项目信息
|
|
13
|
+
- `delete()`: 删除项目
|
|
14
|
+
|
|
15
|
+
### 子功能模块
|
|
16
|
+
- `feedback`: 项目反馈相关操作
|
|
17
|
+
- `stat`: 项目统计
|
|
18
|
+
- `attendance`: 项目考勤
|
|
19
|
+
- `constructionTeam`: 施工队管理
|
|
20
|
+
- `document`: 项目文档
|
|
21
|
+
- `material`: 项目材料
|
|
22
|
+
- `inquiry`: 项目询价
|
|
23
|
+
- `codePrefix`: 项目编码前缀
|
|
24
|
+
- `stage`: 项目阶段
|
|
25
|
+
- `bom`: BOM配置
|
|
26
|
+
- `plan`: 项目计划
|
|
27
|
+
|
|
28
|
+
## 使用示例
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
// 初始化
|
|
32
|
+
const projectGateway = new ProjectGateway(context);
|
|
33
|
+
|
|
34
|
+
// 获取项目列表
|
|
35
|
+
projectGateway.list({
|
|
36
|
+
pageNo: 1,
|
|
37
|
+
pageSize: 10,
|
|
38
|
+
name: '测试项目'
|
|
39
|
+
}).then(response => {
|
|
40
|
+
console.log(response.data);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// 创建BOM配置
|
|
44
|
+
projectGateway.bom.add({
|
|
45
|
+
projectId: 123,
|
|
46
|
+
projectStageRecordId: 456,
|
|
47
|
+
projectStageId: 789,
|
|
48
|
+
materialInfo: "钢材10吨",
|
|
49
|
+
groupId: 1
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## 注意事项
|
|
54
|
+
- 所有方法返回Promise对象
|
|
55
|
+
- 需要先初始化context对象
|
package/project_gateway.ts
CHANGED
|
@@ -291,6 +291,32 @@ export class ProjectGateway extends Object {
|
|
|
291
291
|
params: { groupId }
|
|
292
292
|
});
|
|
293
293
|
});
|
|
294
|
+
},
|
|
295
|
+
details: (projectId: number) => {
|
|
296
|
+
return this.context.ready.then((axios) => {
|
|
297
|
+
return axios.get(`/api/v2/coremde-sale/project/stage/details?projectId=${projectId}`);
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
get bom() {
|
|
304
|
+
return {
|
|
305
|
+
/**
|
|
306
|
+
* 技术部制作BOM单
|
|
307
|
+
* @param args BOM配置参数
|
|
308
|
+
* @returns Promise
|
|
309
|
+
*/
|
|
310
|
+
add: (args: {
|
|
311
|
+
projectId: number;
|
|
312
|
+
projectStageRecordId: number;
|
|
313
|
+
projectStageId: number;
|
|
314
|
+
materialInfo: string;
|
|
315
|
+
groupId: number;
|
|
316
|
+
}) => {
|
|
317
|
+
return this.context.ready.then((axios) => {
|
|
318
|
+
return axios.post(`/api/v2/coremde-sale/project/bom-config/add`, args);
|
|
319
|
+
});
|
|
294
320
|
}
|
|
295
321
|
};
|
|
296
322
|
}
|
package/readme.md
CHANGED
package/types.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ import { QuotationGateway } from "./quotation_gateway";
|
|
|
19
19
|
import { AiGateway } from "./ai_gateway";
|
|
20
20
|
import { EnergyGateway } from "./energy_gateway";
|
|
21
21
|
import { type ElectricMeterRate } from "./energy_types/electric_meter_gateway";
|
|
22
|
+
import { ConstructionGateway } from "./construction_gateway";
|
|
22
23
|
|
|
23
24
|
type Device = {
|
|
24
25
|
id: number;
|
|
@@ -347,6 +348,7 @@ class Cpzxrobot {
|
|
|
347
348
|
quotation: QuotationGateway;
|
|
348
349
|
ai: AiGateway;
|
|
349
350
|
energy: EnergyGateway;
|
|
351
|
+
construction: ConstructionGateway;
|
|
350
352
|
dict: (key: string) => any;
|
|
351
353
|
_getSelectedFarmFromMiniApp: () => Promise<Factory>;
|
|
352
354
|
_getSelectedUnitFromMiniApp: () => Promise<Unit>;
|