@cpzxrobot/sdk 1.1.51 → 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,6 +117,12 @@ 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
+ 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}`);
125
+ }
120
126
  async mypermission() {
121
127
  var axios = await this.context.ready;
122
128
  return axios.get("/api/v2/user/role/mypermission");
@@ -139,17 +145,25 @@ class UserGateway extends Object {
139
145
  });
140
146
  });
141
147
  },
142
- list: (id, status) => {
148
+ list: (id, status, pageNo = undefined, pageSize = undefined) => {
143
149
  return this.context.ready.then((axios) => {
144
150
  return axios.post(`/api/v2/coremde-sale/approval/list`, {
145
151
  status,
146
- userId: id
152
+ userId: id,
153
+ pageNo,
154
+ pageSize
147
155
  });
148
156
  });
149
157
  },
150
- submits: (id) => {
158
+ submits: (id, pageNo = undefined, pageSize = undefined) => {
151
159
  return this.context.ready.then((axios) => {
152
- 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
+ });
153
167
  });
154
168
  }
155
169
  };
@@ -235,9 +249,13 @@ class UserGateway extends Object {
235
249
  },
236
250
  };
237
251
  }
238
- info() {
239
- return this.context.ready.then((axios) => {
240
- 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
+ }
241
259
  });
242
260
  }
243
261
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.1.51",
3
+ "version": "1.1.53",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/readme.md CHANGED
@@ -144,6 +144,7 @@ baseURL: "/"
144
144
  | cpzxrobot().user.update | 更新用户 |
145
145
  | cpzxrobot().user.list | 列出用户(传入工厂) |
146
146
  | cpzxrobot().user.info | 获取用户信息,传入userId参数 |
147
+ | cpzxrobot().user.listByRole | 列出用户(传入公司和角色) |
147
148
  | cpzxrobot().user.approval.list | 获取用户审批列表,传入userId和status参数 |
148
149
  | cpzxrobot().user.approval.count | 获取用户审批列表的数量,传入userId和status参数 |
149
150
  | cpzxrobot().user.checkin.add | 添加用户签到记录,传入userId和address参数 |
package/user_gateway.ts CHANGED
@@ -129,6 +129,13 @@ export class UserGateway extends Object {
129
129
  });
130
130
  }
131
131
 
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}`);
137
+ }
138
+
132
139
  async mypermission() {
133
140
  var axios = await this.context.ready;
134
141
  return axios.get("/api/v2/user/role/mypermission");
@@ -154,17 +161,25 @@ export class UserGateway extends Object {
154
161
  });
155
162
  });
156
163
  },
157
- list: (id: number, status: any) => {
164
+ list: (id: number, status: any, pageNo: number | undefined = undefined, pageSize: number | undefined = undefined) => {
158
165
  return this.context.ready.then((axios) => {
159
166
  return axios.post(`/api/v2/coremde-sale/approval/list`, {
160
167
  status,
161
- userId: id
168
+ userId: id,
169
+ pageNo,
170
+ pageSize
162
171
  });
163
172
  });
164
173
  },
165
- submits: (id: number) => {
174
+ submits: (id: number, pageNo: number | undefined = undefined, pageSize: number | undefined = undefined) => {
166
175
  return this.context.ready.then((axios) => {
167
- 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
+ });
168
183
  });
169
184
  }
170
185
  }
@@ -261,9 +276,13 @@ export class UserGateway extends Object {
261
276
  }
262
277
  }
263
278
 
264
- info() {
265
- return this.context.ready.then((axios) => {
266
- 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
+ }
267
286
  });
268
287
  }
269
288
  }