@cpzxrobot/sdk 1.1.67 → 1.1.69

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.
@@ -41,13 +41,9 @@ export class ContractGateway extends Object {
41
41
  });
42
42
  }
43
43
 
44
- approval(contractId: number, agree: 1 | 0, audit_info: string) {
44
+ approval(args:any) {
45
45
  return this.context.ready.then((axios) => {
46
- return axios.post(`/api/v2/coremde-sale/contract/approve`, {
47
- contractId,
48
- agree,
49
- audit_info,
50
- });
46
+ return axios.post(`/api/v2/coremde-sale/contract/approve`, args);
51
47
  });
52
48
  }
53
49
 
@@ -30,13 +30,9 @@ class ContractGateway extends Object {
30
30
  }, filename);
31
31
  });
32
32
  }
33
- approval(contractId, agree, audit_info) {
33
+ approval(args) {
34
34
  return this.context.ready.then((axios) => {
35
- return axios.post(`/api/v2/coremde-sale/contract/approve`, {
36
- contractId,
37
- agree,
38
- audit_info,
39
- });
35
+ return axios.post(`/api/v2/coremde-sale/contract/approve`, args);
40
36
  });
41
37
  }
42
38
  }
package/dist/index.js CHANGED
@@ -185,7 +185,10 @@ class Cpzxrobot {
185
185
  preview: true,
186
186
  fileName: fileName || "file",
187
187
  });
188
- }
188
+ },
189
+ upload: function (url, option) {
190
+ return platform.callHandler("axios_upload", url, option);
191
+ },
189
192
  };
190
193
  if (
191
194
  // @ts-ignore
@@ -58,6 +58,23 @@ class ProductGateway extends Object {
58
58
  return axios.post(`/api/v2/coremde-sale/product/price/add`, args);
59
59
  });
60
60
  },
61
+ delete: (id) => {
62
+ return this.context.ready.then((axios) => {
63
+ return axios.post(`/api/v2/coremde-sale/product/price/delete`, { id });
64
+ });
65
+ },
66
+ history: {
67
+ list: (args) => {
68
+ return this.context.ready.then((axios) => {
69
+ return axios.post(`/api/v2/coremde-sale/product/price/history/list`, args);
70
+ });
71
+ },
72
+ get: (id) => {
73
+ return this.context.ready.then((axios) => {
74
+ return axios.get(`/api/v2/coremde-sale/product/price/history/get?id=${id}`);
75
+ });
76
+ },
77
+ },
61
78
  };
62
79
  }
63
80
  }
@@ -36,6 +36,25 @@ class ProjectGateway extends Object {
36
36
  return this.context.ready.then((axios) => {
37
37
  return axios.post(`/api/v2/coremde-sale/project/feedback/reply`, args);
38
38
  });
39
+ },
40
+ media: {
41
+ add: () => {
42
+ return this.context.ready.then((axios) => {
43
+ return axios.upload(`/api/v2/coremde-sale/project/feedback/media/upload`, {
44
+ title: "请选择上传文件"
45
+ });
46
+ });
47
+ },
48
+ cancel: (id) => {
49
+ return this.context.ready.then((axios) => {
50
+ return axios.get(`/api/v2/coremde-sale/project/feedback/media/cancel?id=${id}`);
51
+ });
52
+ },
53
+ download: (id) => {
54
+ return this.context.ready.then((axios) => {
55
+ return axios.getAndPreview(`/api/v2/coremde-sale/project/feedback/media/download?id=${id}`);
56
+ });
57
+ }
39
58
  }
40
59
  };
41
60
  }
@@ -107,6 +107,13 @@ class UnitGateway extends Object {
107
107
  return axios.get(`/api/v2/batch/unit/${unitNo}`);
108
108
  });
109
109
  },
110
+ list: (unitIds) => {
111
+ return this.context.ready.then((axios) => {
112
+ return axios.post(`/api/v2/batch/unit/getUnitBatchs`, {
113
+ unitIds
114
+ });
115
+ });
116
+ },
110
117
  };
111
118
  }
112
119
  v2() {
@@ -237,6 +237,16 @@ class UserGateway extends Object {
237
237
  return this.context.ready.then((axios) => {
238
238
  return axios.post(`/api/v2/coremde-sale/user/work-report/add`, report);
239
239
  });
240
+ },
241
+ update: (report) => {
242
+ return this.context.ready.then((axios) => {
243
+ return axios.post(`/api/v2/coremde-sale/user/work-report/update`, report);
244
+ });
245
+ },
246
+ delete: (id) => {
247
+ return this.context.ready.then((axios) => {
248
+ return axios.get(`/api/v2/coremde-sale/user/work-report/delete?id=${id}`);
249
+ });
240
250
  }
241
251
  };
242
252
  }
package/index.ts CHANGED
@@ -123,6 +123,31 @@ export class Cpzxrobot {
123
123
  }
124
124
  // @ts-ignore
125
125
  instance.getAndPreview = instance.getAndSave;
126
+
127
+ instance.upload = (url: string, option?: {
128
+ [key: string]: any;
129
+ }) => {
130
+ //add a file button to the body
131
+ var button = document.createElement("input");
132
+ button.type = "file";
133
+ button.style.display = "none";
134
+ document.body.appendChild(button);
135
+ button.onchange = (e:Event) => {
136
+ var file = (e.target as HTMLInputElement).files?.[0];
137
+ if (file) {
138
+ const formData = new FormData();
139
+ formData.append(option?.["fileField"] || "file", file);
140
+ for (let key in option?.["data"]) {
141
+ formData.append(key, option!["data"][key]);
142
+ }
143
+ instance.post(url, formData).then((res) => {
144
+ button.remove();
145
+ });
146
+ } else {
147
+ button.remove();
148
+ }
149
+ };
150
+ }
126
151
  // @ts-ignore
127
152
  this.axios = instance;
128
153
  }
@@ -224,7 +249,10 @@ export class Cpzxrobot {
224
249
  preview: true,
225
250
  fileName: fileName || "file",
226
251
  });
227
- }
252
+ },
253
+ upload: function (url, option) {
254
+ return platform.callHandler("axios_upload", url, option);
255
+ },
228
256
  };
229
257
  if (
230
258
  // @ts-ignore
package/news_gateway.ts CHANGED
@@ -47,7 +47,6 @@ export class NewsGateway extends Object {
47
47
  }) =>{
48
48
  return this.context.ready.then(axios => {
49
49
  return axios.get("/api/v2/coremde-sale/alarm/list", { params: args });
50
-
51
50
  });
52
51
  }
53
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.1.67",
3
+ "version": "1.1.69",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -95,6 +95,32 @@ export class ProductGateway extends Object {
95
95
  return axios.post(`/api/v2/coremde-sale/product/price/add`, args);
96
96
  });
97
97
  },
98
+ delete: (id: number) => {
99
+ return this.context.ready.then((axios) => {
100
+ return axios.post(`/api/v2/coremde-sale/product/price/delete`, { id });
101
+ });
102
+ },
103
+ history: {
104
+ list: (args: {
105
+ pageNo: number;
106
+ pageSize: number;
107
+ product_id: number;
108
+ }) => {
109
+ return this.context.ready.then((axios) => {
110
+ return axios.post(
111
+ `/api/v2/coremde-sale/product/price/history/list`,
112
+ args,
113
+ );
114
+ });
115
+ },
116
+ get: (id: number) => {
117
+ return this.context.ready.then((axios) => {
118
+ return axios.get(
119
+ `/api/v2/coremde-sale/product/price/history/get?id=${id}`,
120
+ );
121
+ });
122
+ },
123
+ },
98
124
  };
99
125
  }
100
126
  }
@@ -52,10 +52,31 @@ export class ProjectGateway extends Object {
52
52
  id: number;
53
53
  status: number;
54
54
  reply: string;
55
+ companyId: number;
56
+ medias: any[];
55
57
  }) => {
56
58
  return this.context.ready.then((axios) => {
57
59
  return axios.post(`/api/v2/coremde-sale/project/feedback/reply`, args);
58
60
  });
61
+ },
62
+ media: {
63
+ add: () => {
64
+ return this.context.ready.then((axios) => {
65
+ return axios.upload(`/api/v2/coremde-sale/project/feedback/media/upload`,{
66
+ title: "请选择上传文件"
67
+ });
68
+ });
69
+ },
70
+ cancel: (id: number) => {
71
+ return this.context.ready.then((axios) => {
72
+ return axios.get(`/api/v2/coremde-sale/project/feedback/media/cancel?id=${id}`);
73
+ });
74
+ },
75
+ download: (id: number) => {
76
+ return this.context.ready.then((axios) => {
77
+ return axios.getAndPreview(`/api/v2/coremde-sale/project/feedback/media/download?id=${id}`);
78
+ });
79
+ }
59
80
  }
60
81
  };
61
82
  }
package/readme.md CHANGED
@@ -162,6 +162,8 @@ baseURL: "/"
162
162
  | cpzxrobot().user.workReport.list | 列出用户的日报记录 |
163
163
  | cpzxrobot().user.workReport.get | 获取用户的日报记录 |
164
164
  | cpzxrobot().user.workReport.add | 添加用户的日报记录 |
165
+ | cpzxrobot().user.workReport.delete | 删除用户的日报记录,传入id参数 |
166
+ | cpzxrobot().user.workReport.update | 更新用户的日报记录,传入id参数和更新的内容 |
165
167
  | cpzxrobot().user.position.leader | 获取当前用户的领导信息 |
166
168
  | cpzxrobot().user.position.team | 获取当前用户的下属团队信息, 可输入searchName进行模糊搜索 |
167
169
  | cpzxrobot().user.position.colleague | 获取当前用户的同组团队信息 |
@@ -171,6 +173,9 @@ baseURL: "/"
171
173
  | cpzxrobot().product.price.list | 获得产品报价列表 |
172
174
  | cpzxrobot().product.price.get | 获得产品报价信息,传入id参数 |
173
175
  | cpzxrobot().product.price.add | 添加产品报价信息 |
176
+ | cpzxrobot().product.price.delete | 删除产品报价信息,传入id参数 |
177
+ | cpzxrobot().product.price.history.list | 获得产品报价历史信息 |
178
+ | cpzxrobot().product.price.history.get | 获得产品报价历史信息,传入id参数 |
174
179
  | cpzxrobot().project.list | 获得项目列表,传入factory_id和必要的分页参数 |
175
180
  | cpzxrobot().project.feedback.list | 获得项目反馈列表,传入project_id参数 |
176
181
  | cpzxrobot().project.feedback.add | 添加项目反馈信息,传入project_id和反馈内容 |
package/types.d.ts CHANGED
@@ -270,6 +270,14 @@ interface MyAxiosInstance {
270
270
  post: (url: string, data?: any, config?: any) => Promise<any>;
271
271
  getAndSave: (url: string, data?: any, fileName?: string) => Promise<any>;
272
272
  getAndPreview: (url: string, data?: any, fileName?: string) => Promise<any>;
273
+ //调用系统文件选择器,上传文件
274
+ //url:上传的url
275
+ //option:上传的配置项,比如文件名等
276
+ //支持的配置项:
277
+ //option.title:上传文件选择框的标题
278
+ //option.fileField:上传的文件字段名,默认为file
279
+ //option.data:上传的数据,例如{id:123,name:"xxx"},文件会被附加到data中,作为文件字段上传
280
+ upload: (url: string,option?: {}) => Promise<any>;
273
281
  }
274
282
 
275
283
  interface Assistant {
package/user_gateway.ts CHANGED
@@ -262,6 +262,16 @@ export class UserGateway extends Object {
262
262
  return this.context.ready.then((axios) => {
263
263
  return axios.post(`/api/v2/coremde-sale/user/work-report/add`, report);
264
264
  });
265
+ },
266
+ update: (report: any) => {
267
+ return this.context.ready.then((axios) => {
268
+ return axios.post(`/api/v2/coremde-sale/user/work-report/update`, report);
269
+ });
270
+ },
271
+ delete: (id: number) => {
272
+ return this.context.ready.then((axios) => {
273
+ return axios.get(`/api/v2/coremde-sale/user/work-report/delete?id=${id}`);
274
+ });
265
275
  }
266
276
  };
267
277
  }