@cloudbase/weda-ui 3.4.9-alpha.1024 → 3.4.10
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/README.md +65 -30
- package/dist/configs/components/chart/bar.json +1 -1
- package/dist/configs/components/chart/line.js +1 -1
- package/dist/configs/components/chart/pie.json +1 -1
- package/dist/configs/components/customer-service.js +0 -2
- package/dist/configs/components/flowgraph.json +22 -0
- package/dist/configs/components/form-checkbox.js +1 -0
- package/dist/configs/components/form-date.js +1 -0
- package/dist/configs/components/form-depart-tree-select.js +2 -4
- package/dist/configs/components/form-email.js +1 -0
- package/dist/configs/components/form-image-uploader.js +1 -0
- package/dist/configs/components/form-input.js +1 -2
- package/dist/configs/components/form-location.js +2 -2
- package/dist/configs/components/form-multi-region.js +1 -0
- package/dist/configs/components/form-phone.js +1 -0
- package/dist/configs/components/form-radio.js +1 -0
- package/dist/configs/components/form-region.js +1 -0
- package/dist/configs/components/form-rich-text.js +1 -0
- package/dist/configs/components/form-select.js +1 -0
- package/dist/configs/components/form-switch.js +1 -0
- package/dist/configs/components/form-text-area.js +1 -0
- package/dist/configs/components/form-time.js +1 -0
- package/dist/configs/components/form-upload-file.js +1 -0
- package/dist/configs/components/form-url.js +1 -0
- package/dist/configs/components/form-user-tree-select.js +3 -4
- package/dist/configs/components/modal.js +0 -2
- package/dist/configs/components/navigationBar.json +1 -3
- package/dist/configs/components/wd-button.js +2 -2
- package/dist/configs/components/wd-icon.js +2 -2
- package/dist/configs/components/wd-link.js +2 -2
- package/dist/configs/components/wd-table.js +1 -1
- package/dist/configs/index.js +2 -0
- package/dist/docs/common/components/properties-view.js +3 -6
- package/dist/docs/common/tableView.js +7 -10
- package/dist/style/index.scss +1 -1
- package/dist/web/components/chart/common/core/eChartLine.js +12 -1
- package/dist/web/components/chart/common/data-transform.js +13 -9
- package/dist/web/components/chart/line/index.old.js +2 -1
- package/dist/web/components/flow/common/request.js +3 -3
- package/dist/web/components/flow/modules/chart/index.js +42 -3
- package/dist/web/components/flow/modules/chart/preview-data.js +88 -0
- package/dist/web/components/flow-graph/constants.js +28 -0
- package/dist/web/components/flow-graph/graph.js +267 -0
- package/dist/web/components/flow-graph/index.js +2 -0
- package/dist/web/components/flow-graph/style.css +109 -0
- package/dist/web/components/flow-graph/types.js +1 -0
- package/dist/web/components/form/select/dropdown-select/index.css +4 -0
- package/dist/web/components/form/select/dropdown-select/index.js +4 -1
- package/dist/web/components/form/select/request.js +9 -9
- package/dist/web/components/form/userOrgSelect/common/fetch-data-service.js +44 -490
- package/dist/web/components/form/userOrgSelect/common/utils.js +14 -58
- package/dist/web/components/form/userOrgSelect/component/OrgPaths.js +12 -0
- package/dist/web/components/form/userOrgSelect/component/depart-select/depart-select-pc.js +1 -3
- package/dist/web/components/form/userOrgSelect/component/depart-select/departTreeSelect.h5.js +35 -56
- package/dist/web/components/form/userOrgSelect/component/depart-select/index.js +46 -24
- package/dist/web/components/form/userOrgSelect/component/depart-select/org-modal-pc.js +11 -20
- package/dist/web/components/form/userOrgSelect/component/modal-select-h5.js +57 -120
- package/dist/web/components/form/userOrgSelect/component/org-tree.js +8 -24
- package/dist/web/components/form/userOrgSelect/component/user-org-list.js +4 -4
- package/dist/web/components/form/userOrgSelect/component/user-select-h5/index.js +42 -33
- package/dist/web/components/form/userOrgSelect/component/user-select-h5/user-select-h5.js +2 -2
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/model-user-list.js +20 -51
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/org-tree.js +2 -2
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-model.js +4 -17
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-select-pc.js +4 -6
- package/dist/web/components/form/userOrgSelect/component/userOrgSelect.css +7 -3
- package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.js +68 -158
- package/dist/web/components/form/userOrgSelect/hooks/use-depart-data.js +3 -109
- package/dist/web/components/form-input-hooks/index.js +5 -2
- package/dist/web/components/index.js +1 -0
- package/dist/web/components/swiper/index.js +1 -2
- package/dist/web/components/table/BaseTable.js +1 -1
- package/dist/web/components/tabs/tabs.pc.js +10 -9
- package/dist/web/components/wd-form/index.js +28 -14
- package/dist/web/components/wd-table/components/ExportFileModalByApi/index.js +1 -1
- package/dist/web/components/wd-table/components/FieldRender/index.js +13 -2
- package/dist/web/components/wd-table/hooks/useChooseList.js +3 -5
- package/dist/web/components/wd-table/hooks/useTableData.js +1 -7
- package/dist/web/components/wd-table/utils/index.js +22 -3
- package/dist/web/components/wd-table/wd-table.js +9 -3
- package/dist/web/utils/datasource.js +3 -1
- package/package.json +2 -3
|
@@ -27,16 +27,16 @@ export const requestFatherRelatedOption = async (params, pageNo, type, searchVal
|
|
|
27
27
|
if (isEmpty(dataSourceName) || isEmpty(viewId)) {
|
|
28
28
|
return empty;
|
|
29
29
|
}
|
|
30
|
-
let realWhere;
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
realWhere = [].concat(getWhereList(where));
|
|
30
|
+
let realWhere = [];
|
|
31
|
+
if (searchValue) {
|
|
32
|
+
if (type === RequestOptionType.SEARCH) {
|
|
33
|
+
realWhere = [{ key: primaryField, val: searchValue, rel: 'search' }];
|
|
34
|
+
}
|
|
35
|
+
else if (type === RequestOptionType.EQUAL) {
|
|
36
|
+
realWhere = [{ key: '_id', val: searchValue, rel: 'eq' }];
|
|
37
|
+
}
|
|
39
38
|
}
|
|
39
|
+
realWhere = [{ $and: [...getWhereList(where), ...realWhere] }];
|
|
40
40
|
const data = await callDataSource({
|
|
41
41
|
dataSourceName: dataSourceName,
|
|
42
42
|
viewId: viewId,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
1
|
import { dealUserData, dealOrgData, parseStrToArr } from './utils';
|
|
3
2
|
import { callWedaApi } from '../../../../utils/tcb';
|
|
4
3
|
import { filterStrList } from '../../../../utils/platform';
|
|
@@ -43,23 +42,26 @@ export const errorHandle = (error, action) => {
|
|
|
43
42
|
*/
|
|
44
43
|
export const fetchUserListByIds = async (selectUserIds = [], request) => {
|
|
45
44
|
try {
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
for (let index =
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
UserIds: selectUserIds
|
|
45
|
+
const PAGE_SIZE = 50;
|
|
46
|
+
const total = selectUserIds.length;
|
|
47
|
+
const records = [];
|
|
48
|
+
const promises = [];
|
|
49
|
+
for (let index = 1; index <= Math.ceil(total / PAGE_SIZE); index++) {
|
|
50
|
+
const start = (index - 1) * PAGE_SIZE;
|
|
51
|
+
const end = start + PAGE_SIZE;
|
|
52
|
+
promises.push(request('DescribeWedaUsersRuntime', {
|
|
53
|
+
UserIds: selectUserIds.slice(start, end),
|
|
55
54
|
UserType: 'internalUser',
|
|
56
55
|
NeedPrimaryColumn: true,
|
|
57
56
|
IsNoRelatedOrgFlag: false,
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
const results = await Promise.all(promises);
|
|
60
|
+
for (const res of results) {
|
|
61
|
+
if (res.UserList &&
|
|
62
|
+
Array.isArray(res.UserList) &&
|
|
63
|
+
res.UserList.length > 0) {
|
|
64
|
+
records.push(...res.UserList);
|
|
63
65
|
}
|
|
64
66
|
}
|
|
65
67
|
return records;
|
|
@@ -172,70 +174,38 @@ async function fetchUsersByOrgId(params, request) {
|
|
|
172
174
|
throw errorHandle(error, 'LazyDescribeOrgs');
|
|
173
175
|
}
|
|
174
176
|
}
|
|
175
|
-
/**
|
|
176
|
-
* 获取当前组织列表总数
|
|
177
|
-
*/
|
|
178
|
-
// export const fetchOrgTotal = async (request) => {
|
|
179
|
-
// try {
|
|
180
|
-
// return await request('DescribeOrgs', {
|
|
181
|
-
// pageNo: 1,
|
|
182
|
-
// pageSize: 1,
|
|
183
|
-
// }).then((data) => {
|
|
184
|
-
// return data?.Total || 0;
|
|
185
|
-
// });
|
|
186
|
-
// } catch (error) {
|
|
187
|
-
// console.error('错误', error);
|
|
188
|
-
// throw errorHandle(error, 'fetchOrgTotal');
|
|
189
|
-
// }
|
|
190
|
-
// };
|
|
191
|
-
/**
|
|
192
|
-
*获取全量组织数据
|
|
193
|
-
*/
|
|
194
|
-
// export const DescribeOrgs = async (request) => {
|
|
195
|
-
// try {
|
|
196
|
-
// const total = await fetchOrgTotal(request);
|
|
197
|
-
// let records = [];
|
|
198
|
-
// if (total > 0) {
|
|
199
|
-
// const resultPromise = [];
|
|
200
|
-
// for (let index = 1; index <= Math.ceil(total / 1000); index++) {
|
|
201
|
-
// const DescribeOrgsByPage =
|
|
202
|
-
// request('DescribeOrgs', {
|
|
203
|
-
// pageNo: index,
|
|
204
|
-
// pageSize: 1000,
|
|
205
|
-
// }) || {};
|
|
206
|
-
// resultPromise.push(DescribeOrgsByPage);
|
|
207
|
-
// }
|
|
208
|
-
// await Promise.all(resultPromise).then((data) => {
|
|
209
|
-
// (data || []).map((item) => {
|
|
210
|
-
// records = records.concat(item?.DataList);
|
|
211
|
-
// });
|
|
212
|
-
// });
|
|
213
|
-
// }
|
|
214
|
-
// return records;
|
|
215
|
-
// } catch (error) {
|
|
216
|
-
// console.error('错误', error);
|
|
217
|
-
// throw errorHandle(error, 'DescribeOrgs');
|
|
218
|
-
// }
|
|
219
|
-
// };
|
|
220
177
|
/**
|
|
221
178
|
*获取全量组织数据
|
|
222
179
|
*/
|
|
223
180
|
export const DescribeOrgs = async (request) => {
|
|
224
181
|
try {
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
pageSizeParamKey: 'pageSize',
|
|
230
|
-
responseAdapter: (data) => {
|
|
231
|
-
const { Total, DataList, ...rest } = data;
|
|
232
|
-
return {
|
|
233
|
-
total: Total,
|
|
234
|
-
data: DataList,
|
|
235
|
-
...rest,
|
|
236
|
-
};
|
|
237
|
-
},
|
|
182
|
+
const PAGE_SIZE = 1000;
|
|
183
|
+
const { Total = 0, DataList = [] } = await request('DescribeOrgs', {
|
|
184
|
+
pageNo: 1,
|
|
185
|
+
pageSize: PAGE_SIZE,
|
|
238
186
|
});
|
|
187
|
+
const total = Number(Total);
|
|
188
|
+
// 一页拉取了全部数据,直接返回
|
|
189
|
+
if (total <= PAGE_SIZE) {
|
|
190
|
+
return DataList;
|
|
191
|
+
}
|
|
192
|
+
const records = [...DataList];
|
|
193
|
+
const promises = [];
|
|
194
|
+
// 从第二页开始,并发拉取所有
|
|
195
|
+
for (let index = 2; index <= Math.ceil(total / PAGE_SIZE); index++) {
|
|
196
|
+
promises.push(request('DescribeOrgs', {
|
|
197
|
+
pageNo: index,
|
|
198
|
+
pageSize: PAGE_SIZE,
|
|
199
|
+
}));
|
|
200
|
+
}
|
|
201
|
+
const results = await Promise.all(promises);
|
|
202
|
+
for (const res of results) {
|
|
203
|
+
if (res.DataList &&
|
|
204
|
+
Array.isArray(res.DataList) &&
|
|
205
|
+
res.DataList.length > 0) {
|
|
206
|
+
records.push(...res.DataList);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
239
209
|
return records;
|
|
240
210
|
}
|
|
241
211
|
catch (error) {
|
|
@@ -282,422 +252,6 @@ export const fetchViewList = async () => {
|
|
|
282
252
|
}
|
|
283
253
|
catch (error) {
|
|
284
254
|
console.error('错误', error);
|
|
285
|
-
throw errorHandle(error, '
|
|
286
|
-
}
|
|
287
|
-
};
|
|
288
|
-
const parallelFetchAll = async (params) => {
|
|
289
|
-
const { request, actionName, data: postData = {}, pageNumberParamKey = 'page_number', pageSizeParamKey = 'page_size', pageSize: PAGE_SIZE = 1000, responseAdapter = (data) => data, } = params;
|
|
290
|
-
const result = await request(`${actionName}`, {
|
|
291
|
-
[pageNumberParamKey]: 1,
|
|
292
|
-
[pageSizeParamKey]: PAGE_SIZE,
|
|
293
|
-
...postData,
|
|
294
|
-
});
|
|
295
|
-
const { total, data } = responseAdapter(result);
|
|
296
|
-
const totalCount = Number(total);
|
|
297
|
-
// 一页拉取了全部数据,直接返回
|
|
298
|
-
if (totalCount <= PAGE_SIZE) {
|
|
299
|
-
return data;
|
|
300
|
-
}
|
|
301
|
-
const records = [...data];
|
|
302
|
-
const promises = [];
|
|
303
|
-
// 从第二页开始,并发拉取所有
|
|
304
|
-
for (let index = 2; index <= Math.ceil(totalCount / PAGE_SIZE); index++) {
|
|
305
|
-
promises.push(request(`${actionName}`, {
|
|
306
|
-
[pageNumberParamKey]: index,
|
|
307
|
-
[pageSizeParamKey]: PAGE_SIZE,
|
|
308
|
-
...postData,
|
|
309
|
-
}));
|
|
310
|
-
}
|
|
311
|
-
const results = await Promise.all(promises);
|
|
312
|
-
for (const res of results) {
|
|
313
|
-
if (res.data || res.data.length > 0) {
|
|
314
|
-
records.push(...res.data);
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
return records;
|
|
318
|
-
};
|
|
319
|
-
/**
|
|
320
|
-
* 拉取互联企业列表时,后端不会返回当前的企业,需要前端展示为【本企业】,
|
|
321
|
-
* 前端设置一个特殊的id来标识
|
|
322
|
-
*/
|
|
323
|
-
export const CURRENT_CORP = {
|
|
324
|
-
id: '__current_corp__',
|
|
325
|
-
name: '本企业',
|
|
326
|
-
};
|
|
327
|
-
export const fetchAllCorps = async (request) => {
|
|
328
|
-
try {
|
|
329
|
-
// 注意:GetCorps 接口返回的只有互联企业,前端展示当前企业需要自己显示“本企业”
|
|
330
|
-
const associatedCorpList = await parallelFetchAll({
|
|
331
|
-
request,
|
|
332
|
-
actionName: 'GetCorps',
|
|
333
|
-
});
|
|
334
|
-
// Mock
|
|
335
|
-
// const associatedCorpList = [
|
|
336
|
-
// {
|
|
337
|
-
// id: 'wwd51f6cad24517ee1',
|
|
338
|
-
// name: '微搭学校',
|
|
339
|
-
// },
|
|
340
|
-
// {
|
|
341
|
-
// id: 'ww614741a1d5169bc7',
|
|
342
|
-
// name: '微搭教育测试号',
|
|
343
|
-
// },
|
|
344
|
-
// ];
|
|
345
|
-
// const associatedCorpList = Array(600)
|
|
346
|
-
// .fill(1)
|
|
347
|
-
// .map((_, index) => ({
|
|
348
|
-
// id: `corp_${index}`,
|
|
349
|
-
// name: `企业-${index}`,
|
|
350
|
-
// }));
|
|
351
|
-
const allCorpList = [CURRENT_CORP, ...associatedCorpList];
|
|
352
|
-
return allCorpList.map(({ id, name }) => ({
|
|
353
|
-
id,
|
|
354
|
-
name,
|
|
355
|
-
code: id,
|
|
356
|
-
parentCode: undefined,
|
|
357
|
-
corpId: undefined,
|
|
358
|
-
type: 'corp',
|
|
359
|
-
selectable: false, // 企业节点不能选择
|
|
360
|
-
}));
|
|
361
|
-
}
|
|
362
|
-
catch (error) {
|
|
363
|
-
console.error('错误', error);
|
|
364
|
-
throw errorHandle(error, 'GetCorps');
|
|
365
|
-
}
|
|
366
|
-
};
|
|
367
|
-
export const fetchAllDepartmentsByParentId = async ({ request, corpId, departmentId, }) => {
|
|
368
|
-
try {
|
|
369
|
-
const departList = await parallelFetchAll({
|
|
370
|
-
request,
|
|
371
|
-
actionName: 'GetDepartments',
|
|
372
|
-
data: {
|
|
373
|
-
corp_id: corpId || undefined,
|
|
374
|
-
department_id: departmentId || undefined,
|
|
375
|
-
},
|
|
376
|
-
});
|
|
377
|
-
// const departList = [
|
|
378
|
-
// {
|
|
379
|
-
// id: 'wwd51f6cad24517ee1.1',
|
|
380
|
-
// code: 'wwd51f6cad24517ee1.1',
|
|
381
|
-
// name: '微搭学校',
|
|
382
|
-
// corp_id: 'wwd51f6cad24517ee1',
|
|
383
|
-
// parent_code: '!!ROOT',
|
|
384
|
-
// },
|
|
385
|
-
// {
|
|
386
|
-
// id: 'wwd51f6cad24517ee1.2',
|
|
387
|
-
// code: 'wwd51f6cad24517ee1.2',
|
|
388
|
-
// name: '学工处',
|
|
389
|
-
// corp_id: 'wwd51f6cad24517ee1',
|
|
390
|
-
// parent_code: 'wwd51f6cad24517ee1.1',
|
|
391
|
-
// },
|
|
392
|
-
// {
|
|
393
|
-
// id: 'wwd51f6cad24517ee1.3',
|
|
394
|
-
// code: 'wwd51f6cad24517ee1.3',
|
|
395
|
-
// name: '高中部',
|
|
396
|
-
// corp_id: 'wwd51f6cad24517ee1',
|
|
397
|
-
// parent_code: 'wwd51f6cad24517ee1.1',
|
|
398
|
-
// },
|
|
399
|
-
// {
|
|
400
|
-
// id: 'wwd51f6cad24517ee1.4',
|
|
401
|
-
// code: 'wwd51f6cad24517ee1.4',
|
|
402
|
-
// name: '初中部',
|
|
403
|
-
// corp_id: 'wwd51f6cad24517ee1',
|
|
404
|
-
// parent_code: 'wwd51f6cad24517ee1.1',
|
|
405
|
-
// },
|
|
406
|
-
// {
|
|
407
|
-
// id: 'ww614741a1d5169bc7.1',
|
|
408
|
-
// code: 'ww614741a1d5169bc7.1',
|
|
409
|
-
// name: '微搭教育测试号',
|
|
410
|
-
// corp_id: 'ww614741a1d5169bc7',
|
|
411
|
-
// parent_code: '!!ROOT',
|
|
412
|
-
// },
|
|
413
|
-
// {
|
|
414
|
-
// id: 'wwd51f6cad24517ee1.-1',
|
|
415
|
-
// code: 'wwd51f6cad24517ee1.-1',
|
|
416
|
-
// name: '未知部门',
|
|
417
|
-
// corp_id: 'wwd51f6cad24517ee1',
|
|
418
|
-
// parent_code: 'wwd51f6cad24517ee1.1',
|
|
419
|
-
// },
|
|
420
|
-
// {
|
|
421
|
-
// id: '1',
|
|
422
|
-
// code: '1',
|
|
423
|
-
// name: '微搭教育局测试',
|
|
424
|
-
// corp_id: 'ww1172107f1b5f810f',
|
|
425
|
-
// parent_code: '!!ROOT',
|
|
426
|
-
// },
|
|
427
|
-
// {
|
|
428
|
-
// id: '2',
|
|
429
|
-
// code: '2',
|
|
430
|
-
// name: 'bg1',
|
|
431
|
-
// corp_id: 'ww1172107f1b5f810f',
|
|
432
|
-
// parent_code: '1',
|
|
433
|
-
// },
|
|
434
|
-
// {
|
|
435
|
-
// id: '3',
|
|
436
|
-
// code: '3',
|
|
437
|
-
// name: 'dep1',
|
|
438
|
-
// corp_id: 'ww1172107f1b5f810f',
|
|
439
|
-
// parent_code: '2',
|
|
440
|
-
// },
|
|
441
|
-
// {
|
|
442
|
-
// id: '4',
|
|
443
|
-
// code: '4',
|
|
444
|
-
// name: 'bg2',
|
|
445
|
-
// corp_id: 'ww1172107f1b5f810f',
|
|
446
|
-
// parent_code: '1',
|
|
447
|
-
// },
|
|
448
|
-
// {
|
|
449
|
-
// id: '5',
|
|
450
|
-
// code: '5',
|
|
451
|
-
// name: 'dep2',
|
|
452
|
-
// corp_id: 'ww1172107f1b5f810f',
|
|
453
|
-
// parent_code: '4',
|
|
454
|
-
// },
|
|
455
|
-
// {
|
|
456
|
-
// id: '6',
|
|
457
|
-
// code: '6',
|
|
458
|
-
// name: 'ce1',
|
|
459
|
-
// corp_id: 'ww1172107f1b5f810f',
|
|
460
|
-
// parent_code: '3',
|
|
461
|
-
// },
|
|
462
|
-
// {
|
|
463
|
-
// id: '7',
|
|
464
|
-
// code: '7',
|
|
465
|
-
// name: 'ce2',
|
|
466
|
-
// corp_id: 'ww1172107f1b5f810f',
|
|
467
|
-
// parent_code: '5',
|
|
468
|
-
// },
|
|
469
|
-
// {
|
|
470
|
-
// id: '8aac26e7643698ee000b33c3623f7229',
|
|
471
|
-
// code: 'csig_gt95',
|
|
472
|
-
// name: 'csig',
|
|
473
|
-
// parent_code: '!!ROOT',
|
|
474
|
-
// },
|
|
475
|
-
// {
|
|
476
|
-
// id: '27d2eb90643698f6001b7cbb3f1be579',
|
|
477
|
-
// code: 'pcg_nv87',
|
|
478
|
-
// name: 'pcg',
|
|
479
|
-
// parent_code: '!!ROOT',
|
|
480
|
-
// },
|
|
481
|
-
// {
|
|
482
|
-
// id: '27d2eb90643698fb001b7d034ed9c24d',
|
|
483
|
-
// code: 'wxg_jnps',
|
|
484
|
-
// name: 'wxg',
|
|
485
|
-
// parent_code: '!!ROOT',
|
|
486
|
-
// },
|
|
487
|
-
// {
|
|
488
|
-
// id: 'e981bc4764369a0c000511673ed277f2',
|
|
489
|
-
// code: 'yun1_uihp',
|
|
490
|
-
// name: 'yun-1',
|
|
491
|
-
// parent_code: 'csig_gt95',
|
|
492
|
-
// },
|
|
493
|
-
// {
|
|
494
|
-
// id: '5f9d834564369a25000d0337005f16d9',
|
|
495
|
-
// code: 'tcbcenter_jucx',
|
|
496
|
-
// name: 'tcb-center',
|
|
497
|
-
// parent_code: 'yun1_uihp',
|
|
498
|
-
// },
|
|
499
|
-
// {
|
|
500
|
-
// id: 'fc8e646564369a32084690da3915cd0c',
|
|
501
|
-
// code: 'weda_rbyy',
|
|
502
|
-
// name: 'weda',
|
|
503
|
-
// parent_code: 'tcbcenter_jucx',
|
|
504
|
-
// },
|
|
505
|
-
// {
|
|
506
|
-
// id: '34117fc064369a3f0019d82650f6864c',
|
|
507
|
-
// code: 'dev1_qej3',
|
|
508
|
-
// name: 'dev-1',
|
|
509
|
-
// parent_code: 'weda_rbyy',
|
|
510
|
-
// },
|
|
511
|
-
// {
|
|
512
|
-
// id: '0122a58764369a4c0851676d4ee05fdf',
|
|
513
|
-
// code: 'dev2_sqpc',
|
|
514
|
-
// name: 'dev-2',
|
|
515
|
-
// parent_code: 'weda_rbyy',
|
|
516
|
-
// },
|
|
517
|
-
// {
|
|
518
|
-
// id: '73bf2b5f64369a5e0015d78e2d2ad526',
|
|
519
|
-
// code: 'news_s39j',
|
|
520
|
-
// name: 'news',
|
|
521
|
-
// parent_code: 'pcg_nv87',
|
|
522
|
-
// },
|
|
523
|
-
// {
|
|
524
|
-
// id: '37e984a764369a690017cef22413bcb4',
|
|
525
|
-
// code: 'yun2_laq4',
|
|
526
|
-
// name: 'yun-2',
|
|
527
|
-
// parent_code: 'csig_gt95',
|
|
528
|
-
// },
|
|
529
|
-
// {
|
|
530
|
-
// id: '34117fc064369a710019dbfa1750a118',
|
|
531
|
-
// code: 'yun3_kw9v',
|
|
532
|
-
// name: 'yun-3',
|
|
533
|
-
// parent_code: 'csig_gt95',
|
|
534
|
-
// },
|
|
535
|
-
// {
|
|
536
|
-
// id: '2cc84e2664369a82085575d367329143',
|
|
537
|
-
// code: 'bigdata_i9ee',
|
|
538
|
-
// name: 'bigdata',
|
|
539
|
-
// parent_code: 'yun2_laq4',
|
|
540
|
-
// },
|
|
541
|
-
// ];
|
|
542
|
-
return departList.map(({ id, name, code, parent_code, corp_id }) => ({
|
|
543
|
-
id,
|
|
544
|
-
name,
|
|
545
|
-
code,
|
|
546
|
-
parentCode: parent_code,
|
|
547
|
-
corpId: corp_id,
|
|
548
|
-
type: 'department',
|
|
549
|
-
selectable: true,
|
|
550
|
-
}));
|
|
551
|
-
}
|
|
552
|
-
catch (error) {
|
|
553
|
-
console.error('错误', error);
|
|
554
|
-
throw errorHandle(error, 'GetDepartments');
|
|
555
|
-
}
|
|
556
|
-
};
|
|
557
|
-
/**
|
|
558
|
-
* 拉取所有部门列表
|
|
559
|
-
* @returns
|
|
560
|
-
*/
|
|
561
|
-
export const fetchAllDepartments = async (request) => {
|
|
562
|
-
try {
|
|
563
|
-
const departmentList = await fetchAllDepartmentsByParentId({
|
|
564
|
-
request,
|
|
565
|
-
// 两个参数都不传,拉取所有的部门列表
|
|
566
|
-
corpId: undefined,
|
|
567
|
-
departmentId: undefined,
|
|
568
|
-
});
|
|
569
|
-
return departmentList;
|
|
570
|
-
}
|
|
571
|
-
catch (error) {
|
|
572
|
-
console.error('错误', error);
|
|
573
|
-
throw errorHandle(error, 'GetDepartments');
|
|
574
|
-
}
|
|
575
|
-
};
|
|
576
|
-
export const fetchUsersByParentId = async ({ request = defaultRequest, corpId, departmentId, pageNumber, pageSize, }) => {
|
|
577
|
-
try {
|
|
578
|
-
const { total, data: userList } = await request('GetUsers', {
|
|
579
|
-
corp_id: corpId,
|
|
580
|
-
department_id: departmentId,
|
|
581
|
-
page_number: pageNumber,
|
|
582
|
-
page_size: pageSize,
|
|
583
|
-
});
|
|
584
|
-
// await delay(300);
|
|
585
|
-
// const userList = [
|
|
586
|
-
// {
|
|
587
|
-
// id: '1640262947716259842',
|
|
588
|
-
// name: 'administrator',
|
|
589
|
-
// },
|
|
590
|
-
// {
|
|
591
|
-
// id: '1645759252615413760',
|
|
592
|
-
// name: 'HuangXin',
|
|
593
|
-
// department_id: 'ww614741a1d5169bc7.1',
|
|
594
|
-
// },
|
|
595
|
-
// {
|
|
596
|
-
// id: '1645759254695788544',
|
|
597
|
-
// name: 'WangQian',
|
|
598
|
-
// department_id: 'ww614741a1d5169bc7.1',
|
|
599
|
-
// },
|
|
600
|
-
// {
|
|
601
|
-
// id: '1645759256725831680',
|
|
602
|
-
// name: 'ZhaoXiuWen',
|
|
603
|
-
// department_id: 'ww614741a1d5169bc7.1',
|
|
604
|
-
// },
|
|
605
|
-
// {
|
|
606
|
-
// id: '1645759258776846336',
|
|
607
|
-
// name: 'LinHaoJie',
|
|
608
|
-
// department_id: 'ww614741a1d5169bc7.1',
|
|
609
|
-
// },
|
|
610
|
-
// {
|
|
611
|
-
// id: '1646032139150704640',
|
|
612
|
-
// name: 'HuMing',
|
|
613
|
-
// department_id: '1',
|
|
614
|
-
// },
|
|
615
|
-
// {
|
|
616
|
-
// id: '1646032158993956864',
|
|
617
|
-
// name: 'LinHaoJie',
|
|
618
|
-
// department_id: '1',
|
|
619
|
-
// },
|
|
620
|
-
// {
|
|
621
|
-
// id: '1646032162441674752',
|
|
622
|
-
// name: 'XiaoXiaoZhi',
|
|
623
|
-
// department_id: '1',
|
|
624
|
-
// },
|
|
625
|
-
// {
|
|
626
|
-
// id: '1646032165851643904',
|
|
627
|
-
// name: 'GuoGuoGuoGuo',
|
|
628
|
-
// department_id: '1',
|
|
629
|
-
// },
|
|
630
|
-
// {
|
|
631
|
-
// id: '1646032172134711296',
|
|
632
|
-
// name: 'LiNanXi',
|
|
633
|
-
// department_id: '1',
|
|
634
|
-
// },
|
|
635
|
-
// {
|
|
636
|
-
// id: '1646032175997665280',
|
|
637
|
-
// name: 'myprincessd',
|
|
638
|
-
// department_id: '1',
|
|
639
|
-
// },
|
|
640
|
-
// {
|
|
641
|
-
// id: '1646032447440437248',
|
|
642
|
-
// name: 'LiNanXi',
|
|
643
|
-
// department_id: 'wwd51f6cad24517ee1.1',
|
|
644
|
-
// },
|
|
645
|
-
// {
|
|
646
|
-
// id: '1646032449545977856',
|
|
647
|
-
// name: 'LvQiWen',
|
|
648
|
-
// department_id: 'wwd51f6cad24517ee1.1',
|
|
649
|
-
// },
|
|
650
|
-
// {
|
|
651
|
-
// id: '1646032451626352640',
|
|
652
|
-
// name: 'LeiChao',
|
|
653
|
-
// department_id: 'wwd51f6cad24517ee1.1',
|
|
654
|
-
// },
|
|
655
|
-
// {
|
|
656
|
-
// id: '1646032453547343872',
|
|
657
|
-
// name: 'LinHaoJie',
|
|
658
|
-
// department_id: 'wwd51f6cad24517ee1.1',
|
|
659
|
-
// },
|
|
660
|
-
// {
|
|
661
|
-
// id: '1646062670064140288',
|
|
662
|
-
// name: 'LiuGuoWei',
|
|
663
|
-
// department_id: 'wwd51f6cad24517ee1.1',
|
|
664
|
-
// },
|
|
665
|
-
// {
|
|
666
|
-
// id: '1646062673885151232',
|
|
667
|
-
// name: 'charlessliu',
|
|
668
|
-
// department_id: 'wwd51f6cad24517ee1.1',
|
|
669
|
-
// },
|
|
670
|
-
// {
|
|
671
|
-
// id: '1646063286429696000',
|
|
672
|
-
// name: 'JiaZhiPeng',
|
|
673
|
-
// corp_id: 'wwd51f6cad24517ee1',
|
|
674
|
-
// department_id: 'wwd51f6cad24517ee1.1',
|
|
675
|
-
// },
|
|
676
|
-
// {
|
|
677
|
-
// id: '1646063496270725120',
|
|
678
|
-
// name: 'HuangXin',
|
|
679
|
-
// corp_id: 'wwd51f6cad24517ee1',
|
|
680
|
-
// department_id: 'wwd51f6cad24517ee1.1',
|
|
681
|
-
// },
|
|
682
|
-
// ];
|
|
683
|
-
if (!userList || !Array.isArray(userList) || userList.length <= 0) {
|
|
684
|
-
return {
|
|
685
|
-
dataList: [],
|
|
686
|
-
total: 0,
|
|
687
|
-
};
|
|
688
|
-
}
|
|
689
|
-
const records = userList.map((user) => ({
|
|
690
|
-
...user,
|
|
691
|
-
content: user.name,
|
|
692
|
-
userId: user.id,
|
|
693
|
-
}));
|
|
694
|
-
return {
|
|
695
|
-
dataList: records,
|
|
696
|
-
total,
|
|
697
|
-
};
|
|
698
|
-
}
|
|
699
|
-
catch (error) {
|
|
700
|
-
console.error('错误', error);
|
|
701
|
-
throw errorHandle(error, 'GetUsers');
|
|
255
|
+
throw errorHandle(error, 'fetchViewList');
|
|
702
256
|
}
|
|
703
257
|
};
|