@cpzxrobot/sdk 1.2.83 → 1.2.85
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/contract_gateway.ts +5 -4
- package/dist/contract_gateway.js +3 -2
- package/dist/index.js +15 -13
- package/dist/product_gateway.js +8 -8
- package/dist/project_gateway.js +10 -7
- package/index.ts +18 -13
- package/package.json +1 -1
- package/product_gateway.ts +6 -8
- package/project_gateway.ts +15 -8
- package/types.d.ts +9 -2
package/contract_gateway.ts
CHANGED
|
@@ -32,23 +32,24 @@ export class ContractGateway extends Object {
|
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
export(contractId: number,
|
|
35
|
+
export(contractId: number, fileName: string = "合同.pdf") {
|
|
36
36
|
return this.context.ready.then((axios) => {
|
|
37
37
|
return axios.getAndSave(`/api/v2/coremde-sale/contract/export`, {
|
|
38
38
|
params: {
|
|
39
39
|
contractId: contractId,
|
|
40
40
|
},
|
|
41
|
-
|
|
41
|
+
fileName,
|
|
42
|
+
});
|
|
42
43
|
});
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
approval(args:any) {
|
|
46
|
+
approval(args: any) {
|
|
46
47
|
return this.context.ready.then((axios) => {
|
|
47
48
|
return axios.post(`/api/v2/coremde-sale/contract/approve`, args);
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
restart(args:any) {
|
|
52
|
+
restart(args: any) {
|
|
52
53
|
return this.context.ready.then((axios) => {
|
|
53
54
|
return axios.post(`/api/v2/coremde-sale/contract/restart`, args);
|
|
54
55
|
});
|
package/dist/contract_gateway.js
CHANGED
|
@@ -21,13 +21,14 @@ class ContractGateway extends Object {
|
|
|
21
21
|
return axios.post(`/api/v2/coremde-sale/contract/add`, args);
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
export(contractId,
|
|
24
|
+
export(contractId, fileName = "合同.pdf") {
|
|
25
25
|
return this.context.ready.then((axios) => {
|
|
26
26
|
return axios.getAndSave(`/api/v2/coremde-sale/contract/export`, {
|
|
27
27
|
params: {
|
|
28
28
|
contractId: contractId,
|
|
29
29
|
},
|
|
30
|
-
|
|
30
|
+
fileName,
|
|
31
|
+
});
|
|
31
32
|
});
|
|
32
33
|
}
|
|
33
34
|
approval(args) {
|
package/dist/index.js
CHANGED
|
@@ -147,19 +147,20 @@ class Cpzxrobot {
|
|
|
147
147
|
});
|
|
148
148
|
return { data: await response.json() };
|
|
149
149
|
},
|
|
150
|
-
getAndSave: async (url, config
|
|
150
|
+
getAndSave: async (url, config) => {
|
|
151
|
+
var _a;
|
|
151
152
|
url = processQueryParams(url, config);
|
|
152
153
|
const response = await fetchWithAuth(url, {
|
|
153
154
|
method: 'GET',
|
|
154
155
|
headers: config === null || config === void 0 ? void 0 : config.headers
|
|
155
156
|
});
|
|
156
157
|
const blob = await response.blob();
|
|
157
|
-
await this.saveBlob(blob,
|
|
158
|
+
await this.saveBlob(blob, (_a = config === null || config === void 0 ? void 0 : config.fileName) !== null && _a !== void 0 ? _a : "file");
|
|
158
159
|
return { data: blob };
|
|
159
160
|
},
|
|
160
|
-
getAndPreview: async (url, config
|
|
161
|
+
getAndPreview: async (url, config) => {
|
|
161
162
|
url = processQueryParams(url, config);
|
|
162
|
-
return instance.getAndSave(url, config
|
|
163
|
+
return instance.getAndSave(url, config);
|
|
163
164
|
},
|
|
164
165
|
upload: async (url, option) => {
|
|
165
166
|
return new Promise((resolve, reject) => {
|
|
@@ -322,16 +323,17 @@ class Cpzxrobot {
|
|
|
322
323
|
post: function (url, data) {
|
|
323
324
|
return platform.callHandler("axios_post", url, data);
|
|
324
325
|
},
|
|
325
|
-
getAndSave: function (url,
|
|
326
|
-
return platform.callHandler("axios_getAndSave", url,
|
|
327
|
-
fileName: fileName || "file",
|
|
328
|
-
});
|
|
326
|
+
getAndSave: function (url, config) {
|
|
327
|
+
return platform.callHandler("axios_getAndSave", url, config);
|
|
329
328
|
},
|
|
330
|
-
getAndPreview: function (url,
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
329
|
+
getAndPreview: function (url, config) {
|
|
330
|
+
if (config == undefined) {
|
|
331
|
+
config = {};
|
|
332
|
+
}
|
|
333
|
+
if (config.preview == undefined) {
|
|
334
|
+
config.preview = true;
|
|
335
|
+
}
|
|
336
|
+
return platform.callHandler("axios_getAndSave", url, config);
|
|
335
337
|
},
|
|
336
338
|
upload: function (url, option) {
|
|
337
339
|
return platform.callHandler("axios_upload", url, option);
|
package/dist/product_gateway.js
CHANGED
|
@@ -44,13 +44,13 @@ class ProductGateway extends Object {
|
|
|
44
44
|
// },
|
|
45
45
|
//下载报价单
|
|
46
46
|
export: (args) => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
47
|
+
var _a;
|
|
48
|
+
const fileName = (_a = args.fileName) !== null && _a !== void 0 ? _a : "报价单.xlsx";
|
|
50
49
|
return this.context.ready.then((axios) => {
|
|
51
50
|
return axios.getAndSave(`/api/v2/coremde-sale/product/price/export`, {
|
|
52
51
|
params: args,
|
|
53
|
-
|
|
52
|
+
fileName: fileName,
|
|
53
|
+
});
|
|
54
54
|
});
|
|
55
55
|
},
|
|
56
56
|
add: (args) => {
|
|
@@ -75,13 +75,13 @@ class ProductGateway extends Object {
|
|
|
75
75
|
});
|
|
76
76
|
},
|
|
77
77
|
export: (args) => {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
78
|
+
var _a;
|
|
79
|
+
var fileName = (_a = args.fileName) !== null && _a !== void 0 ? _a : "报价单历史记录.xlsx";
|
|
81
80
|
return this.context.ready.then((axios) => {
|
|
82
81
|
return axios.getAndSave(`/api/v2/coremde-sale/product/price/history/export`, {
|
|
83
82
|
params: args,
|
|
84
|
-
|
|
83
|
+
fileName: fileName
|
|
84
|
+
});
|
|
85
85
|
});
|
|
86
86
|
},
|
|
87
87
|
},
|
package/dist/project_gateway.js
CHANGED
|
@@ -50,9 +50,9 @@ class ProjectGateway extends Object {
|
|
|
50
50
|
return axios.get(`/api/v2/coremde-sale/project/feedback/media/cancel?id=${id}`);
|
|
51
51
|
});
|
|
52
52
|
},
|
|
53
|
-
download: (id) => {
|
|
53
|
+
download: (id, config) => {
|
|
54
54
|
return this.context.ready.then((axios) => {
|
|
55
|
-
return axios.getAndPreview(`/api/v2/coremde-sale/project/feedback/media/download?id=${id}
|
|
55
|
+
return axios.getAndPreview(`/api/v2/coremde-sale/project/feedback/media/download?id=${id}`, config);
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
}
|
|
@@ -99,8 +99,9 @@ class ProjectGateway extends Object {
|
|
|
99
99
|
return axios.getAndSave(`/api/v2/coremde-sale/project/document/export`, {
|
|
100
100
|
params: {
|
|
101
101
|
id,
|
|
102
|
-
}
|
|
103
|
-
|
|
102
|
+
},
|
|
103
|
+
fileName
|
|
104
|
+
});
|
|
104
105
|
});
|
|
105
106
|
},
|
|
106
107
|
// 上传项目文档
|
|
@@ -121,7 +122,8 @@ class ProjectGateway extends Object {
|
|
|
121
122
|
download: (args) => {
|
|
122
123
|
return this.context.ready.then((axios) => {
|
|
123
124
|
return axios.getAndPreview(`/api/v2/coremde-sale/project/document/download`, {
|
|
124
|
-
params: args
|
|
125
|
+
params: args,
|
|
126
|
+
fileName: args.fileName || "项目文档",
|
|
125
127
|
});
|
|
126
128
|
});
|
|
127
129
|
}
|
|
@@ -201,8 +203,9 @@ class ProjectGateway extends Object {
|
|
|
201
203
|
params: {
|
|
202
204
|
id,
|
|
203
205
|
fileName
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
+
},
|
|
207
|
+
fileName
|
|
208
|
+
});
|
|
206
209
|
});
|
|
207
210
|
},
|
|
208
211
|
approval: (args) => {
|
package/index.ts
CHANGED
|
@@ -170,19 +170,23 @@ export class Cpzxrobot {
|
|
|
170
170
|
});
|
|
171
171
|
return { data: await response.json() };
|
|
172
172
|
},
|
|
173
|
-
getAndSave: async (url: string, config?: any
|
|
173
|
+
getAndSave: async (url: string, config?: any) => {
|
|
174
174
|
url = processQueryParams(url, config);
|
|
175
175
|
const response = await fetchWithAuth(url, {
|
|
176
176
|
method: 'GET',
|
|
177
177
|
headers: config?.headers
|
|
178
178
|
});
|
|
179
179
|
const blob = await response.blob();
|
|
180
|
-
await this.saveBlob(blob, fileName
|
|
180
|
+
await this.saveBlob(blob, config?.fileName ?? "file");
|
|
181
181
|
return { data: blob };
|
|
182
182
|
},
|
|
183
|
-
getAndPreview: async (url: string, config?:
|
|
183
|
+
getAndPreview: async (url: string, config?: {
|
|
184
|
+
fileName?: string;
|
|
185
|
+
params?: any;
|
|
186
|
+
preview?: boolean;
|
|
187
|
+
}) => {
|
|
184
188
|
url = processQueryParams(url, config);
|
|
185
|
-
return instance.getAndSave(url, config
|
|
189
|
+
return instance.getAndSave(url, config);
|
|
186
190
|
},
|
|
187
191
|
upload: async (url: string, option?: any) => {
|
|
188
192
|
return new Promise<any>((resolve, reject) => {
|
|
@@ -348,16 +352,17 @@ export class Cpzxrobot {
|
|
|
348
352
|
post: function (url, data) {
|
|
349
353
|
return platform.callHandler("axios_post", url, data);
|
|
350
354
|
},
|
|
351
|
-
getAndSave: function (url,
|
|
352
|
-
return platform.callHandler("axios_getAndSave", url,
|
|
353
|
-
fileName: fileName || "file",
|
|
354
|
-
});
|
|
355
|
+
getAndSave: function (url, config) {
|
|
356
|
+
return platform.callHandler("axios_getAndSave", url, config);
|
|
355
357
|
},
|
|
356
|
-
getAndPreview: function (url,
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
358
|
+
getAndPreview: function (url, config) {
|
|
359
|
+
if (config== undefined){
|
|
360
|
+
config = {};
|
|
361
|
+
}
|
|
362
|
+
if (config.preview == undefined){
|
|
363
|
+
config.preview = true;
|
|
364
|
+
}
|
|
365
|
+
return platform.callHandler("axios_getAndSave", url, config);
|
|
361
366
|
},
|
|
362
367
|
upload: function (url, option) {
|
|
363
368
|
return platform.callHandler("axios_upload", url, option);
|
package/package.json
CHANGED
package/product_gateway.ts
CHANGED
|
@@ -73,13 +73,12 @@ export class ProductGateway extends Object {
|
|
|
73
73
|
companyId: number;
|
|
74
74
|
fileName?: string;
|
|
75
75
|
}) => {
|
|
76
|
-
|
|
77
|
-
args.fileName = "报价单.xlsx";
|
|
78
|
-
}
|
|
76
|
+
const fileName = args.fileName ?? "报价单.xlsx";
|
|
79
77
|
return this.context.ready.then((axios) => {
|
|
80
78
|
return axios.getAndSave(`/api/v2/coremde-sale/product/price/export`, {
|
|
81
79
|
params: args,
|
|
82
|
-
|
|
80
|
+
fileName: fileName,
|
|
81
|
+
});
|
|
83
82
|
});
|
|
84
83
|
},
|
|
85
84
|
add: (args: {
|
|
@@ -125,13 +124,12 @@ export class ProductGateway extends Object {
|
|
|
125
124
|
id: number;
|
|
126
125
|
fileName?: string;
|
|
127
126
|
}) => {
|
|
128
|
-
|
|
129
|
-
args.fileName = "报价单历史记录.xlsx";
|
|
130
|
-
}
|
|
127
|
+
var fileName = args.fileName ?? "报价单历史记录.xlsx";
|
|
131
128
|
return this.context.ready.then((axios) => {
|
|
132
129
|
return axios.getAndSave(`/api/v2/coremde-sale/product/price/history/export`, {
|
|
133
130
|
params: args,
|
|
134
|
-
|
|
131
|
+
fileName: fileName
|
|
132
|
+
});
|
|
135
133
|
});
|
|
136
134
|
},
|
|
137
135
|
},
|
package/project_gateway.ts
CHANGED
|
@@ -75,9 +75,13 @@ export class ProjectGateway extends Object {
|
|
|
75
75
|
return axios.get(`/api/v2/coremde-sale/project/feedback/media/cancel?id=${id}`);
|
|
76
76
|
});
|
|
77
77
|
},
|
|
78
|
-
download: (id: number
|
|
78
|
+
download: (id: number, config: {
|
|
79
|
+
fileName?: string;
|
|
80
|
+
preview?: boolean;
|
|
81
|
+
params?: any;
|
|
82
|
+
}) => {
|
|
79
83
|
return this.context.ready.then((axios) => {
|
|
80
|
-
return axios.getAndPreview(`/api/v2/coremde-sale/project/feedback/media/download?id=${id}
|
|
84
|
+
return axios.getAndPreview(`/api/v2/coremde-sale/project/feedback/media/download?id=${id}`, config);
|
|
81
85
|
});
|
|
82
86
|
}
|
|
83
87
|
}
|
|
@@ -134,8 +138,9 @@ export class ProjectGateway extends Object {
|
|
|
134
138
|
return axios.getAndSave(`/api/v2/coremde-sale/project/document/export`, {
|
|
135
139
|
params: {
|
|
136
140
|
id,
|
|
137
|
-
}
|
|
138
|
-
|
|
141
|
+
},
|
|
142
|
+
fileName
|
|
143
|
+
});
|
|
139
144
|
});
|
|
140
145
|
},
|
|
141
146
|
// 上传项目文档
|
|
@@ -158,10 +163,11 @@ export class ProjectGateway extends Object {
|
|
|
158
163
|
});
|
|
159
164
|
},
|
|
160
165
|
// 下载项目文档
|
|
161
|
-
download: (args: { documentId: number }) => {
|
|
166
|
+
download: (args: { documentId: number, fileName?: string, preview?: boolean }) => {
|
|
162
167
|
return this.context.ready.then((axios) => {
|
|
163
168
|
return axios.getAndPreview(`/api/v2/coremde-sale/project/document/download`, {
|
|
164
|
-
params: args
|
|
169
|
+
params: args,
|
|
170
|
+
fileName: args.fileName || "项目文档",
|
|
165
171
|
});
|
|
166
172
|
});
|
|
167
173
|
}
|
|
@@ -253,8 +259,9 @@ export class ProjectGateway extends Object {
|
|
|
253
259
|
params: {
|
|
254
260
|
id,
|
|
255
261
|
fileName
|
|
256
|
-
}
|
|
257
|
-
|
|
262
|
+
},
|
|
263
|
+
fileName
|
|
264
|
+
});
|
|
258
265
|
});
|
|
259
266
|
},
|
|
260
267
|
approval: (args: any) => {
|
package/types.d.ts
CHANGED
|
@@ -283,8 +283,15 @@ type FeedTower = {
|
|
|
283
283
|
interface MyAxiosInstance {
|
|
284
284
|
get: (url: string, config?: any) => Promise<any>;
|
|
285
285
|
post: (url: string, data?: any, config?: any) => Promise<any>;
|
|
286
|
-
getAndSave: (url: string, data?:
|
|
287
|
-
|
|
286
|
+
getAndSave: (url: string, data?: {
|
|
287
|
+
fileName?: string;
|
|
288
|
+
params?: any;
|
|
289
|
+
}) => Promise<any>;
|
|
290
|
+
getAndPreview: (url: string, config?: {
|
|
291
|
+
fileName?: string;
|
|
292
|
+
preview?: boolean;
|
|
293
|
+
params?: any;
|
|
294
|
+
}) => Promise<any>;
|
|
288
295
|
//调用系统文件选择器,上传文件
|
|
289
296
|
//url:上传的url
|
|
290
297
|
//option:上传的配置项,比如文件名等
|