@cpzxrobot/sdk 1.1.27 → 1.1.28
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/customer_gateway.ts +53 -0
- package/dist/customer_gateway.js +39 -0
- package/dist/index.js +2 -0
- package/dist/product_gateway.js +25 -0
- package/dist/project_gateway.js +21 -0
- package/dist/user_gateway.js +20 -0
- package/index.ts +2 -0
- package/package.json +1 -1
- package/product_gateway.ts +38 -0
- package/project_gateway.ts +26 -0
- package/types.d.ts +2 -0
- package/user_gateway.ts +32 -11
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Cpzxrobot, Factory, Unit } from "./types";
|
|
2
|
+
|
|
3
|
+
export class CustomerGateway extends Object {
|
|
4
|
+
context: Cpzxrobot;
|
|
5
|
+
|
|
6
|
+
constructor(context: Cpzxrobot) {
|
|
7
|
+
super();
|
|
8
|
+
this.context = context;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
list(args: {
|
|
12
|
+
pageNo: number;
|
|
13
|
+
pageSize: number;
|
|
14
|
+
customerName: string;
|
|
15
|
+
}) {
|
|
16
|
+
|
|
17
|
+
return this.context.ready.then((axios) => {
|
|
18
|
+
return axios.post(`/api/v2/coremde-sale/customer/list`, args);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
get(id: number) {
|
|
23
|
+
return this.context.ready.then((axios) => {
|
|
24
|
+
return axios.get(`/api/v2/coremde-sale/customer/get?id=${id}`);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
add(args: any) {
|
|
29
|
+
return this.context.ready.then((axios) => {
|
|
30
|
+
return axios.post(`/api/v2/coremde-sale/customer/add`, args);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
update(args: any) {
|
|
35
|
+
return this.context.ready.then((axios) => {
|
|
36
|
+
return axios.post(`/api/v2/coremde-sale/customer/update`, args);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
get visit() {
|
|
41
|
+
return {
|
|
42
|
+
add: (args: any) => {
|
|
43
|
+
return this.context.ready.then((axios) => {
|
|
44
|
+
return axios.post(
|
|
45
|
+
`/api/v2/coremde-sale/customer/visit/add`,
|
|
46
|
+
args,
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CustomerGateway = void 0;
|
|
4
|
+
class CustomerGateway extends Object {
|
|
5
|
+
constructor(context) {
|
|
6
|
+
super();
|
|
7
|
+
this.context = context;
|
|
8
|
+
}
|
|
9
|
+
list(args) {
|
|
10
|
+
return this.context.ready.then((axios) => {
|
|
11
|
+
return axios.post(`/api/v2/coremde-sale/customer/list`, args);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
get(id) {
|
|
15
|
+
return this.context.ready.then((axios) => {
|
|
16
|
+
return axios.get(`/api/v2/coremde-sale/customer/get?id=${id}`);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
add(args) {
|
|
20
|
+
return this.context.ready.then((axios) => {
|
|
21
|
+
return axios.post(`/api/v2/coremde-sale/customer/add`, args);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
update(args) {
|
|
25
|
+
return this.context.ready.then((axios) => {
|
|
26
|
+
return axios.post(`/api/v2/coremde-sale/customer/update`, args);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
get visit() {
|
|
30
|
+
return {
|
|
31
|
+
add: (args) => {
|
|
32
|
+
return this.context.ready.then((axios) => {
|
|
33
|
+
return axios.post(`/api/v2/coremde-sale/customer/visit/add`, args);
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.CustomerGateway = CustomerGateway;
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,7 @@ const car_gateway_1 = require("./car_gateway");
|
|
|
20
20
|
const project_gateway_1 = require("./project_gateway");
|
|
21
21
|
const product_gateway_1 = require("./product_gateway");
|
|
22
22
|
const contract_gateway_1 = require("./contract_gateway");
|
|
23
|
+
const customer_gateway_1 = require("./customer_gateway");
|
|
23
24
|
class Cpzxrobot {
|
|
24
25
|
constructor(appCode) {
|
|
25
26
|
this.pigfarm = new pigfarm_gateway_1.PigfarmGateway(this);
|
|
@@ -32,6 +33,7 @@ class Cpzxrobot {
|
|
|
32
33
|
this.project = new project_gateway_1.ProjectGateway(this);
|
|
33
34
|
this.product = new product_gateway_1.ProductGateway(this);
|
|
34
35
|
this.contract = new contract_gateway_1.ContractGateway(this);
|
|
36
|
+
this.customer = new customer_gateway_1.CustomerGateway(this);
|
|
35
37
|
//获取当前浏览器的域名
|
|
36
38
|
this.ready = new Promise((resolve, reject) => {
|
|
37
39
|
this.resolveReady = resolve;
|
package/dist/product_gateway.js
CHANGED
|
@@ -16,5 +16,30 @@ class ProductGateway extends Object {
|
|
|
16
16
|
return axios.get(`/api/v2/coremde-sale/product/get?id=${id}`);
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
+
get price() {
|
|
20
|
+
return {
|
|
21
|
+
list: (args) => {
|
|
22
|
+
return this.context.ready.then((axios) => {
|
|
23
|
+
return axios.post(`/api/v2/coremde-sale/product/price/list`, args);
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
// get: (id: number) => {
|
|
27
|
+
// return this.context.ready.then((axios) => {
|
|
28
|
+
// return axios.get(`/api/v2/coremde-sale/product/price/get?id=${id}`);
|
|
29
|
+
// });
|
|
30
|
+
// },
|
|
31
|
+
//下载报价单
|
|
32
|
+
export: (args) => {
|
|
33
|
+
return this.context.ready.then((axios) => {
|
|
34
|
+
return axios.post(`/api/v2/coremde-sale/product/price/export`, args);
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
add: (args) => {
|
|
38
|
+
return this.context.ready.then((axios) => {
|
|
39
|
+
return axios.post(`/api/v2/coremde-sale/product/price/add`, args);
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
19
44
|
}
|
|
20
45
|
exports.ProductGateway = ProductGateway;
|
package/dist/project_gateway.js
CHANGED
|
@@ -34,5 +34,26 @@ class ProjectGateway extends Object {
|
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
+
get inquiry() {
|
|
38
|
+
return {
|
|
39
|
+
// 获取询价列表
|
|
40
|
+
list: (args) => {
|
|
41
|
+
return this.context.ready.then((axios) => {
|
|
42
|
+
return axios.post(`/api/v2/coremde-sale/project/inquiry/list`, args);
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
// 获取询价详情
|
|
46
|
+
get: (id) => {
|
|
47
|
+
return this.context.ready.then((axios) => {
|
|
48
|
+
return axios.get(`/api/v2/coremde-sale/project/inquiry/get?id=${id}`);
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
add: (args) => {
|
|
52
|
+
return this.context.ready.then((axios) => {
|
|
53
|
+
return axios.post(`/api/v2/coremde-sale/project/inquiry/add`, args);
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
37
58
|
}
|
|
38
59
|
exports.ProjectGateway = ProjectGateway;
|
package/dist/user_gateway.js
CHANGED
|
@@ -188,5 +188,25 @@ class UserGateway extends Object {
|
|
|
188
188
|
}
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
|
+
//日报相关
|
|
192
|
+
get workReport() {
|
|
193
|
+
return {
|
|
194
|
+
list: (args) => {
|
|
195
|
+
return this.context.ready.then((axios) => {
|
|
196
|
+
return axios.post(`/api/v2/coremde-sale/user/work-report/list`, args);
|
|
197
|
+
});
|
|
198
|
+
},
|
|
199
|
+
get: (id) => {
|
|
200
|
+
return this.context.ready.then((axios) => {
|
|
201
|
+
return axios.get(`/api/v2/coremde-sale/user/work-report/get?id=${id}`);
|
|
202
|
+
});
|
|
203
|
+
},
|
|
204
|
+
add: (report) => {
|
|
205
|
+
return this.context.ready.then((axios) => {
|
|
206
|
+
return axios.post(`/api/v2/coremde-sale/user/work-report/add`, report);
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
}
|
|
191
211
|
}
|
|
192
212
|
exports.UserGateway = UserGateway;
|
package/index.ts
CHANGED
|
@@ -15,6 +15,7 @@ import { CarGateway } from "./car_gateway";
|
|
|
15
15
|
import { ProjectGateway } from "./project_gateway";
|
|
16
16
|
import { ProductGateway } from "./product_gateway";
|
|
17
17
|
import { ContractGateway } from "./contract_gateway";
|
|
18
|
+
import { CustomerGateway } from "./customer_gateway";
|
|
18
19
|
|
|
19
20
|
export class Cpzxrobot {
|
|
20
21
|
device: DeviceGateway;
|
|
@@ -51,6 +52,7 @@ export class Cpzxrobot {
|
|
|
51
52
|
project: ProjectGateway = new ProjectGateway(this);
|
|
52
53
|
product: ProductGateway = new ProductGateway(this);
|
|
53
54
|
contract: ContractGateway = new ContractGateway(this);
|
|
55
|
+
customer: CustomerGateway = new CustomerGateway(this);
|
|
54
56
|
|
|
55
57
|
constructor(appCode: string) {
|
|
56
58
|
//获取当前浏览器的域名
|
package/package.json
CHANGED
package/product_gateway.ts
CHANGED
|
@@ -26,4 +26,42 @@ export class ProductGateway extends Object {
|
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
get price() {
|
|
30
|
+
return {
|
|
31
|
+
list: (args: {
|
|
32
|
+
pageNo: number;
|
|
33
|
+
pageSize: number;
|
|
34
|
+
}) => {
|
|
35
|
+
return this.context.ready.then((axios) => {
|
|
36
|
+
return axios.post(
|
|
37
|
+
`/api/v2/coremde-sale/product/price/list`,
|
|
38
|
+
args,
|
|
39
|
+
);
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
// get: (id: number) => {
|
|
43
|
+
// return this.context.ready.then((axios) => {
|
|
44
|
+
// return axios.get(`/api/v2/coremde-sale/product/price/get?id=${id}`);
|
|
45
|
+
// });
|
|
46
|
+
// },
|
|
47
|
+
//下载报价单
|
|
48
|
+
export: (args: {
|
|
49
|
+
pageNo: number;
|
|
50
|
+
pageSize: number;
|
|
51
|
+
}) => {
|
|
52
|
+
return this.context.ready.then((axios) => {
|
|
53
|
+
return axios.post(`/api/v2/coremde-sale/product/price/export`, args);
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
add: (args: {
|
|
57
|
+
product_id: number;
|
|
58
|
+
price: number;
|
|
59
|
+
remark?: string;
|
|
60
|
+
}) => {
|
|
61
|
+
return this.context.ready.then((axios) => {
|
|
62
|
+
return axios.post(`/api/v2/coremde-sale/product/price/add`, args);
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
29
67
|
}
|
package/project_gateway.ts
CHANGED
|
@@ -49,4 +49,30 @@ export class ProjectGateway extends Object {
|
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
get inquiry() {
|
|
53
|
+
return {
|
|
54
|
+
// 获取询价列表
|
|
55
|
+
list: (args: {
|
|
56
|
+
pageNo: number;
|
|
57
|
+
pageSize: number;
|
|
58
|
+
name: string;
|
|
59
|
+
}) => {
|
|
60
|
+
return this.context.ready.then((axios) => {
|
|
61
|
+
return axios.post(`/api/v2/coremde-sale/project/inquiry/list`, args);
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
// 获取询价详情
|
|
65
|
+
get: (id: number) => {
|
|
66
|
+
return this.context.ready.then((axios) => {
|
|
67
|
+
return axios.get(`/api/v2/coremde-sale/project/inquiry/get?id=${id}`);
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
add: (args: any) => {
|
|
71
|
+
return this.context.ready.then((axios) => {
|
|
72
|
+
return axios.post(`/api/v2/coremde-sale/project/inquiry/add`, args);
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
52
78
|
}
|
package/types.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { FieldDatas } from "./sensor_datas";
|
|
|
11
11
|
import { ProjectGateway } from "@cpzxrobot/sdk/project_gateway";
|
|
12
12
|
import { ProductGateway } from "@cpzxrobot/sdk/product_gateway";
|
|
13
13
|
import { ContractGateway } from "@cpzxrobot/sdk/contract_gateway";
|
|
14
|
+
import { CustomerGateway } from "@cpzxrobot/sdk/customer_gateway";
|
|
14
15
|
|
|
15
16
|
type Device = {
|
|
16
17
|
id: number;
|
|
@@ -313,6 +314,7 @@ class Cpzxrobot {
|
|
|
313
314
|
product: ProductGateway;
|
|
314
315
|
project: ProjectGateway;
|
|
315
316
|
contract: ContractGateway;
|
|
317
|
+
customer: CustomerGateway;
|
|
316
318
|
dict: (key: string) => any;
|
|
317
319
|
_getSelectedFarmFromMiniApp: () => Promise<Factory>;
|
|
318
320
|
_getSelectedUnitFromMiniApp: () => Promise<Unit>;
|
package/user_gateway.ts
CHANGED
|
@@ -154,7 +154,7 @@ export class UserGateway extends Object {
|
|
|
154
154
|
|
|
155
155
|
get checkin() {
|
|
156
156
|
return {
|
|
157
|
-
add: (userId: number,address: String) => {
|
|
157
|
+
add: (userId: number, address: String) => {
|
|
158
158
|
return this.context.ready.then((axios) => {
|
|
159
159
|
return axios.post(`/api/v2/coremde-sale/checkin/add`, {
|
|
160
160
|
userId,
|
|
@@ -163,19 +163,19 @@ export class UserGateway extends Object {
|
|
|
163
163
|
});
|
|
164
164
|
},
|
|
165
165
|
//date 传入格式为2019-8或者Date类型对象
|
|
166
|
-
list: (userId: number,date:any) => {
|
|
166
|
+
list: (userId: number, date: any) => {
|
|
167
167
|
//if date is string
|
|
168
|
-
var yearMonth:string;
|
|
169
|
-
if(typeof date === 'string'){
|
|
168
|
+
var yearMonth: string;
|
|
169
|
+
if (typeof date === 'string') {
|
|
170
170
|
yearMonth = date;
|
|
171
|
-
}else if (typeof date === 'object'){
|
|
172
|
-
yearMonth = date.getFullYear()+'-'+(date.getMonth()+1);
|
|
171
|
+
} else if (typeof date === 'object') {
|
|
172
|
+
yearMonth = date.getFullYear() + '-' + (date.getMonth() + 1);
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
return this.context.ready.then((axios) => {
|
|
176
176
|
return axios.post(`/api/v2/coremde-sale/checkin/list`, {
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
userId,
|
|
178
|
+
yearMonth
|
|
179
179
|
});
|
|
180
180
|
});
|
|
181
181
|
}
|
|
@@ -184,9 +184,9 @@ export class UserGateway extends Object {
|
|
|
184
184
|
|
|
185
185
|
get searchHistory() {
|
|
186
186
|
return {
|
|
187
|
-
list: (type:number) => {
|
|
187
|
+
list: (type: number) => {
|
|
188
188
|
return this.context.ready.then((axios) => {
|
|
189
|
-
return axios.post(`/api/v2/coremde-sale/search/list`,{
|
|
189
|
+
return axios.post(`/api/v2/coremde-sale/search/list`, {
|
|
190
190
|
type
|
|
191
191
|
});
|
|
192
192
|
});
|
|
@@ -194,7 +194,7 @@ export class UserGateway extends Object {
|
|
|
194
194
|
//添加搜索历史,type 1:合同,2:项目
|
|
195
195
|
add: (keyword: string, type: number) => {
|
|
196
196
|
return this.context.ready.then((axios) => {
|
|
197
|
-
return axios.post(`/api/v2/coremde-sale/search/add`,{
|
|
197
|
+
return axios.post(`/api/v2/coremde-sale/search/add`, {
|
|
198
198
|
name: keyword,
|
|
199
199
|
type
|
|
200
200
|
});
|
|
@@ -202,4 +202,25 @@ export class UserGateway extends Object {
|
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
+
|
|
206
|
+
//日报相关
|
|
207
|
+
get workReport() {
|
|
208
|
+
return {
|
|
209
|
+
list: (args: any) => {
|
|
210
|
+
return this.context.ready.then((axios) => {
|
|
211
|
+
return axios.post(`/api/v2/coremde-sale/user/work-report/list`, args);
|
|
212
|
+
});
|
|
213
|
+
},
|
|
214
|
+
get: (id: number) => {
|
|
215
|
+
return this.context.ready.then((axios) => {
|
|
216
|
+
return axios.get(`/api/v2/coremde-sale/user/work-report/get?id=${id}`);
|
|
217
|
+
});
|
|
218
|
+
},
|
|
219
|
+
add: (report: any) => {
|
|
220
|
+
return this.context.ready.then((axios) => {
|
|
221
|
+
return axios.post(`/api/v2/coremde-sale/user/work-report/add`, report);
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
}
|
|
205
226
|
}
|