@cpzxrobot/sdk 1.3.2 → 1.3.4
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/dist/index.js +1 -1
- package/dist/project_gateway.js +34 -0
- package/dist/user_gateway.js +2 -1
- package/dist/web_platform.js +4 -2
- package/index.ts +1 -1
- package/package.json +1 -1
- package/project_gateway.ts +49 -0
- package/user_gateway.ts +1 -1
- package/web_platform.ts +2 -2
package/dist/index.js
CHANGED
|
@@ -77,8 +77,8 @@ class Cpzxrobot {
|
|
|
77
77
|
this.resolveReady = resolve;
|
|
78
78
|
this.rejectReady = reject;
|
|
79
79
|
});
|
|
80
|
-
this.getDomain(baseUrl, initSelectedFactory, initSelectedUnit);
|
|
81
80
|
this.appCode = appCode;
|
|
81
|
+
this.getDomain(baseUrl, initSelectedFactory, initSelectedUnit);
|
|
82
82
|
this.user = new user_gateway_1.UserGateway(this);
|
|
83
83
|
this.factory = new factory_gateway_1.FactoryGateway(this);
|
|
84
84
|
this.unit = new unit_gateway_1.UnitGateway(this);
|
package/dist/project_gateway.js
CHANGED
|
@@ -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;
|
package/dist/user_gateway.js
CHANGED
|
@@ -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", {
|
package/dist/web_platform.js
CHANGED
|
@@ -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/index.ts
CHANGED
|
@@ -77,8 +77,8 @@ export class Cpzxrobot {
|
|
|
77
77
|
this.resolveReady = resolve;
|
|
78
78
|
this.rejectReady = reject;
|
|
79
79
|
});
|
|
80
|
-
this.getDomain(baseUrl, initSelectedFactory, initSelectedUnit);
|
|
81
80
|
this.appCode = appCode;
|
|
81
|
+
this.getDomain(baseUrl, initSelectedFactory, initSelectedUnit);
|
|
82
82
|
this.user = new UserGateway(this);
|
|
83
83
|
this.factory = new FactoryGateway(this);
|
|
84
84
|
this.unit = new UnitGateway(this);
|
package/package.json
CHANGED
package/project_gateway.ts
CHANGED
|
@@ -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
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
|