@qmlight/web-platform-components 1.0.5 → 1.0.7
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/SearchAssistanceSelect/src/SearchAssistanceComponent/api/tabList/index.js +1 -1
- package/SearchAssistanceSelect/src/SearchAssistanceComponent/component/recently/index.tsx +14 -33
- package/SearchAssistanceSelect/src/SearchAssistanceComponent/index.tsx +76 -66
- package/SearchAssistanceSelect/src/SearchAssistanceComponent/searchTabs.tsx +4 -2
- package/SearchAssistanceSelect/src/SearchAssistanceComponent/transfer/index.tsx +1 -1
- package/SearchAssistanceSelect/src/SearchAssistanceComponent/treeData/index.tsx +4 -12
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ export const getOrgsByConditions = (params) => {
|
|
|
11
11
|
return axios.post(`${SERVER.QFC_BASE}/lowcode/getOrgsByConditions`, params);
|
|
12
12
|
};
|
|
13
13
|
export const recentUserPage = (params) => {
|
|
14
|
-
return axios.post(`${SERVER.
|
|
14
|
+
return axios.post(`${SERVER.QFC_BASE}/lowcode/getOuterCustomGroup`, params);
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
export const getUsersByConditions = (params) => {
|
|
@@ -18,6 +18,7 @@ const RecentlyPageIndex = React.forwardRef((props: any, ref) => {
|
|
|
18
18
|
actionHandle,
|
|
19
19
|
} = props;
|
|
20
20
|
const [fetchParams, setFetchParams] = useState<any>({});
|
|
21
|
+
const [dataSource, setDataSource] = useState<any[]>([]);
|
|
21
22
|
const treeData = useRef<any[]>([]);
|
|
22
23
|
const searchTreeRef = useRef<any>();
|
|
23
24
|
const [itemKeys, setItemKeys] = useState<any[]>([]);
|
|
@@ -33,18 +34,7 @@ const RecentlyPageIndex = React.forwardRef((props: any, ref) => {
|
|
|
33
34
|
|
|
34
35
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
36
|
}, [selectedKeys]);
|
|
36
|
-
|
|
37
|
-
if (id) {
|
|
38
|
-
setFetchParams({ newId: id, refesh: true });
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
setFetchParams({});
|
|
42
|
-
};
|
|
43
|
-
useImperativeHandle(ref, () => {
|
|
44
|
-
return {
|
|
45
|
-
onRefresh: onRefreshChange,
|
|
46
|
-
};
|
|
47
|
-
});
|
|
37
|
+
|
|
48
38
|
const updateTreeData = (list, parentId) => {
|
|
49
39
|
return list.map((node) => {
|
|
50
40
|
const newNode = {
|
|
@@ -120,12 +110,13 @@ const RecentlyPageIndex = React.forwardRef((props: any, ref) => {
|
|
|
120
110
|
)
|
|
121
111
|
);
|
|
122
112
|
};
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
getData();
|
|
115
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
116
|
+
}, []);
|
|
117
|
+
const getData = async () => {
|
|
128
118
|
const res = await recentUserPage({ orgCode: 'root' });
|
|
119
|
+
|
|
129
120
|
if (res.code === 200) {
|
|
130
121
|
treeData.current = updateTreeData(res.data?.childVOList, 'root');
|
|
131
122
|
const treeList = getTreeList(treeData.current, []);
|
|
@@ -139,19 +130,8 @@ const RecentlyPageIndex = React.forwardRef((props: any, ref) => {
|
|
|
139
130
|
};
|
|
140
131
|
})
|
|
141
132
|
);
|
|
142
|
-
|
|
143
|
-
return {
|
|
144
|
-
...res,
|
|
145
|
-
data: treeData.current,
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
return {
|
|
149
|
-
...res,
|
|
150
|
-
data: treeData.current,
|
|
151
|
-
};
|
|
133
|
+
setDataSource(treeData.current);
|
|
152
134
|
}
|
|
153
|
-
onRefreshChange(false);
|
|
154
|
-
return res;
|
|
155
135
|
};
|
|
156
136
|
const getTreeList = (treeData, list) => {
|
|
157
137
|
treeData.forEach((item) => {
|
|
@@ -205,10 +185,11 @@ const RecentlyPageIndex = React.forwardRef((props: any, ref) => {
|
|
|
205
185
|
showCollapse={false}
|
|
206
186
|
// asyncLoad={true}
|
|
207
187
|
multiple={mode === 'multiple'}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
188
|
+
dataSource={dataSource}
|
|
189
|
+
// fetch={{
|
|
190
|
+
// api: getData,
|
|
191
|
+
// params: fetchParams,
|
|
192
|
+
// }}
|
|
212
193
|
// checkStrictly={true}
|
|
213
194
|
value={itemKeys}
|
|
214
195
|
checkStrategy={'SHOW_CHILD'}
|
|
@@ -47,12 +47,13 @@ const SearchAssistanceSelectSelect: React.FC<SeachProps> = ({
|
|
|
47
47
|
const fetchRef = useRef(0);
|
|
48
48
|
const [visible, setVisible] = useState<boolean>(false);
|
|
49
49
|
const dataValue = useRef<any>(mode ? [] : {});
|
|
50
|
-
const
|
|
50
|
+
const status = useRef(false);
|
|
51
51
|
const pages = useRef<any>(0);
|
|
52
52
|
const currentPage = useRef<number>(1);
|
|
53
53
|
const [loading, setLoading] = useState(false);
|
|
54
54
|
const [searchValue, setSearchValue] = useState('');
|
|
55
55
|
const searchData = useRef([]);
|
|
56
|
+
const SelectRef = useRef<any>();
|
|
56
57
|
useEffect(() => {
|
|
57
58
|
setValue(data);
|
|
58
59
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -137,38 +138,39 @@ const SearchAssistanceSelectSelect: React.FC<SeachProps> = ({
|
|
|
137
138
|
<div className="search-select-page">
|
|
138
139
|
<Select
|
|
139
140
|
// mode="tags"
|
|
141
|
+
ref={SelectRef}
|
|
140
142
|
mode={mode}
|
|
141
143
|
size="middle"
|
|
142
|
-
showSearch
|
|
144
|
+
// showSearch
|
|
143
145
|
showArrow
|
|
144
146
|
getPopupContainer={(trigger) => trigger}
|
|
145
|
-
searchValue={searchValue}
|
|
147
|
+
// searchValue={searchValue}
|
|
146
148
|
disabled={option?.readOnly || option?.disabled || $$form?.props?.formType === 'onlyShow'}
|
|
147
|
-
onPopupScroll={(event: any) => {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}}
|
|
164
|
-
dropdownRender={(menu) => {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}}
|
|
149
|
+
// onPopupScroll={(event: any) => {
|
|
150
|
+
// if (type !== 'org') {
|
|
151
|
+
// return;
|
|
152
|
+
// }
|
|
153
|
+
// const nodeClient = event.target?.firstChild?.clientHeight || 0;
|
|
154
|
+
// const scrollHeight = event.target.scrollTop;
|
|
155
|
+
// if (
|
|
156
|
+
// nodeClient - scrollHeight - 256 < 10 &&
|
|
157
|
+
// currentPage.current * 20 <= pages.current &&
|
|
158
|
+
// !loading
|
|
159
|
+
// ) {
|
|
160
|
+
// setLoading(true);
|
|
161
|
+
// currentPage.current++;
|
|
162
|
+
// debounceFetcher({ name: searchValue });
|
|
163
|
+
// }
|
|
164
|
+
// // console.log(event.target.scrollTop);
|
|
165
|
+
// }}
|
|
166
|
+
// dropdownRender={(menu) => {
|
|
167
|
+
// return (
|
|
168
|
+
// <>
|
|
169
|
+
// {menu}
|
|
170
|
+
// {loading ? <Spin tip="加载中..." /> : <></>}
|
|
171
|
+
// </>
|
|
172
|
+
// );
|
|
173
|
+
// }}
|
|
172
174
|
suffixIcon={
|
|
173
175
|
<>
|
|
174
176
|
{/* {!isEmpty(value) && (
|
|
@@ -211,49 +213,55 @@ const SearchAssistanceSelectSelect: React.FC<SeachProps> = ({
|
|
|
211
213
|
// options={options}
|
|
212
214
|
value={isEmpty(value) ? (mode ? [] : undefined) : value}
|
|
213
215
|
loading={fetching}
|
|
214
|
-
onSelect={(value: any) => {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}}
|
|
229
|
-
onDeselect={(value: any) => {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
216
|
+
// onSelect={(value: any) => {
|
|
217
|
+
// const field = options.find((item) => item.value === value?.value);
|
|
218
|
+
// if (!mode) {
|
|
219
|
+
// dataValue.current = field;
|
|
220
|
+
// onDataChange && onDataChange(dataValue.current);
|
|
221
|
+
// setValue(dataValue.current);
|
|
222
|
+
// return;
|
|
223
|
+
// }
|
|
224
|
+
// const oldField = dataValue.current.find((item) => item.value === value.value);
|
|
225
|
+
// if (!oldField && field) {
|
|
226
|
+
// dataValue.current = dataValue.current.concat([field]);
|
|
227
|
+
// onDataChange && onDataChange(dataValue.current);
|
|
228
|
+
// setValue(dataValue.current);
|
|
229
|
+
// }
|
|
230
|
+
// }}
|
|
231
|
+
// onDeselect={(value: any) => {
|
|
232
|
+
// if (!mode) {
|
|
233
|
+
// dataValue.current = {};
|
|
234
|
+
// setValue(dataValue.current);
|
|
235
|
+
// return;
|
|
236
|
+
// }
|
|
237
|
+
// dataValue.current = dataValue.current.filter((item) => item.value !== value.value);
|
|
238
|
+
// onDataChange && onDataChange(dataValue.current);
|
|
239
|
+
// setValue(dataValue.current);
|
|
240
|
+
// }}
|
|
241
|
+
onFocus={(e) => {
|
|
242
|
+
e.stopPropagation();
|
|
243
|
+
SelectRef.current.blur();
|
|
244
|
+
|
|
245
|
+
if (option?.readOnly || option?.disabled || $$form?.props?.formType === 'onlyShow') {
|
|
233
246
|
return;
|
|
234
247
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
setValue(dataValue.current);
|
|
238
|
-
}}
|
|
239
|
-
onFocus={() => {
|
|
240
|
-
setStatus(true);
|
|
248
|
+
setVisible(true);
|
|
249
|
+
status.current = true;
|
|
241
250
|
}}
|
|
242
251
|
onBlur={() => {
|
|
243
|
-
|
|
252
|
+
SelectRef.current.blur();
|
|
244
253
|
}}
|
|
245
254
|
notFoundContent={fetching ? <Spin size="small" /> : null}
|
|
246
|
-
onSearch={(value) => {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}}
|
|
255
|
+
// onSearch={(value) => {
|
|
256
|
+
// // if (type === 'doc' || type === 'customNode') {
|
|
257
|
+
// // return;
|
|
258
|
+
// // }
|
|
259
|
+
// // if (type === 'org') {
|
|
260
|
+
// // currentPage.current = 1;
|
|
261
|
+
// // }
|
|
262
|
+
// // setSearchValue(value);
|
|
263
|
+
// // debounceFetcher({ name: value });
|
|
264
|
+
// }}
|
|
257
265
|
>
|
|
258
266
|
{options.map((item) => {
|
|
259
267
|
return (
|
|
@@ -286,7 +294,9 @@ const SearchAssistanceSelectSelect: React.FC<SeachProps> = ({
|
|
|
286
294
|
items={items}
|
|
287
295
|
type={type}
|
|
288
296
|
onChange={onModalDataChange}
|
|
289
|
-
onClose={() =>
|
|
297
|
+
onClose={() => {
|
|
298
|
+
setVisible(false);
|
|
299
|
+
}}
|
|
290
300
|
visible={visible}
|
|
291
301
|
title={title || '人力资源'}
|
|
292
302
|
customData={customData}
|
|
@@ -50,8 +50,10 @@ const SearchTabs = (props) => {
|
|
|
50
50
|
|
|
51
51
|
useEffect(() => {
|
|
52
52
|
if (items?.length) {
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
const { key, type } = items[0] || {};
|
|
54
|
+
setActiveKey(key);
|
|
55
|
+
prevActiveKey.current = key;
|
|
56
|
+
setType(type);
|
|
55
57
|
setItemsList(items);
|
|
56
58
|
}
|
|
57
59
|
}, [items]);
|
|
@@ -65,7 +65,7 @@ const TransferIndex = ({
|
|
|
65
65
|
console.log(list);
|
|
66
66
|
console.log(transferDataSource);
|
|
67
67
|
const dataList: any[] = [];
|
|
68
|
-
if (lists.length) {
|
|
68
|
+
if (lists.length && type !== 'org') {
|
|
69
69
|
const newList = list.filter((item) => !lists.includes(item));
|
|
70
70
|
const perList = transferDataSource.filter((item) => newList.includes(item.id));
|
|
71
71
|
const newData = unionBy(data.concat(perList), 'id');
|
|
@@ -69,25 +69,17 @@ const TreeData = (props) => {
|
|
|
69
69
|
};
|
|
70
70
|
const getCheckAble = (item) => {
|
|
71
71
|
if (type === 'default' || type === 'org') {
|
|
72
|
-
return !
|
|
72
|
+
return !targetKeys.includes(item.id);
|
|
73
73
|
}
|
|
74
74
|
if (type === 'customOrg') {
|
|
75
|
-
return (
|
|
76
|
-
!item.orgtype &&
|
|
77
|
-
item.orgtype !== 0 &&
|
|
78
|
-
!(targetKeys.includes(item.id) || targetKeys.includes(item.parentId))
|
|
79
|
-
);
|
|
75
|
+
return !item.orgtype && item.orgtype !== 0 && !targetKeys.includes(item.id);
|
|
80
76
|
}
|
|
81
77
|
if (type === 'doc') {
|
|
82
|
-
return !
|
|
78
|
+
return !targetKeys.includes(item.id);
|
|
83
79
|
}
|
|
84
80
|
return (
|
|
85
81
|
item.orgtype === 2 &&
|
|
86
|
-
!(
|
|
87
|
-
targetKeys.includes(item.id) ||
|
|
88
|
-
targetKeys.includes(item.parentId) ||
|
|
89
|
-
targetKeys.includes(`${item.parentId}_${item.id}`)
|
|
90
|
-
)
|
|
82
|
+
!(targetKeys.includes(item.id) || targetKeys.includes(`${item.parentId}_${item.id}`))
|
|
91
83
|
);
|
|
92
84
|
};
|
|
93
85
|
|