@cpzxrobot/sdk 1.1.52 → 1.1.54

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.
@@ -125,6 +125,15 @@ class ProjectGateway extends Object {
125
125
  }
126
126
  }, fileName);
127
127
  });
128
+ },
129
+ approval: (id, agree, auditInfo) => {
130
+ return this.context.ready.then((axios) => {
131
+ return axios.post(`/api/v2/coremde-sale/project/inquiry/approve`, {
132
+ id,
133
+ agree,
134
+ auditInfo,
135
+ });
136
+ });
128
137
  }
129
138
  };
130
139
  }
@@ -117,10 +117,11 @@ class UserGateway extends Object {
117
117
  return axios.get(`/api/v2/coremde-sale/user/city/get?area_code=${area_code}`);
118
118
  });
119
119
  }
120
- listByRole(companyId, role) {
121
- return this.context.ready.then((axios) => {
122
- return axios.get(`/api/v2/company/${companyId}/users?roleCode=${role}`);
123
- });
120
+ async listByRole(role) {
121
+ var axios = await this.context.ready;
122
+ var factory = await this.context.user.getSelectedFarm();
123
+ //当前如果打开的是公司,则说明该应用支持在公司级别打开,则要求该应用应该有对应的公司级别的角色配置,所以并不需要查找公司下属工厂或工厂的对应公司,再去查找用户
124
+ return axios.get(`/api/v2/company/${factory.id}/users?roleCode=${role}`);
124
125
  }
125
126
  async mypermission() {
126
127
  var axios = await this.context.ready;
@@ -144,17 +145,25 @@ class UserGateway extends Object {
144
145
  });
145
146
  });
146
147
  },
147
- list: (id, status) => {
148
+ list: (id, status, pageNo = undefined, pageSize = undefined) => {
148
149
  return this.context.ready.then((axios) => {
149
150
  return axios.post(`/api/v2/coremde-sale/approval/list`, {
150
151
  status,
151
- userId: id
152
+ userId: id,
153
+ pageNo,
154
+ pageSize
152
155
  });
153
156
  });
154
157
  },
155
- submits: (id) => {
158
+ submits: (id, pageNo = undefined, pageSize = undefined) => {
156
159
  return this.context.ready.then((axios) => {
157
- return axios.get(`/api/v2/coremde-sale/approval/submit/list?userId=${id}`);
160
+ return axios.get(`/api/v2/coremde-sale/approval/submit/list`, {
161
+ params: {
162
+ userId: id,
163
+ pageNo,
164
+ pageSize
165
+ }
166
+ });
158
167
  });
159
168
  }
160
169
  };
@@ -240,9 +249,13 @@ class UserGateway extends Object {
240
249
  },
241
250
  };
242
251
  }
243
- info() {
244
- return this.context.ready.then((axios) => {
245
- return axios.get(`/api/v1/user/info`);
252
+ async info() {
253
+ var axios = await this.context.ready;
254
+ var factory = await this.context.user.getSelectedFarm();
255
+ return axios.get(`/api/v1/user/info`, {
256
+ params: {
257
+ selected_farm: factory
258
+ }
246
259
  });
247
260
  }
248
261
  }
package/index.ts CHANGED
@@ -104,7 +104,6 @@ export class Cpzxrobot {
104
104
  // 在发送请求之前在头部添加token
105
105
  config.headers.Authorization = this.token;
106
106
  // 解析和验证Token
107
-
108
107
  return config;
109
108
  },
110
109
  function (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.1.52",
3
+ "version": "1.1.54",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -163,6 +163,15 @@ export class ProjectGateway extends Object {
163
163
  }
164
164
  },fileName);
165
165
  });
166
+ },
167
+ approval:(id: number, agree: 1 | 0, auditInfo: string) =>{
168
+ return this.context.ready.then((axios) => {
169
+ return axios.post(`/api/v2/coremde-sale/project/inquiry/approve`, {
170
+ id,
171
+ agree,
172
+ auditInfo,
173
+ });
174
+ });
166
175
  }
167
176
  };
168
177
  }
package/readme.md CHANGED
@@ -147,6 +147,7 @@ baseURL: "/"
147
147
  | cpzxrobot().user.listByRole | 列出用户(传入公司和角色) |
148
148
  | cpzxrobot().user.approval.list | 获取用户审批列表,传入userId和status参数 |
149
149
  | cpzxrobot().user.approval.count | 获取用户审批列表的数量,传入userId和status参数 |
150
+ | cpzxrobot().user.approval.submits | 获取已提交的用户审批 |
150
151
  | cpzxrobot().user.checkin.add | 添加用户签到记录,传入userId和address参数 |
151
152
  | cpzxrobot().user.checkin.list | 列出用户签到记录,传入userId和date参数 |
152
153
  | cpzxrobot().user.searchHistory.list | 列出用户搜索历史记录,传入type参数 |
@@ -172,6 +173,7 @@ baseURL: "/"
172
173
  | cpzxrobot().project.inquiry.get | 获得项目询盘信息,传入id参数 |
173
174
  | cpzxrobot().project.inquiry.add | 添加项目询盘信息,传入project_id和询盘内容 |
174
175
  | cpzxrobot().project.inquiry.export | 导出项目询盘信息,传入project_id参数,建议传入自定义文件名,否则默认文件名 |
176
+ | cpzxrobot().project.inquiry.approval | 审批项目询盘,传入id参数和审批意见 |
175
177
  | cpzxrobot().project.document.list | 获得项目文档列表,传入project_id参数 |
176
178
  | cpzxrobot().project.material.list | 获得项目物料到货列表,传入project_id参数 |
177
179
  | cpzxrobot().project.attendance.list | 获得项目到岗列表,传入project_id参数 |
package/user_gateway.ts CHANGED
@@ -129,10 +129,11 @@ export class UserGateway extends Object {
129
129
  });
130
130
  }
131
131
 
132
- listByRole(companyId: number,role: string) {
133
- return this.context.ready.then((axios) => {
134
- return axios.get(`/api/v2/company/${companyId}/users?roleCode=${role}`);
135
- });
132
+ async listByRole(role: string) {
133
+ var axios = await this.context.ready;
134
+ var factory = await this.context.user.getSelectedFarm();
135
+ //当前如果打开的是公司,则说明该应用支持在公司级别打开,则要求该应用应该有对应的公司级别的角色配置,所以并不需要查找公司下属工厂或工厂的对应公司,再去查找用户
136
+ return axios.get(`/api/v2/company/${factory.id}/users?roleCode=${role}`);
136
137
  }
137
138
 
138
139
  async mypermission() {
@@ -160,17 +161,25 @@ export class UserGateway extends Object {
160
161
  });
161
162
  });
162
163
  },
163
- list: (id: number, status: any) => {
164
+ list: (id: number, status: any, pageNo: number | undefined = undefined, pageSize: number | undefined = undefined) => {
164
165
  return this.context.ready.then((axios) => {
165
166
  return axios.post(`/api/v2/coremde-sale/approval/list`, {
166
167
  status,
167
- userId: id
168
+ userId: id,
169
+ pageNo,
170
+ pageSize
168
171
  });
169
172
  });
170
173
  },
171
- submits: (id: number) => {
174
+ submits: (id: number, pageNo: number | undefined = undefined, pageSize: number | undefined = undefined) => {
172
175
  return this.context.ready.then((axios) => {
173
- return axios.get(`/api/v2/coremde-sale/approval/submit/list?userId=${id}`);
176
+ return axios.get(`/api/v2/coremde-sale/approval/submit/list`,{
177
+ params: {
178
+ userId: id,
179
+ pageNo,
180
+ pageSize
181
+ }
182
+ });
174
183
  });
175
184
  }
176
185
  }
@@ -267,9 +276,13 @@ export class UserGateway extends Object {
267
276
  }
268
277
  }
269
278
 
270
- info() {
271
- return this.context.ready.then((axios) => {
272
- return axios.get(`/api/v1/user/info`);
279
+ async info() {
280
+ var axios = await this.context.ready;
281
+ var factory = await this.context.user.getSelectedFarm();
282
+ return axios.get(`/api/v1/user/info`, {
283
+ params: {
284
+ selected_farm: factory
285
+ }
273
286
  });
274
287
  }
275
288
  }