@cpzxrobot/sdk 1.1.52 → 1.1.53

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.
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.1.52",
3
+ "version": "1.1.53",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
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
  }