@cpzxrobot/sdk 1.2.32 → 1.2.34

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.
@@ -7,10 +7,10 @@ export class CompanyGateway extends Object {
7
7
  this.context = context;
8
8
  }
9
9
 
10
- async list(pageNo: number, pageSize: number) {
10
+ async list(pageNo: number, pageSize: number,pid:number, companyName:string) {
11
11
  var axios = await this.context.ready;
12
12
  return axios
13
- .get(`/api/v2/company/list?current=${pageNo}&size=${pageSize}`);
13
+ .get(`/api/v2/company/list?current=${pageNo}&size=${pageSize}&pid=${pid}&companyName=${companyName}`)
14
14
  }
15
15
 
16
16
  async detail(id: number) {
@@ -6,10 +6,10 @@ class CompanyGateway extends Object {
6
6
  super();
7
7
  this.context = context;
8
8
  }
9
- async list(pageNo, pageSize) {
9
+ async list(pageNo, pageSize, pid, companyName) {
10
10
  var axios = await this.context.ready;
11
11
  return axios
12
- .get(`/api/v2/company/list?current=${pageNo}&size=${pageSize}`);
12
+ .get(`/api/v2/company/list?current=${pageNo}&size=${pageSize}&pid=${pid}&companyName=${companyName}`);
13
13
  }
14
14
  async detail(id) {
15
15
  var axios = await this.context.ready;
@@ -134,8 +134,11 @@ class ProjectGateway extends Object {
134
134
  }
135
135
  // 更新项目
136
136
  update(projectData) {
137
+ // 等待context的ready状态完成
137
138
  return this.context.ready.then((axios) => {
138
139
  return axios.post(`/api/v2/coremde-sale/project/update`, projectData);
140
+ // 使用axios发送POST请求到/api/v2/coremde-sale/project/update接口,并传递projectData作为参数
141
+ return axios.post(`/api/v2/coremde-sale/project/update`, projectData);
139
142
  });
140
143
  }
141
144
  // 删除项目
@@ -193,5 +196,39 @@ class ProjectGateway extends Object {
193
196
  }
194
197
  };
195
198
  }
199
+ get codePrefix() {
200
+ return {
201
+ // 添加code前缀
202
+ add: (args) => {
203
+ return this.context.ready.then((axios) => {
204
+ return axios.post(`/api/v2/coremde-sale/project/code-prefix/add`, args);
205
+ });
206
+ },
207
+ // 获取code前缀列表
208
+ list: (args) => {
209
+ return this.context.ready.then((axios) => {
210
+ return axios.post(`/api/v2/coremde-sale/project/code-prefix/list`, args);
211
+ });
212
+ },
213
+ // 获取单个code前缀详情
214
+ get: (id) => {
215
+ return this.context.ready.then((axios) => {
216
+ return axios.get(`/api/v2/coremde-sale/project/code-prefix/get?id=${id}`);
217
+ });
218
+ },
219
+ // 更新code前缀
220
+ update: (args) => {
221
+ return this.context.ready.then((axios) => {
222
+ return axios.post(`/api/v2/coremde-sale/project/code-prefix/update`, args);
223
+ });
224
+ },
225
+ // 删除code前缀
226
+ delete: (id) => {
227
+ return this.context.ready.then((axios) => {
228
+ return axios.get(`/api/v2/coremde-sale/project/code-prefix/delete?id=${id}`);
229
+ });
230
+ }
231
+ };
232
+ }
196
233
  }
197
234
  exports.ProjectGateway = ProjectGateway;
@@ -28,7 +28,7 @@ class TransportGateway extends Object {
28
28
  getBatchByTruck: (workshopId, truckCode) => {
29
29
  return this.context.ready.then(() => {
30
30
  return this.context.axios
31
- .get(`/api/v2/pigfarm/transport/bactch/${workshopId}/${truckCode}`)
31
+ .get(`/api/v2/pigfarm/transport/batch/${workshopId}/${truckCode}`)
32
32
  .then((res) => {
33
33
  if (res.data.code != 200) {
34
34
  throw res.data.message;
@@ -41,7 +41,7 @@ class TransportGateway extends Object {
41
41
  getBatchByDateRange: (workshopId, startDate, endDate) => {
42
42
  return this.context.ready.then(() => {
43
43
  return this.context.axios
44
- .get(`/api/v2/pigfarm/transport/bactch/${workshopId}`, {
44
+ .get(`/api/v2/pigfarm/transport/batch/${workshopId}`, {
45
45
  params: { startDate, endDate }
46
46
  })
47
47
  .then((res) => {
@@ -56,7 +56,7 @@ class TransportGateway extends Object {
56
56
  createBatch: (data) => {
57
57
  return this.context.ready.then(() => {
58
58
  return this.context.axios
59
- .post("/api/v2/pigfarm/transport/bactch", data)
59
+ .post("/api/v2/pigfarm/transport/batch", data)
60
60
  .then((res) => {
61
61
  if (res.data.code != 200) {
62
62
  throw res.data.message;
@@ -69,7 +69,7 @@ class TransportGateway extends Object {
69
69
  getBatchDetail: (id) => {
70
70
  return this.context.ready.then(() => {
71
71
  return this.context.axios
72
- .get(`/api/v2/pigfarm/transport/bactch/detail/${id}`)
72
+ .get(`/api/v2/pigfarm/transport/batch/detail/${id}`)
73
73
  .then((res) => {
74
74
  if (res.data.code != 200) {
75
75
  throw res.data.message;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.2.32",
3
+ "version": "1.2.34",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -62,7 +62,7 @@ export class ProjectGateway extends Object {
62
62
  media: {
63
63
  add: () => {
64
64
  return this.context.ready.then((axios) => {
65
- return axios.upload(`/api/v2/coremde-sale/project/feedback/media/upload`,{
65
+ return axios.upload(`/api/v2/coremde-sale/project/feedback/media/upload`, {
66
66
  title: "请选择上传文件"
67
67
  });
68
68
  });
@@ -132,7 +132,7 @@ export class ProjectGateway extends Object {
132
132
  params: {
133
133
  id,
134
134
  }
135
- },fileName);
135
+ }, fileName);
136
136
  });
137
137
  }
138
138
  };
@@ -171,8 +171,11 @@ export class ProjectGateway extends Object {
171
171
 
172
172
  // 更新项目
173
173
  update(projectData: any) {
174
+ // 等待context的ready状态完成
174
175
  return this.context.ready.then((axios) => {
175
176
  return axios.post(`/api/v2/coremde-sale/project/update`, projectData);
177
+ // 使用axios发送POST请求到/api/v2/coremde-sale/project/update接口,并传递projectData作为参数
178
+ return axios.post(`/api/v2/coremde-sale/project/update`, projectData);
176
179
  });
177
180
  }
178
181
 
@@ -213,17 +216,17 @@ export class ProjectGateway extends Object {
213
216
  return axios.post(`/api/v2/coremde-sale/project/inquiry/restart`, args);
214
217
  });
215
218
  },
216
- export: (id: number,fileName: string = "询价.pdf") => {
219
+ export: (id: number, fileName: string = "询价.pdf") => {
217
220
  return this.context.ready.then((axios) => {
218
221
  return axios.getAndSave(`/api/v2/coremde-sale/project/inquiry/export`, {
219
222
  params: {
220
223
  id,
221
224
  fileName
222
225
  }
223
- },fileName);
226
+ }, fileName);
224
227
  });
225
228
  },
226
- approval:(args:any) =>{
229
+ approval: (args: any) => {
227
230
  return this.context.ready.then((axios) => {
228
231
  return axios.post(`/api/v2/coremde-sale/project/inquiry/approve`, args);
229
232
  });
@@ -238,4 +241,45 @@ export class ProjectGateway extends Object {
238
241
  };
239
242
  }
240
243
 
244
+ get codePrefix() {
245
+ return {
246
+ // 添加code前缀
247
+ add: (args: { codePrefix: string; description: string, groupId?: number, projectTypeld?: number }) => {
248
+ return this.context.ready.then((axios) => {
249
+ return axios.post(`/api/v2/coremde-sale/project/code-prefix/add`, args);
250
+ });
251
+ },
252
+ // 获取code前缀列表
253
+ list: (args: {
254
+ pageNo: number;
255
+ pageSize: number;
256
+ projectCode?: string;
257
+ description?: string;
258
+ groupId?: number;
259
+ }) => {
260
+ return this.context.ready.then((axios) => {
261
+ return axios.post(`/api/v2/coremde-sale/project/code-prefix/list`, args);
262
+ });
263
+ },
264
+ // 获取单个code前缀详情
265
+ get: (id: number) => {
266
+ return this.context.ready.then((axios) => {
267
+ return axios.get(`/api/v2/coremde-sale/project/code-prefix/get?id=${id}`);
268
+ });
269
+ },
270
+ // 更新code前缀
271
+ update: (args: { codePrefix: string; description: string; id: number, projectTypeld?: number }) => {
272
+ return this.context.ready.then((axios) => {
273
+ return axios.post(`/api/v2/coremde-sale/project/code-prefix/update`, args);
274
+ });
275
+ },
276
+ // 删除code前缀
277
+ delete: (id: number) => {
278
+ return this.context.ready.then((axios) => {
279
+ return axios.get(`/api/v2/coremde-sale/project/code-prefix/delete?id=${id}`);
280
+ });
281
+ }
282
+ };
283
+ }
284
+
241
285
  }
package/readme.md CHANGED
@@ -483,6 +483,60 @@ cpzxrobot().project.list({
483
483
  size?: number
484
484
  })
485
485
 
486
+ // Code前缀管理
487
+ cpzxrobot().project.codePrefix = {
488
+ // 添加code前缀
489
+ add: (args: { codePrefix: string; description: string }) => Promise<any>
490
+
491
+ // 获取code前缀列表
492
+ list: (args: {
493
+ pageNo: number;
494
+ pageSize: number;
495
+ projectCode?: string;
496
+ description?: string;
497
+ }) => Promise<any>
498
+
499
+ // 获取单个code前缀详情
500
+ get: (id: number) => Promise<any>
501
+
502
+ // 更新code前缀
503
+ update: (args: {
504
+ codePrefix: string;
505
+ description: string;
506
+ id: number
507
+ }) => Promise<any>
508
+
509
+ // 删除code前缀
510
+ delete: (id: number) => Promise<any>
511
+ }
512
+
513
+ // 使用示例
514
+ // 添加code前缀
515
+ await cpzxrobot().project.codePrefix.add({
516
+ codePrefix: "PRJ",
517
+ description: "项目编号前缀"
518
+ });
519
+
520
+ // 获取code前缀列表
521
+ const prefixes = await cpzxrobot().project.codePrefix.list({
522
+ pageNo: 1,
523
+ pageSize: 10
524
+ });
525
+
526
+ // 获取单个code前缀
527
+ const prefix = await cpzxrobot().project.codePrefix.get(123);
528
+
529
+ // 更新code前缀
530
+ await cpzxrobot().project.codePrefix.update({
531
+ codePrefix: "PROJ",
532
+ description: "项目编号前缀",
533
+ id: 123
534
+ });
535
+
536
+ // 删除code前缀
537
+ await cpzxrobot().project.codePrefix.delete(123);
538
+ ```
539
+
486
540
  // 获取项目详情
487
541
  cpzxrobot().project.get(projectId)
488
542
 
@@ -31,7 +31,7 @@ export class TransportGateway extends Object {
31
31
  getBatchByTruck: (workshopId: string, truckCode: string): Promise<any> => {
32
32
  return this.context.ready.then(() => {
33
33
  return this.context.axios
34
- .get(`/api/v2/pigfarm/transport/bactch/${workshopId}/${truckCode}`)
34
+ .get(`/api/v2/pigfarm/transport/batch/${workshopId}/${truckCode}`)
35
35
  .then((res) => {
36
36
  if (res.data.code != 200) {
37
37
  throw res.data.message;
@@ -45,7 +45,7 @@ export class TransportGateway extends Object {
45
45
  getBatchByDateRange: (workshopId: string, startDate: string, endDate: string): Promise<any> => {
46
46
  return this.context.ready.then(() => {
47
47
  return this.context.axios
48
- .get(`/api/v2/pigfarm/transport/bactch/${workshopId}`, {
48
+ .get(`/api/v2/pigfarm/transport/batch/${workshopId}`, {
49
49
  params: { startDate, endDate }
50
50
  })
51
51
  .then((res) => {
@@ -61,7 +61,7 @@ export class TransportGateway extends Object {
61
61
  createBatch: (data: any): Promise<any> => {
62
62
  return this.context.ready.then(() => {
63
63
  return this.context.axios
64
- .post("/api/v2/pigfarm/transport/bactch", data)
64
+ .post("/api/v2/pigfarm/transport/batch", data)
65
65
  .then((res) => {
66
66
  if (res.data.code != 200) {
67
67
  throw res.data.message;
@@ -75,7 +75,7 @@ export class TransportGateway extends Object {
75
75
  getBatchDetail: (id: string): Promise<any> => {
76
76
  return this.context.ready.then(() => {
77
77
  return this.context.axios
78
- .get(`/api/v2/pigfarm/transport/bactch/detail/${id}`)
78
+ .get(`/api/v2/pigfarm/transport/batch/detail/${id}`)
79
79
  .then((res) => {
80
80
  if (res.data.code != 200) {
81
81
  throw res.data.message;