@cpzxrobot/sdk 1.3.2 → 1.3.3

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.
@@ -331,5 +331,39 @@ class ProjectGateway extends Object {
331
331
  }
332
332
  };
333
333
  }
334
+ get type() {
335
+ return {
336
+ // 获取类型列表
337
+ list: (args) => {
338
+ return this.context.ready.then((axios) => {
339
+ return axios.post(`/api/v2/coremde-sale/project/type/list`, args);
340
+ });
341
+ },
342
+ // 获取类型详情
343
+ get: (id) => {
344
+ return this.context.ready.then((axios) => {
345
+ return axios.get(`/api/v2/coremde-sale/project/type/get/${id}`);
346
+ });
347
+ },
348
+ // 新增项目类型
349
+ add: (args) => {
350
+ return this.context.ready.then((axios) => {
351
+ return axios.post(`/api/v2/coremde-sale/project/type/add`, args);
352
+ });
353
+ },
354
+ // 修改项目类型
355
+ update: (args) => {
356
+ return this.context.ready.then((axios) => {
357
+ return axios.post(`/api/v2/coremde-sale/project/type/update`, args);
358
+ });
359
+ },
360
+ // 删除项目类型
361
+ delete: (id) => {
362
+ return this.context.ready.then((axios) => {
363
+ return axios.get(`/api/v2/coremde-sale/project/type/delete/${id}`);
364
+ });
365
+ }
366
+ };
367
+ }
334
368
  }
335
369
  exports.ProjectGateway = ProjectGateway;
@@ -69,6 +69,7 @@ class UserGateway extends Object {
69
69
  });
70
70
  }
71
71
  async mypermission(params = undefined) {
72
+ var _a;
72
73
  var axios = await this.context.ready;
73
74
  var factory = await this.context.user.getSelectedFarm();
74
75
  var args;
@@ -77,7 +78,7 @@ class UserGateway extends Object {
77
78
  }
78
79
  else {
79
80
  args = {
80
- factoryId: factory.id
81
+ factoryId: (_a = factory.id) !== null && _a !== void 0 ? _a : 0
81
82
  };
82
83
  }
83
84
  return axios.get("/api/v2/user/role/mypermission", {
@@ -24,9 +24,10 @@ class WebPlatform {
24
24
  this._selectedUnit = unit;
25
25
  }
26
26
  async fetchWithAuth(input, init) {
27
+ var _a;
27
28
  const headers = new Headers(init === null || init === void 0 ? void 0 : init.headers);
28
29
  headers.set('Authorization', this.token);
29
- headers.set('Miniapp-Code', this.appCode);
30
+ headers.set('Miniapp-Code', (_a = this.appCode) !== null && _a !== void 0 ? _a : "");
30
31
  const response = await fetch(this.baseURL + input.toString(), Object.assign(Object.assign({}, init), { headers }));
31
32
  if (!response.ok) {
32
33
  throw new Error(`HTTP error! status: ${response.status}`);
@@ -35,9 +36,10 @@ class WebPlatform {
35
36
  }
36
37
  ;
37
38
  async streamWithAuth(input, init, fn) {
39
+ var _a;
38
40
  const headers = new Headers(init === null || init === void 0 ? void 0 : init.headers);
39
41
  headers.set('Authorization', this.token);
40
- headers.set('Miniapp-Code', this.appCode);
42
+ headers.set('Miniapp-Code', (_a = this.appCode) !== null && _a !== void 0 ? _a : "");
41
43
  const response = await fetch(this.baseURL + input.toString(), Object.assign(Object.assign({}, init), { headers }));
42
44
  var reader = response.body.getReader();
43
45
  const decoder = new TextDecoder("utf-8");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -439,4 +439,53 @@ export class ProjectGateway extends Object {
439
439
  };
440
440
  }
441
441
 
442
+ get type() {
443
+ return {
444
+ // 获取类型列表
445
+ list: (args: {
446
+ pageNo: number;
447
+ pageSize: number;
448
+ CompanyId: number;
449
+ }) => {
450
+ return this.context.ready.then((axios) => {
451
+ return axios.post(`/api/v2/coremde-sale/project/type/list`, args);
452
+ });
453
+ },
454
+ // 获取类型详情
455
+ get: (id: number) => {
456
+ return this.context.ready.then((axios) => {
457
+ return axios.get(`/api/v2/coremde-sale/project/type/get/${id}`);
458
+ });
459
+ },
460
+ // 新增项目类型
461
+ add: (args: {
462
+ typeName: string;
463
+ CompanyId: number;
464
+ codePrefix: string;
465
+ remark?: string;
466
+ }) => {
467
+ return this.context.ready.then((axios) => {
468
+ return axios.post(`/api/v2/coremde-sale/project/type/add`, args);
469
+ });
470
+ },
471
+ // 修改项目类型
472
+ update: (args: {
473
+ id: number;
474
+ typeName: string;
475
+ CompanyId: number;
476
+ codePrefix: string;
477
+ remark?: string;
478
+ }) => {
479
+ return this.context.ready.then((axios) => {
480
+ return axios.post(`/api/v2/coremde-sale/project/type/update`, args);
481
+ });
482
+ },
483
+ // 删除项目类型
484
+ delete: (id: number) => {
485
+ return this.context.ready.then((axios) => {
486
+ return axios.get(`/api/v2/coremde-sale/project/type/delete/${id}`);
487
+ });
488
+ }
489
+ };
490
+ }
442
491
  }
package/user_gateway.ts CHANGED
@@ -99,7 +99,7 @@ export class UserGateway extends Object {
99
99
  }
100
100
  } else {
101
101
  args = {
102
- factoryId: factory.id
102
+ factoryId: factory.id ?? 0
103
103
  };
104
104
  }
105
105
  return axios.get("/api/v2/user/role/mypermission", {
package/web_platform.ts CHANGED
@@ -30,7 +30,7 @@ export class WebPlatform implements PlatformInterface {
30
30
  async fetchWithAuth(input: RequestInfo, init?: RequestInit) {
31
31
  const headers = new Headers(init?.headers);
32
32
  headers.set('Authorization', this.token);
33
- headers.set('Miniapp-Code', this.appCode);
33
+ headers.set('Miniapp-Code', this.appCode ?? "");
34
34
  const response = await fetch(this.baseURL + input.toString(), {
35
35
  ...init,
36
36
  headers
@@ -45,7 +45,7 @@ export class WebPlatform implements PlatformInterface {
45
45
  async streamWithAuth(input: RequestInfo, init?: RequestInit, fn?: Function) {
46
46
  const headers = new Headers(init?.headers);
47
47
  headers.set('Authorization', this.token);
48
- headers.set('Miniapp-Code', this.appCode);
48
+ headers.set('Miniapp-Code', this.appCode ?? "");
49
49
  const response = await fetch(this.baseURL + input.toString(), {
50
50
  ...init,
51
51
  headers