@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
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
2
|
import { useEffect, useState } from 'react';
|
|
4
3
|
import { Modal } from 'tea-component';
|
|
5
4
|
import { ModalSearchH5 } from './modal-search-h5';
|
|
@@ -9,13 +8,13 @@ import { SelectedListH5 } from './selected-list-h5';
|
|
|
9
8
|
import './index.css';
|
|
10
9
|
import { OrgTreeH5 } from './org-tree-h5';
|
|
11
10
|
import { UserListH5 } from './user-select-h5/user-list-h5';
|
|
12
|
-
import { getNode, getBreadNode } from '../common/utils';
|
|
11
|
+
import { getNode, getBreadNode, getPropertiesList } from '../common/utils';
|
|
13
12
|
import debounce from '../../../../utils/debounce';
|
|
14
|
-
import {
|
|
13
|
+
import { fetchSearchUser, fetchUserList } from '../common/fetch-data-service';
|
|
15
14
|
const appendNode = { id: 'appendNode', content: '直属成员' };
|
|
16
15
|
export const ModalSelectH5 = (props) => {
|
|
17
16
|
var _a;
|
|
18
|
-
const { open, onClose, onConfirm,
|
|
17
|
+
const { open, onClose, onConfirm, treeData, multiple = false, errorInfo, setErrorInfo, selectedUserList, setSelectedUserList, confirmUserList, request, filterParams, pageNo, setPageNo, pageSize, treeDataError, secondDisplay, } = props;
|
|
19
18
|
const [loading, setLoading] = useState({ id: null, status: false });
|
|
20
19
|
const [pageLoading, setPageLoading] = useState(false);
|
|
21
20
|
const [listLoading, setListLoading] = useState(false);
|
|
@@ -62,19 +61,9 @@ export const ModalSelectH5 = (props) => {
|
|
|
62
61
|
setBreadCrumbData([]);
|
|
63
62
|
if (key && key.length > 0) {
|
|
64
63
|
setPageLoading(true);
|
|
65
|
-
|
|
66
|
-
request,
|
|
67
|
-
pageNumber: 1,
|
|
68
|
-
pageSize: 200,
|
|
69
|
-
searchCondition: { key, ...filterParams },
|
|
70
|
-
})
|
|
71
|
-
.then(({ dataList }) => {
|
|
64
|
+
fetchSearchUser({ key, ...filterParams }, request).then((res) => {
|
|
72
65
|
setPageLoading(false);
|
|
73
|
-
setUserList(
|
|
74
|
-
})
|
|
75
|
-
.catch((err) => {
|
|
76
|
-
setPageLoading(false);
|
|
77
|
-
setErrorInfo({ errorStatus: true, errorMessage: err });
|
|
66
|
+
setUserList(res);
|
|
78
67
|
});
|
|
79
68
|
}
|
|
80
69
|
else {
|
|
@@ -90,85 +79,30 @@ export const ModalSelectH5 = (props) => {
|
|
|
90
79
|
const cancleSearch = () => {
|
|
91
80
|
onrest();
|
|
92
81
|
};
|
|
93
|
-
const resolveQuery = (orgId) => {
|
|
94
|
-
const query = {};
|
|
95
|
-
if (!orgId) {
|
|
96
|
-
return query;
|
|
97
|
-
}
|
|
98
|
-
const item = orgList.find((item) => item.id === orgId);
|
|
99
|
-
if (!item) {
|
|
100
|
-
return query;
|
|
101
|
-
}
|
|
102
|
-
if (item.type === 'corp') {
|
|
103
|
-
// 查询当前企业下的部门或用户时,corpId需要传空字符串
|
|
104
|
-
if (orgId === CURRENT_CORP.id) {
|
|
105
|
-
query.corpId = '';
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
query.corpId = orgId;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
else if (item.type === 'department') {
|
|
112
|
-
query.departmentId = orgId;
|
|
113
|
-
}
|
|
114
|
-
return query;
|
|
115
|
-
};
|
|
116
82
|
const loadItem = (item) => {
|
|
117
83
|
var _a;
|
|
118
84
|
try {
|
|
119
|
-
setIsEnd(false);
|
|
120
85
|
setPageNo(1);
|
|
121
86
|
setLoading({ id: item === null || item === void 0 ? void 0 : item.id, status: true });
|
|
122
|
-
//【未关联部门用户】
|
|
123
|
-
if (item === null || item === void 0 ? void 0 : item.id.startsWith('isNoOrgList')) {
|
|
124
|
-
const query = {};
|
|
125
|
-
const parentCode = item === null || item === void 0 ? void 0 : item.parentCode;
|
|
126
|
-
if (parentCode === CURRENT_CORP.id) {
|
|
127
|
-
// 查询当前企业用户后端接口要求传空
|
|
128
|
-
query.corpId = '';
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
query.corpId = parentCode;
|
|
132
|
-
}
|
|
133
|
-
fetchUserData({
|
|
134
|
-
request,
|
|
135
|
-
pageNumber: pageNo,
|
|
136
|
-
pageSize,
|
|
137
|
-
...query,
|
|
138
|
-
searchCondition: { ...filterParams },
|
|
139
|
-
});
|
|
140
|
-
setBreadCrumbData(getBreadNode(breadCrumbData, item));
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
87
|
switch (item === null || item === void 0 ? void 0 : item.id) {
|
|
88
|
+
case 'isNoOrgList': {
|
|
89
|
+
const orgId = item === null || item === void 0 ? void 0 : item.id;
|
|
90
|
+
fetchUserData({ orgId, pageNo, pageSize, request, ...filterParams });
|
|
91
|
+
setBreadCrumbData(getBreadNode(breadCrumbData, item));
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
144
94
|
case 'appendNode': {
|
|
145
95
|
const orgId = (_a = breadCrumbData[breadCrumbData.length - 1]) === null || _a === void 0 ? void 0 : _a.id;
|
|
146
|
-
|
|
147
|
-
const query = resolveQuery(orgId);
|
|
148
|
-
fetchUserData({
|
|
149
|
-
request,
|
|
150
|
-
pageNumber: pageNo,
|
|
151
|
-
pageSize,
|
|
152
|
-
...query,
|
|
153
|
-
searchCondition: {
|
|
154
|
-
...filterParams,
|
|
155
|
-
},
|
|
156
|
-
});
|
|
96
|
+
fetchUserData({ orgId, pageNo, pageSize, request, ...filterParams });
|
|
157
97
|
break;
|
|
158
98
|
}
|
|
159
99
|
default: {
|
|
160
|
-
|
|
161
|
-
fetchUsersByParentId({
|
|
162
|
-
pageNumber: 1,
|
|
163
|
-
pageSize: 1,
|
|
164
|
-
...query,
|
|
165
|
-
searchCondition: { ...filterParams },
|
|
166
|
-
}).then(({ total, dataList }) => {
|
|
100
|
+
fetchUserList({ OrgId: item === null || item === void 0 ? void 0 : item.id, pageNo, pageSize, ...filterParams }, request).then((res) => {
|
|
167
101
|
setLoading({ id: null, status: false });
|
|
168
102
|
setListLoading(false);
|
|
169
|
-
if (total > 0) {
|
|
170
|
-
appendNode['children'] =
|
|
171
|
-
appendNode['content'] = `直属成员(${total})`;
|
|
103
|
+
if ((res === null || res === void 0 ? void 0 : res.total) > 0) {
|
|
104
|
+
appendNode['children'] = res === null || res === void 0 ? void 0 : res.records;
|
|
105
|
+
appendNode['content'] = `直属成员(${res === null || res === void 0 ? void 0 : res.total})`;
|
|
172
106
|
setShowTreeData((item === null || item === void 0 ? void 0 : item.children)
|
|
173
107
|
? [appendNode].concat(item === null || item === void 0 ? void 0 : item.children)
|
|
174
108
|
: [appendNode]);
|
|
@@ -212,46 +146,49 @@ export const ModalSelectH5 = (props) => {
|
|
|
212
146
|
const onScrollBottom = debounce(() => {
|
|
213
147
|
var _a;
|
|
214
148
|
if (!(keyWords && keyWords.length > 0)) {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
setLoading({ id: orgId, status: true });
|
|
219
|
-
const query = resolveQuery(orgId);
|
|
220
|
-
fetchUserData({
|
|
221
|
-
request,
|
|
222
|
-
pageNumber: pageNo,
|
|
223
|
-
pageSize,
|
|
224
|
-
...query,
|
|
225
|
-
...filterParams,
|
|
226
|
-
});
|
|
227
|
-
}
|
|
149
|
+
const orgId = ((_a = breadCrumbData[breadCrumbData.length - 1]) === null || _a === void 0 ? void 0 : _a.id) || 'isNoOrgList';
|
|
150
|
+
setLoading({ id: orgId, status: true });
|
|
151
|
+
fetchUserData({ orgId, pageNo, pageSize, request, ...filterParams });
|
|
228
152
|
}
|
|
229
153
|
}, 1000);
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
const fetchUserData = (params) => {
|
|
234
|
-
if (!isEnd) {
|
|
235
|
-
const { request, corpId, departmentId, pageNumber, pageSize, searchCondition, } = params;
|
|
236
|
-
fetchUsersByParentId({
|
|
237
|
-
request,
|
|
238
|
-
corpId,
|
|
239
|
-
departmentId,
|
|
240
|
-
pageNumber,
|
|
241
|
-
pageSize,
|
|
242
|
-
searchCondition,
|
|
243
|
-
}).then(({ total, dataList }) => {
|
|
154
|
+
const fetchUserData = ({ orgId, pageNo, pageSize, request, ...resetProps }) => {
|
|
155
|
+
if (orgId && !isEnd) {
|
|
156
|
+
fetchUserList({ OrgId: orgId, pageNo, pageSize, ...resetProps }, request).then((res) => {
|
|
244
157
|
setLoading({ id: null, status: false });
|
|
245
|
-
if (total > 0) {
|
|
246
|
-
const
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
158
|
+
if ((res === null || res === void 0 ? void 0 : res.total) > 0) {
|
|
159
|
+
const currentUserData = userList.concat(res === null || res === void 0 ? void 0 : res.records);
|
|
160
|
+
const userSchemaData = currentUserData.map((item) => {
|
|
161
|
+
const properties = getPropertiesList(item.userExtend, item.userSchema);
|
|
162
|
+
if (Array.isArray(properties) && properties.length) {
|
|
163
|
+
return Promise.all(properties).then((value) => {
|
|
164
|
+
return { ...item, userSchemaProps: value };
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
return item;
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
Promise.all(userSchemaData)
|
|
172
|
+
.then((data) => {
|
|
173
|
+
setUserList(data);
|
|
174
|
+
setShowTreeData([]);
|
|
175
|
+
if ((res === null || res === void 0 ? void 0 : res.total) <= data.length) {
|
|
176
|
+
setIsEnd(true);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
setPageNo(pageNo + 1);
|
|
180
|
+
}
|
|
181
|
+
})
|
|
182
|
+
.catch(() => {
|
|
183
|
+
setUserList(currentUserData);
|
|
184
|
+
setShowTreeData([]);
|
|
185
|
+
if ((res === null || res === void 0 ? void 0 : res.total) <= currentUserData.length) {
|
|
186
|
+
setIsEnd(true);
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
setPageNo(pageNo + 1);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
255
192
|
}
|
|
256
193
|
});
|
|
257
194
|
}
|
|
@@ -260,7 +197,7 @@ export const ModalSelectH5 = (props) => {
|
|
|
260
197
|
document.getElementById('wd-search-input').blur();
|
|
261
198
|
e.stopPropagation();
|
|
262
199
|
};
|
|
263
|
-
return (_jsxs(Modal, { visible: open, onClose: () => {
|
|
200
|
+
return (_jsxs(Modal, { disableEscape: true, maskClosable: false, visible: open, onClose: () => {
|
|
264
201
|
onrest();
|
|
265
202
|
onClose();
|
|
266
203
|
}, destroyOnClose: true, className: `weda-ui weda-select-user-dept__dialog`, children: [_jsxs(Modal.Body, { className: ((_a = selectedUserList[0]) === null || _a === void 0 ? void 0 : _a.userId) ? 'is-selected-value' : '', children: [_jsx("div", { className: "weda-select-user-dept__dialog-header", children: '选择成员' }), _jsx(ModalSearchH5, { value: keyWords, onChange: (key) => {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo } from 'react';
|
|
3
2
|
import { Tree } from 'tea-component';
|
|
4
3
|
import { LoadingStatus, ErrorStatus } from './error-tips';
|
|
5
4
|
import './index.css';
|
|
@@ -29,29 +28,14 @@ export const OrgTree = (props) => {
|
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
30
|
}
|
|
31
|
+
//}
|
|
32
32
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
};
|
|
40
|
-
const handleOnSelect = (ids, context) => {
|
|
41
|
-
onChange(ids, context === null || context === void 0 ? void 0 : context.selected, context === null || context === void 0 ? void 0 : context.nodeId, true);
|
|
42
|
-
};
|
|
43
|
-
const TreeNodes = useMemo(() => {
|
|
44
|
-
const renderTreeNodes = (node) => {
|
|
45
|
-
if (!node.children || (node.children || []).length <= 0) {
|
|
46
|
-
return (_jsx(Tree.Node, { id: node.id, content: node.content, selectable: node.type !== 'corp' }));
|
|
47
|
-
}
|
|
48
|
-
return (_jsx(Tree.Node, { id: node.id, content: node.content, selectable: node.type !== 'corp', children: node.children.map((node) => {
|
|
49
|
-
return renderTreeNodes(node);
|
|
50
|
-
}) }));
|
|
51
|
-
};
|
|
52
|
-
return treeData.map((node) => renderTreeNodes(node));
|
|
53
|
-
}, [treeData]);
|
|
54
|
-
return (_jsx(_Fragment, { children: treeDataError ? (_jsx(ErrorStatus, { description: treeDataError || null })) : (_jsx(_Fragment, { children: treeData && treeData.length > 0 && !treeDataError ? (_jsx(Tree, { className: "depart-tree", fullActivable: true, activable: true, selectable: selectable, selectedIds: selectedOrgId, activeIds: selectedOrgId, defaultExpandedIds: defaultExpandedIds, selectStrictly: true, onActive: handleOnActive, onSelect: handleOnSelect,
|
|
33
|
+
return (_jsx(_Fragment, { children: treeDataError ? (_jsx(ErrorStatus, { description: treeDataError || null })) : (_jsx(_Fragment, { children: treeData && treeData.length > 0 && !treeDataError ? (_jsx(Tree, { className: "depart-tree", data: treeData, fullActivable: true, activable: true, selectable: selectable, selectedIds: selectedOrgId, activeIds: selectedOrgId, defaultExpandedIds: defaultExpandedIds, selectStrictly: true, onActive: (ids, context) => {
|
|
34
|
+
var _a;
|
|
35
|
+
onChange(ids, context === null || context === void 0 ? void 0 : context.active, context === null || context === void 0 ? void 0 : context.nodeId, (_a = context === null || context === void 0 ? void 0 : context.data) === null || _a === void 0 ? void 0 : _a.selectable);
|
|
36
|
+
}, onSelect: (ids, context) => {
|
|
37
|
+
onChange(ids, context === null || context === void 0 ? void 0 : context.selected, context === null || context === void 0 ? void 0 : context.nodeId, true);
|
|
38
|
+
},
|
|
55
39
|
// 开启虚拟滚动,优化大数据量性能!!
|
|
56
|
-
height: 320
|
|
40
|
+
height: 320 })) : (_jsx(LoadingStatus, {})) })) }));
|
|
57
41
|
};
|
|
@@ -21,14 +21,14 @@ export const UserOrgList = ({ isUser = true, userOrgList, isOrg, loading, errorS
|
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
return (_jsx(List, { className: "weda-ui-user-select-list", children: _jsx(List.Item, { children: loading ? (_jsx(LoadingStatus, {})) : (_jsx(_Fragment, { children: errorStatus ? (_jsx(ErrorStatus, { description: errorMessage || null })) : (_jsx(_Fragment, { children: userOrgList && userOrgList.length > 0 ? (_jsx(_Fragment, { children: multiple ? (_jsx("div", { children: _jsx(Checkbox.Group, { layout: "column", value: selectedIds, children: (userOrgList || []).map((item) => {
|
|
24
|
-
var _a
|
|
25
|
-
return (_jsxs(_Fragment, { children: [_jsxs(Checkbox, { className: 'weda-ui-user-select-list_box', name: item === null || item === void 0 ? void 0 : item.id, onChange: (value) => onChange(value, item), children: [_jsx("i", { className: 'weda-ui-user-select-list__user' }), item === null || item === void 0 ? void 0 : item.content, isOrg && isUser && (_jsx(Text, { theme: "label", className: Margin.Left['2n'], children: (
|
|
24
|
+
var _a;
|
|
25
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Checkbox, { className: 'weda-ui-user-select-list_box', name: item === null || item === void 0 ? void 0 : item.id, onChange: (value) => onChange(value, item), children: [_jsx("i", { className: 'weda-ui-user-select-list__user' }), item === null || item === void 0 ? void 0 : item.content, isOrg && isUser && (_jsx(Text, { theme: "label", className: Margin.Left['2n'], children: (_a = item === null || item === void 0 ? void 0 : item.mainOrg[0]) === null || _a === void 0 ? void 0 : _a.OrgName }))] }), _jsx("span", { className: 'weda-ui-user-select-list__display', style: {
|
|
26
26
|
display: displayUserInfo(item, secondDisplay)
|
|
27
27
|
? 'block'
|
|
28
28
|
: 'none',
|
|
29
29
|
}, children: displayUserInfo(item, secondDisplay) })] }));
|
|
30
30
|
}) }) })) : (_jsx(_Fragment, { children: (userOrgList || []).map((item, index) => {
|
|
31
|
-
var _a
|
|
31
|
+
var _a;
|
|
32
32
|
return (_jsxs(Radio.Group, { value: selectedIds[0], layout: "column", onChange: (value) => {
|
|
33
33
|
// 被选中过,取消选中
|
|
34
34
|
if ((selectedIds || []).indexOf(value) !== -1) {
|
|
@@ -44,7 +44,7 @@ export const UserOrgList = ({ isUser = true, userOrgList, isOrg, loading, errorS
|
|
|
44
44
|
: false;
|
|
45
45
|
setSelectedList(list);
|
|
46
46
|
}
|
|
47
|
-
}, children: [_jsxs(Radio, { name: item === null || item === void 0 ? void 0 : item.id, children: [_jsx("i", { className: 'weda-ui-user-select-list__user' }), item === null || item === void 0 ? void 0 : item.content, isOrg && isUser && (_jsx(Text, { theme: "label", className: Margin.Left['2n'], children: (
|
|
47
|
+
}, children: [_jsxs(Radio, { name: item === null || item === void 0 ? void 0 : item.id, children: [_jsx("i", { className: 'weda-ui-user-select-list__user' }), item === null || item === void 0 ? void 0 : item.content, isOrg && isUser && (_jsx(Text, { theme: "label", className: Margin.Left['2n'], children: (_a = item === null || item === void 0 ? void 0 : item.mainOrg[0]) === null || _a === void 0 ? void 0 : _a.OrgName }))] }), _jsx("span", { className: 'weda-ui-user-select-list__display weda-ui-user-select-list__display-radio', style: {
|
|
48
48
|
display: displayUserInfo(item, secondDisplay)
|
|
49
49
|
? 'block'
|
|
50
50
|
: 'none',
|
|
@@ -4,15 +4,22 @@ import { UserSelectPC } from '../user-select-pc/user-select-pc';
|
|
|
4
4
|
import { UserTreeSelectH5 as UserSelectH5 } from './user-select-h5';
|
|
5
5
|
import '../userOrgSelect.css';
|
|
6
6
|
import { isInIde, filterStrList, getUserInfo, usePlatform, } from '../../../../../utils/platform';
|
|
7
|
-
import { parseStrToArr } from '../../common/utils';
|
|
8
7
|
import { useSyncValue } from '../../../../../utils/hooks/useSyncValue';
|
|
9
8
|
import isObjectEqual from '../../../../../utils/isObjectEqual';
|
|
10
9
|
import { getUserListByIds, defaultRequest, } from '../../common/fetch-data-service';
|
|
11
10
|
import { emptyArray, emptyObject } from '../../../../../utils/constant';
|
|
12
11
|
import { useViewData } from '../../hooks/use-views-data';
|
|
13
|
-
import {
|
|
12
|
+
import { useDepartData } from '../../hooks/use-depart-data';
|
|
13
|
+
import { parseStrToArr } from '../../common/utils';
|
|
14
14
|
export default function UserTreeSelect(props) {
|
|
15
|
-
const { events = emptyObject, defaultValue = emptyArray, confirmValue = '', defaultValueType = 'noneUser', onChange = null, multiple = false, request = defaultRequest, where, confirmAction, closeAction,
|
|
15
|
+
const { events = emptyObject, defaultValue = emptyArray, confirmValue = '', defaultValueType = 'noneUser', onChange = null, multiple = false, request = defaultRequest, where, confirmAction, closeAction, secondDisplay, // 辅助信息
|
|
16
|
+
/**
|
|
17
|
+
* 以下两个属性 不用在组件库,企业工作台使用该组件时支持外部定义样式
|
|
18
|
+
* naked: 单纯使用该组件,而不在FormCell中使用(该组件实现默认在在)
|
|
19
|
+
* containerClass: string
|
|
20
|
+
* triggerElement: React.ReactNode
|
|
21
|
+
*/
|
|
22
|
+
naked = false, containerClass = '', triggerElement = null, } = props;
|
|
16
23
|
const platform = usePlatform();
|
|
17
24
|
const [errInfo, setErrInfo] = useState({
|
|
18
25
|
errorStatus: false,
|
|
@@ -35,15 +42,11 @@ export default function UserTreeSelect(props) {
|
|
|
35
42
|
//组织下展示用户页大小
|
|
36
43
|
const pageSize = 200;
|
|
37
44
|
const { filterParams } = useViewData(where);
|
|
38
|
-
const {
|
|
39
|
-
// orgTreeData: treeData,
|
|
40
|
-
finalOrgTreeData: treeData, error, } = useDepartDataNew({
|
|
41
|
-
request,
|
|
42
|
-
});
|
|
45
|
+
const { treeData, error } = useDepartData({ request });
|
|
43
46
|
// 默认选中第一个部门
|
|
44
47
|
useEffect(() => {
|
|
45
48
|
var _a;
|
|
46
|
-
if (treeData && treeData.length > 0
|
|
49
|
+
if (!selectedOrgId && treeData && treeData.length > 0) {
|
|
47
50
|
setSelectedOrgId((_a = treeData[0]) === null || _a === void 0 ? void 0 : _a.id);
|
|
48
51
|
}
|
|
49
52
|
}, [selectedOrgId, treeData]);
|
|
@@ -69,30 +72,30 @@ export default function UserTreeSelect(props) {
|
|
|
69
72
|
setSelectUserIds(multiple ? [logginUserInfo === null || logginUserInfo === void 0 ? void 0 : logginUserInfo.userId] : logginUserInfo === null || logginUserInfo === void 0 ? void 0 : logginUserInfo.userId);
|
|
70
73
|
}
|
|
71
74
|
};
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
setConfirmUserList(userSelectList);
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
setConfirmUserList([]);
|
|
87
|
-
}
|
|
75
|
+
const getDefaultUser = async (defaultValue) => {
|
|
76
|
+
try {
|
|
77
|
+
setErrInfo({ errorStatus: false, errorMessage: null });
|
|
78
|
+
// 避免ide mock值请求数据异常
|
|
79
|
+
if (defaultValue && defaultValue.length !== 0 && !isInIde()) {
|
|
80
|
+
const userSelectList = await getUserListByIds({
|
|
81
|
+
selectUserIds: filterStrList(parseStrToArr(defaultValue)) || [],
|
|
82
|
+
IsNoRelatedOrgFlag: false,
|
|
83
|
+
request,
|
|
84
|
+
});
|
|
85
|
+
setConfirmUserList(userSelectList);
|
|
88
86
|
}
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
else {
|
|
88
|
+
setConfirmUserList([]);
|
|
91
89
|
}
|
|
92
|
-
}
|
|
90
|
+
}
|
|
91
|
+
catch (e) {
|
|
92
|
+
setErrInfo({ errorStatus: true, errorMessage: e });
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
useEffect(() => {
|
|
93
96
|
try {
|
|
94
97
|
if (!isObjectEqual(prevDefaultRef.current, selectUserIds)) {
|
|
95
|
-
|
|
98
|
+
getDefaultUser(selectUserIds);
|
|
96
99
|
prevDefaultRef.current = selectUserIds;
|
|
97
100
|
}
|
|
98
101
|
}
|
|
@@ -144,17 +147,23 @@ export default function UserTreeSelect(props) {
|
|
|
144
147
|
platform,
|
|
145
148
|
filterParams,
|
|
146
149
|
treeData,
|
|
147
|
-
orgList,
|
|
148
150
|
error,
|
|
149
151
|
onConfirmSelectUser,
|
|
152
|
+
secondDisplay,
|
|
153
|
+
};
|
|
154
|
+
// 企业工作台使用该组件时,支持自定义样式
|
|
155
|
+
const extraProps = {
|
|
156
|
+
naked,
|
|
157
|
+
containerClass,
|
|
158
|
+
triggerElement,
|
|
150
159
|
};
|
|
151
160
|
if ((props === null || props === void 0 ? void 0 : props.showType) === 'pc') {
|
|
152
|
-
return _jsx(UserSelectPC, { ...restProps, ...
|
|
161
|
+
return _jsx(UserSelectPC, { ...props, ...restProps, ...extraProps });
|
|
153
162
|
}
|
|
154
163
|
if ((props === null || props === void 0 ? void 0 : props.showType) === 'h5') {
|
|
155
|
-
return _jsx(UserSelectH5, { ...restProps, ...
|
|
164
|
+
return _jsx(UserSelectH5, { ...props, ...restProps, ...extraProps });
|
|
156
165
|
}
|
|
157
|
-
return platform === 'h5' ? (_jsx(UserSelectH5, { ...restProps, ...
|
|
166
|
+
return platform === 'h5' ? (_jsx(UserSelectH5, { ...props, ...restProps, ...extraProps })) : (_jsx(UserSelectPC, { ...props, ...restProps, ...extraProps }));
|
|
158
167
|
}
|
|
159
168
|
/**
|
|
160
169
|
* 设置onChange值
|
|
@@ -9,7 +9,7 @@ import { InputTags } from '../input-tags';
|
|
|
9
9
|
export function UserTreeSelectH5({ id, className, style, label = '成员选择', labelVisible = true, placeholder = '请选择成员', disabled = false, layout = 'horizontal', requiredFlag = false, decorator, multiple = false, //是否多选
|
|
10
10
|
outerRef, pageNo, setPageNo, pageSize,
|
|
11
11
|
// platform,
|
|
12
|
-
request = defaultRequest, onCancel, onConfirm, selectedUserList, setSelectedUserList, confirmUserList, setConfirmUserList, open, setOpen, filterParams,
|
|
12
|
+
request = defaultRequest, onCancel, onConfirm, selectedUserList, setSelectedUserList, confirmUserList, setConfirmUserList, open, setOpen, filterParams, treeData, error, onConfirmSelectUser, secondDisplay, }) {
|
|
13
13
|
const cls = classNames({
|
|
14
14
|
'weda-ui': true,
|
|
15
15
|
'weda-select-user-dept': true,
|
|
@@ -46,7 +46,7 @@ request = defaultRequest, onCancel, onConfirm, selectedUserList, setSelectedUser
|
|
|
46
46
|
setConfirmUserList(currentConfirmUserList);
|
|
47
47
|
onConfirmSelectUser(currentConfirmUserList);
|
|
48
48
|
e.stopPropagation();
|
|
49
|
-
} }) }), _jsx(ModalSelectH5, { open: open, request: request,
|
|
49
|
+
} }) }), _jsx(ModalSelectH5, { open: open, request: request, treeData: treeData, originalOrgData: originalOrgData, setOriginalOrgData: setOriginalOrgData, multiple: multiple, errorInfo: errorInfo, selectedUserList: selectedUserList, setSelectedUserList: setSelectedUserList, confirmUserList: confirmUserList, onClose: onCancel, onConfirm: onConfirm, setErrorInfo: setErrorInfo, filterParams: filterParams, pageNo: pageNo, setPageNo: setPageNo, pageSize: pageSize, treeDataError: error, secondDisplay: secondDisplay })] }))({
|
|
50
50
|
id,
|
|
51
51
|
className: cls,
|
|
52
52
|
style,
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
2
|
import React, { useState, useEffect } from 'react';
|
|
4
3
|
import { Checkbox, Button, Text } from 'tea-component';
|
|
5
|
-
import {
|
|
4
|
+
import { fetchUserList } from '../../common/fetch-data-service';
|
|
6
5
|
import { UserOrgContext } from './user-select-pc';
|
|
7
6
|
import { UserOrgList } from './../user-org-list';
|
|
8
|
-
import {
|
|
7
|
+
import { getPropertiesList } from '../../common/utils';
|
|
9
8
|
import '../index.css';
|
|
10
9
|
export const ModelUserList = ({ selectedOrgId, curPageUserList, setCurPageUserList, filterParams, secondDisplay, }) => {
|
|
11
|
-
const { selectedUserList, multiple, setSelectedUserList, request, pageNo, setPageNo, pageSize, selectedUserIds, setSelectedIds,
|
|
10
|
+
const { selectedUserList, multiple, setSelectedUserList, request, pageNo, setPageNo, pageSize, selectedUserIds, setSelectedIds, } = React.useContext(UserOrgContext) || {};
|
|
12
11
|
const [errInfo, setErrInfo] = useState({
|
|
13
12
|
errorStatus: false,
|
|
14
13
|
errorMessage: null,
|
|
@@ -20,57 +19,27 @@ export const ModelUserList = ({ selectedOrgId, curPageUserList, setCurPageUserLi
|
|
|
20
19
|
try {
|
|
21
20
|
if (selectedOrgId) {
|
|
22
21
|
setLoading(true);
|
|
23
|
-
|
|
24
|
-
const org = getNodeFromTree(treeData, selectedOrgId);
|
|
25
|
-
if (!org) {
|
|
22
|
+
fetchUserList({ OrgId: selectedOrgId, pageNo, pageSize, ...filterParams }, request).then((res) => {
|
|
26
23
|
setLoading(false);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (parentCode === CURRENT_CORP.id) {
|
|
35
|
-
// 查询当前企业用户后端接口要求传空
|
|
36
|
-
query.corpId = '';
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
query.corpId = parentCode;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
if (org.type === 'corp') {
|
|
44
|
-
// 表示当前企业,后端接口corpId传空字符串
|
|
45
|
-
if (selectedOrgId === CURRENT_CORP.id) {
|
|
46
|
-
query.corpId = '';
|
|
24
|
+
setTotal(res === null || res === void 0 ? void 0 : res.total);
|
|
25
|
+
const userSchemaData = res.records.map((item) => {
|
|
26
|
+
const properties = getPropertiesList(item.userExtend, item.userSchema);
|
|
27
|
+
if (Array.isArray(properties) && properties.length) {
|
|
28
|
+
return Promise.all(properties).then((value) => {
|
|
29
|
+
return { ...item, userSchemaProps: value };
|
|
30
|
+
});
|
|
47
31
|
}
|
|
48
32
|
else {
|
|
49
|
-
|
|
33
|
+
return item;
|
|
50
34
|
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
pageSize,
|
|
60
|
-
...query,
|
|
61
|
-
searchCondition: {
|
|
62
|
-
...filterParams,
|
|
63
|
-
},
|
|
64
|
-
})
|
|
65
|
-
.then(({ total, dataList }) => {
|
|
66
|
-
setTotal(total);
|
|
67
|
-
setCurPageUserList([...dataList]);
|
|
68
|
-
})
|
|
69
|
-
.catch((err) => {
|
|
70
|
-
setErrInfo({ errorStatus: true, errorMessage: err });
|
|
71
|
-
})
|
|
72
|
-
.finally(() => {
|
|
73
|
-
setLoading(false);
|
|
35
|
+
});
|
|
36
|
+
Promise.all(userSchemaData)
|
|
37
|
+
.then((data) => {
|
|
38
|
+
setCurPageUserList(data);
|
|
39
|
+
})
|
|
40
|
+
.catch(() => {
|
|
41
|
+
setCurPageUserList(res.records);
|
|
42
|
+
});
|
|
74
43
|
});
|
|
75
44
|
}
|
|
76
45
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Tree } from 'tea-component';
|
|
3
3
|
import { LoadingStatus, ErrorStatus } from './error-tips';
|
|
4
4
|
import '../index.css';
|
|
@@ -6,5 +6,5 @@ export const OrgTree = (props) => {
|
|
|
6
6
|
const { selectedOrgId, treeData, treeDataError, onActive,
|
|
7
7
|
//是否展示 Checkbox
|
|
8
8
|
selectable = false, } = props;
|
|
9
|
-
return (
|
|
9
|
+
return (_jsx(_Fragment, { children: treeDataError ? (_jsx(ErrorStatus, { description: treeDataError || null })) : (_jsx(_Fragment, { children: treeData && treeData.length > 0 && !treeDataError ? (_jsx(Tree, { className: "depart-tree", data: treeData, fullActivable: true, activable: true, selectable: selectable, selectedIds: [selectedOrgId], activeIds: [selectedOrgId], selectStrictly: true, onActive: (ids) => onActive(ids) })) : (_jsx(LoadingStatus, {})) })) }));
|
|
10
10
|
};
|
|
@@ -6,7 +6,7 @@ import { UserOrgContext } from './user-select-pc';
|
|
|
6
6
|
import { OrgTree } from '../org-tree';
|
|
7
7
|
import { ModelUserList } from './model-user-list';
|
|
8
8
|
import { SelectedList } from '../selected-list';
|
|
9
|
-
import {
|
|
9
|
+
import { fetchSearchUser } from '../../common/fetch-data-service';
|
|
10
10
|
import debounce from '../../../../../utils/debounce';
|
|
11
11
|
import '../index.css';
|
|
12
12
|
export const UserModel = ({ open, onCancel, onConfirm, treeData, treeDataError, filterParams, secondDisplay, }) => {
|
|
@@ -30,22 +30,9 @@ export const UserModel = ({ open, onCancel, onConfirm, treeData, treeDataError,
|
|
|
30
30
|
try {
|
|
31
31
|
if (key && key.length > 0) {
|
|
32
32
|
setLoading(true);
|
|
33
|
-
|
|
34
|
-
request,
|
|
35
|
-
pageNumber: 1,
|
|
36
|
-
pageSize: 200,
|
|
37
|
-
searchCondition: {
|
|
38
|
-
key,
|
|
39
|
-
...filterParams,
|
|
40
|
-
},
|
|
41
|
-
})
|
|
42
|
-
.then(({ dataList }) => {
|
|
33
|
+
fetchSearchUser({ key, ...filterParams }, request).then((res) => {
|
|
43
34
|
setLoading(false);
|
|
44
|
-
setSearchUserList(
|
|
45
|
-
})
|
|
46
|
-
.catch((e) => {
|
|
47
|
-
setLoading(false);
|
|
48
|
-
setErrInfo({ errorStatus: true, errorMessage: e });
|
|
35
|
+
setSearchUserList(res);
|
|
49
36
|
});
|
|
50
37
|
}
|
|
51
38
|
else {
|
|
@@ -58,7 +45,7 @@ export const UserModel = ({ open, onCancel, onConfirm, treeData, treeDataError,
|
|
|
58
45
|
setErrInfo({ errorStatus: true, errorMessage: e });
|
|
59
46
|
}
|
|
60
47
|
}, 500);
|
|
61
|
-
return (_jsxs(Modal, { visible: open, caption: "\u9009\u62E9\u6210\u5458", onClose: () => onCancel(null), className: "weda-ui weda-ui-user-select-modal", children: [_jsxs(Modal.Body, { children: [_jsxs("div", { className: "weda-ui-user-select-container", children: [_jsx(ModalSearch, { searchList: searchUserList, errInfo: errInfo, loading: loading, keyWords: keyWords, selectedList: selectedUserList, multiple: multiple, setSelectedList: setSelectedUserList, selectedIds: selectedUserIds, filterParams: filterParams, onSearch: (key) => onSearch(key), onReset: () => setSearchUserList([]) }), keyWords.length === 0 && (_jsx(_Fragment, { children: _jsxs("div", { className: "weda-ui-user-select-container-list", children: [_jsx("div", { className: "weda-ui-user-select-container-list__start", children: _jsx(OrgTree, { selectedOrgId: [selectedOrgId], treeData: treeData, treeDataError: treeDataError, onActive: (ids) => {
|
|
48
|
+
return (_jsxs(Modal, { disableEscape: true, maskClosable: false, visible: open, caption: "\u9009\u62E9\u6210\u5458", onClose: () => onCancel(null), className: "weda-ui weda-ui-user-select-modal", children: [_jsxs(Modal.Body, { children: [_jsxs("div", { className: "weda-ui-user-select-container", children: [_jsx(ModalSearch, { searchList: searchUserList, errInfo: errInfo, loading: loading, keyWords: keyWords, selectedList: selectedUserList, multiple: multiple, setSelectedList: setSelectedUserList, selectedIds: selectedUserIds, filterParams: filterParams, onSearch: (key) => onSearch(key), onReset: () => setSearchUserList([]) }), keyWords.length === 0 && (_jsx(_Fragment, { children: _jsxs("div", { className: "weda-ui-user-select-container-list", children: [_jsx("div", { className: "weda-ui-user-select-container-list__start", children: _jsx(OrgTree, { selectedOrgId: [selectedOrgId], treeData: treeData, treeDataError: treeDataError, onActive: (ids) => {
|
|
62
49
|
setSelectedOrgId(ids[0]);
|
|
63
50
|
setPageNo(1);
|
|
64
51
|
} }) }), _jsx("div", { className: "weda-ui-user-select-container-list__end", children: _jsx(ModelUserList, { selectedOrgId: selectedOrgId, curPageUserList: curPageUserList, setCurPageUserList: setCurPageUserList, filterParams: filterParams, secondDisplay: secondDisplay }) })] }) }))] }), _jsx(SelectedList, { selectedList: selectedUserList, secondDisplay: secondDisplay, onClose: (item) => {
|