@bit-sun/business-component 2.0.14 → 2.0.17-alpha.0
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/.fatherrc.ts +1 -0
- package/dist/components/Business/CommonGuideWrapper/index.d.ts +6 -0
- package/dist/components/Business/SearchSelect/index.d.ts +1 -1
- package/dist/components/Business/StateFlow/index.d.ts +3 -0
- package/dist/components/Functional/SearchSelect/index.d.ts +2 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +245 -25
- package/dist/index.js +245 -23
- package/dist/index.umd.js +113561 -0
- package/dist/index.umd.min.js +27 -0
- package/package.json +1 -1
- package/src/assets/arrow_top.png +0 -0
- package/src/assets/drag.svg +17 -0
- package/src/assets/label_icon_bottom.svg +26 -0
- package/src/components/Business/CommodityEntry/index.md +2 -1
- package/src/components/Business/CommodityEntry/index.tsx +3 -1
- package/src/components/Business/CommonGuideWrapper/index.less +112 -0
- package/src/components/Business/CommonGuideWrapper/index.md +39 -0
- package/src/components/Business/CommonGuideWrapper/index.tsx +84 -0
- package/src/components/Business/SearchSelect/index.tsx +16 -11
- package/src/components/Business/StateFlow/index.less +131 -0
- package/src/components/Business/StateFlow/index.md +60 -0
- package/src/components/Business/StateFlow/index.tsx +30 -0
- package/src/components/Functional/DataValidation/index.tsx +2 -1
- package/src/components/Functional/SearchSelect/index.tsx +134 -69
- package/src/index.ts +2 -0
- package/typings.d.ts +2 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import React, { useState, useEffect, forwardRef, useImperativeHandle } from 'react';
|
|
3
3
|
import { useDebounceFn } from 'ahooks';
|
|
4
4
|
import { Input, Button, Modal, Select, Divider, message, Spin, Form, Table, Checkbox, TreeSelect, Tooltip, Tag } from 'antd';
|
|
5
5
|
import { SearchOutlined, CopyOutlined, CaretLeftOutlined } from '@ant-design/icons';
|
|
@@ -11,20 +11,33 @@ import { BusinessSearchSelect, QueryMutipleInput } from '@/index';
|
|
|
11
11
|
|
|
12
12
|
const { Option } = Select;
|
|
13
13
|
|
|
14
|
-
const SearchSelect = (props: any) => {
|
|
14
|
+
const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
15
15
|
const {
|
|
16
16
|
value, // 必传
|
|
17
17
|
onChange,
|
|
18
|
-
selectProps={},
|
|
19
|
-
modalTableProps={},
|
|
20
|
-
labelInValue=false,
|
|
18
|
+
selectProps = {},
|
|
19
|
+
modalTableProps = {},
|
|
20
|
+
labelInValue = false,
|
|
21
21
|
requestConfig,
|
|
22
22
|
ctx,
|
|
23
23
|
sourceName,
|
|
24
|
-
needModalTable=true,
|
|
25
|
-
getPopupContainer=undefined
|
|
24
|
+
needModalTable = true,
|
|
25
|
+
getPopupContainer = undefined,
|
|
26
|
+
fieldComponent,
|
|
26
27
|
} = props;
|
|
27
|
-
const {
|
|
28
|
+
const {
|
|
29
|
+
url,
|
|
30
|
+
otherParams,// 默认参数
|
|
31
|
+
isMap,
|
|
32
|
+
fixedparameter,
|
|
33
|
+
fieldValToParam,
|
|
34
|
+
mappingTextField = 'name',
|
|
35
|
+
mappingTextShowKeyField,
|
|
36
|
+
mappingValueField = 'code',
|
|
37
|
+
mappingTextShowTextField,
|
|
38
|
+
init = true,// 是否初始请求
|
|
39
|
+
extralHeaders = {},// 额外请求头参数
|
|
40
|
+
} = requestConfig || {};
|
|
28
41
|
const resultSourceKey = sourceName || requestConfig?.sourceName || 'supplierCode'
|
|
29
42
|
|
|
30
43
|
const selectMode = selectProps?.mode // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
|
|
@@ -57,10 +70,10 @@ const SearchSelect = (props: any) => {
|
|
|
57
70
|
(v?: any) => {
|
|
58
71
|
// 优化搜索参数 支持传多个
|
|
59
72
|
let searchParams = {};
|
|
60
|
-
if(typeof selectParamsKey === 'string') {
|
|
73
|
+
if (typeof selectParamsKey === 'string') {
|
|
61
74
|
searchParams = v ? { [selectParamsInitKey]: initVal } : { [selectParamsKey]: searchValue }
|
|
62
75
|
}
|
|
63
|
-
if(Array.isArray(selectParamsKey)) {
|
|
76
|
+
if (Array.isArray(selectParamsKey)) {
|
|
64
77
|
selectParamsKey.forEach((i: any) => {
|
|
65
78
|
searchParams = { ...searchParams, [i]: searchValue }
|
|
66
79
|
})
|
|
@@ -84,8 +97,27 @@ const SearchSelect = (props: any) => {
|
|
|
84
97
|
const [tableFormParams, setTableFormParams] = useState({});
|
|
85
98
|
const [tooltipVisible, setTooltipVisible] = useState(false);
|
|
86
99
|
|
|
100
|
+
useImperativeHandle(ref, () => ({
|
|
101
|
+
refreshDataSource: (reset: boolean = false) => {
|
|
102
|
+
if (reset) {
|
|
103
|
+
if (init) {
|
|
104
|
+
run('init');
|
|
105
|
+
} else {
|
|
106
|
+
setItems([]);
|
|
107
|
+
setItemsTotal(0);
|
|
108
|
+
}
|
|
109
|
+
} else {
|
|
110
|
+
run();
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
clearDataSource: () => {
|
|
114
|
+
setItems([]);
|
|
115
|
+
setItemsTotal(0);
|
|
116
|
+
},
|
|
117
|
+
}))
|
|
118
|
+
|
|
87
119
|
// 获取数据源 (type: 1下拉框 2弹框 不传值默认为下拉框)
|
|
88
|
-
const getData = (params={}, type=1) => {
|
|
120
|
+
const getData = (params = {}, type = 1) => {
|
|
89
121
|
if (!requestConfig) return;
|
|
90
122
|
|
|
91
123
|
setFetching(true)
|
|
@@ -145,13 +177,13 @@ const SearchSelect = (props: any) => {
|
|
|
145
177
|
delete params[key];
|
|
146
178
|
} else if (typeof element === 'boolean' && key.indexOf('*checkBox*') >= 0) {
|
|
147
179
|
const dataParams = key.split('*checkBox*');
|
|
148
|
-
if(element){
|
|
180
|
+
if (element) {
|
|
149
181
|
params[dataParams[0]] = 0
|
|
150
182
|
}
|
|
151
183
|
delete params[key];
|
|
152
|
-
}else if (element && key.indexOf('*cascader*') >= 0) {
|
|
184
|
+
} else if (element && key.indexOf('*cascader*') >= 0) {
|
|
153
185
|
const dataParams = key.split('*cascader*');
|
|
154
|
-
params[dataParams[0]] = element[element.length -1]
|
|
186
|
+
params[dataParams[0]] = element[element.length - 1]
|
|
155
187
|
delete params[key];
|
|
156
188
|
} else if (element && key.indexOf('*date*') >= 0) {
|
|
157
189
|
const dataParams = key.split('*date*')
|
|
@@ -185,9 +217,9 @@ const SearchSelect = (props: any) => {
|
|
|
185
217
|
params[`qp-${dataParams}-${params[key][0]}`] = params[key][1]
|
|
186
218
|
}
|
|
187
219
|
delete params[key]
|
|
188
|
-
}else if (Array.isArray(element)) {
|
|
220
|
+
} else if (Array.isArray(element)) {
|
|
189
221
|
params[key] = element.join(',');
|
|
190
|
-
} else if(element == null || element === undefined || String(element).trim() === '') {
|
|
222
|
+
} else if (element == null || element === undefined || String(element).trim() === '') {
|
|
191
223
|
delete params[key]
|
|
192
224
|
}
|
|
193
225
|
}
|
|
@@ -202,7 +234,11 @@ const SearchSelect = (props: any) => {
|
|
|
202
234
|
}
|
|
203
235
|
|
|
204
236
|
axios
|
|
205
|
-
.get(
|
|
237
|
+
.get(
|
|
238
|
+
`${url}?${stringify(queryParams)}`,
|
|
239
|
+
{
|
|
240
|
+
headers: { ...extralHeaders }
|
|
241
|
+
})
|
|
206
242
|
.then((result: any) => {
|
|
207
243
|
setFetching(false)
|
|
208
244
|
result = result.data;
|
|
@@ -225,9 +261,9 @@ const SearchSelect = (props: any) => {
|
|
|
225
261
|
? res[keys]
|
|
226
262
|
? res[keys].map((item: any) => {
|
|
227
263
|
let textShowText = item[mappingTextField]
|
|
228
|
-
if(mappingTextShowTextField) {
|
|
264
|
+
if (mappingTextShowTextField) {
|
|
229
265
|
textShowText = []
|
|
230
|
-
if(Array.isArray(mappingTextShowTextField)) {
|
|
266
|
+
if (Array.isArray(mappingTextShowTextField)) {
|
|
231
267
|
mappingTextShowTextField.forEach((r: any) => {
|
|
232
268
|
textShowText.push(item[r])
|
|
233
269
|
})
|
|
@@ -246,9 +282,9 @@ const SearchSelect = (props: any) => {
|
|
|
246
282
|
: Array.isArray(res) &&
|
|
247
283
|
res?.map((item: Record<string, any>) => {
|
|
248
284
|
let textShowText = item[mappingTextField]
|
|
249
|
-
if(mappingTextShowTextField) {
|
|
285
|
+
if (mappingTextShowTextField) {
|
|
250
286
|
textShowText = []
|
|
251
|
-
if(Array.isArray(mappingTextShowTextField)) {
|
|
287
|
+
if (Array.isArray(mappingTextShowTextField)) {
|
|
252
288
|
mappingTextShowTextField.forEach((r: any) => {
|
|
253
289
|
textShowText.push(item[r])
|
|
254
290
|
})
|
|
@@ -267,13 +303,13 @@ const SearchSelect = (props: any) => {
|
|
|
267
303
|
: [];
|
|
268
304
|
}
|
|
269
305
|
source = Array.isArray(source) ? source : []
|
|
270
|
-
if(type === 1) {
|
|
306
|
+
if (type === 1) {
|
|
271
307
|
ctx?.form?.setFieldSource(resultSourceKey, source)
|
|
272
308
|
setItems(source)
|
|
273
309
|
setItemsTotal(Number(res?.total || res?.totalCount || source.length))
|
|
274
310
|
} else {
|
|
275
311
|
setTableData(source)
|
|
276
|
-
setTablePagination({...tablePagination, total: Number(res?.total || res?.totalCount || source.length), pageSize: Number(res?.size || res?.pageSize || (params?.pageSize || pageSize)), current: Number(res?.page || res?.currentPage || (params?.currentPage || currentPage))})
|
|
312
|
+
setTablePagination({ ...tablePagination, total: Number(res?.total || res?.totalCount || source.length), pageSize: Number(res?.size || res?.pageSize || (params?.pageSize || pageSize)), current: Number(res?.page || res?.currentPage || (params?.currentPage || currentPage)) })
|
|
277
313
|
}
|
|
278
314
|
})
|
|
279
315
|
.catch((err) => { setFetching(false) });
|
|
@@ -290,26 +326,28 @@ const SearchSelect = (props: any) => {
|
|
|
290
326
|
if (isTouchGround && canPageAdd) {
|
|
291
327
|
const nextScrollPage = scrollPage + 1;
|
|
292
328
|
setScrollPage(nextScrollPage);
|
|
293
|
-
getData({currentPage: nextScrollPage}); // 调用api方法
|
|
329
|
+
getData({ currentPage: nextScrollPage }); // 调用api方法
|
|
294
330
|
}
|
|
295
331
|
|
|
296
332
|
//判断是否滑动到顶部
|
|
297
|
-
const isTouchTop = target.scrollTop ===0 // <=0
|
|
333
|
+
const isTouchTop = target.scrollTop === 0 // <=0
|
|
298
334
|
// 判断数据是否到第一页
|
|
299
335
|
const canPageJian = scrollPage > 1
|
|
300
336
|
if (isTouchTop && canPageJian) {
|
|
301
337
|
const preScrollPage = scrollPage - 1;
|
|
302
338
|
setScrollPage(preScrollPage);
|
|
303
|
-
getData({currentPage: preScrollPage}); // 调用api方法
|
|
339
|
+
getData({ currentPage: preScrollPage }); // 调用api方法
|
|
304
340
|
}
|
|
305
341
|
}
|
|
306
342
|
|
|
307
343
|
useEffect(() => {
|
|
308
|
-
|
|
344
|
+
if (init) {
|
|
345
|
+
run('init')
|
|
346
|
+
}
|
|
309
347
|
}, [])
|
|
310
348
|
|
|
311
349
|
useEffect(() => {
|
|
312
|
-
if(value) {
|
|
350
|
+
if (value) {
|
|
313
351
|
setPopValue(value);
|
|
314
352
|
}
|
|
315
353
|
}, [value]);
|
|
@@ -322,14 +360,14 @@ const SearchSelect = (props: any) => {
|
|
|
322
360
|
getData({ pageSize: tableInitPageSize, currentPage: 1 }, 2)
|
|
323
361
|
setIsModalVisible(true);
|
|
324
362
|
// 回显
|
|
325
|
-
if(value) {
|
|
326
|
-
if(selectMode) {
|
|
363
|
+
if (value) {
|
|
364
|
+
if (selectMode) {
|
|
327
365
|
setSelectedRowKeys(labelInValue ? value.map(i => i.key) : value)
|
|
328
366
|
setPopValue(labelInValue ? value.map(i => ({ value: i.key, text: i.label })) : value.map(i => ({ value: i })));
|
|
329
367
|
setIndeterminate(!!value.length && value.length < itemsTotal);
|
|
330
368
|
setCheckedAll(itemsTotal && value.length === itemsTotal);
|
|
331
369
|
// 需清空数据
|
|
332
|
-
if(!value.length) {
|
|
370
|
+
if (!value.length) {
|
|
333
371
|
setDoubleArr([])
|
|
334
372
|
}
|
|
335
373
|
} else {
|
|
@@ -340,7 +378,7 @@ const SearchSelect = (props: any) => {
|
|
|
340
378
|
};
|
|
341
379
|
|
|
342
380
|
const handleSelectOver = (selectedValue: any) => {
|
|
343
|
-
if(selectedValue?.length) {
|
|
381
|
+
if (selectedValue?.length) {
|
|
344
382
|
formaData(selectedValue);
|
|
345
383
|
// 解决选择最后1页的sku,返回后,不显示名称问题
|
|
346
384
|
const source = _.uniqBy(items.concat(selectedValue), 'value')
|
|
@@ -355,7 +393,7 @@ const SearchSelect = (props: any) => {
|
|
|
355
393
|
};
|
|
356
394
|
|
|
357
395
|
const formaData = (value) => {
|
|
358
|
-
if(labelInValue) {
|
|
396
|
+
if (labelInValue) {
|
|
359
397
|
const formatResult = value.map((i: any) => ({ key: i[mappingValueField], label: i[mappingTextField], value: i[mappingValueField] }))
|
|
360
398
|
onChange(selectMode ? formatResult : formatResult[0])
|
|
361
399
|
} else {
|
|
@@ -368,26 +406,45 @@ const SearchSelect = (props: any) => {
|
|
|
368
406
|
form.resetFields();
|
|
369
407
|
setTableFormParams({});
|
|
370
408
|
setIsModalVisible(false);
|
|
371
|
-
if(selectMode) {
|
|
409
|
+
if (selectMode) {
|
|
372
410
|
run();
|
|
373
411
|
}
|
|
374
412
|
};
|
|
375
413
|
|
|
414
|
+
const refreshItems = () => {
|
|
415
|
+
// 查看是否存在关联值 如果有关联值 就查询 没有就不能查询
|
|
416
|
+
if (fieldValToParam && ctx) {
|
|
417
|
+
let formValueList = [];
|
|
418
|
+
fieldValToParam.forEach((item: any, index: any) => {
|
|
419
|
+
const fixedParamVal = ctx.form.getFieldValue(fieldValToParam[index]);
|
|
420
|
+
formValueList.push(fixedParamVal);
|
|
421
|
+
});
|
|
422
|
+
if (formValueList.filter((item: any) => item).length > 0) {
|
|
423
|
+
run();
|
|
424
|
+
} else {
|
|
425
|
+
setItems([]);
|
|
426
|
+
setItemsTotal(0);
|
|
427
|
+
}
|
|
428
|
+
} else {
|
|
429
|
+
run();
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
376
433
|
const onSearchChange = (e) => {
|
|
377
434
|
setSearchValue(e.target.value);
|
|
378
|
-
|
|
435
|
+
refreshItems();
|
|
379
436
|
}
|
|
380
437
|
|
|
381
438
|
const onSearchBlur = () => {
|
|
382
|
-
setSearchValue('')
|
|
383
|
-
|
|
439
|
+
setSearchValue('');
|
|
440
|
+
refreshItems();
|
|
384
441
|
}
|
|
385
442
|
|
|
386
443
|
const onSearchTable = () => {
|
|
387
444
|
const params = form.getFieldsValue();
|
|
388
445
|
setTableFormParams(params);
|
|
389
446
|
getData({ ...params, pageSize: tableInitPageSize }, 2)
|
|
390
|
-
if(selectMode){
|
|
447
|
+
if (selectMode) {
|
|
391
448
|
getData(params)
|
|
392
449
|
}
|
|
393
450
|
}
|
|
@@ -403,18 +460,18 @@ const SearchSelect = (props: any) => {
|
|
|
403
460
|
}
|
|
404
461
|
|
|
405
462
|
const onChangeCheckAll = (e) => {
|
|
406
|
-
if(e.target.checked) {
|
|
463
|
+
if (e.target.checked) {
|
|
407
464
|
// 如果下拉框有所有数据就处理选中所有【items.length === itemsTotal】(最多可选100条)
|
|
408
465
|
// 如果超过100条 就默认查出所有数据
|
|
409
466
|
const currentItemsData = JSON.parse(JSON.stringify(items))
|
|
410
467
|
const totalPage = Math.ceil(itemsTotal / tablePagination?.pageSize)
|
|
411
|
-
for(let i=0; i <= totalPage-1; i++){
|
|
412
|
-
doubleArr[i] = currentItemsData.slice(tablePagination?.pageSize*i,tablePagination?.pageSize*(i+1))
|
|
468
|
+
for (let i = 0; i <= totalPage - 1; i++) {
|
|
469
|
+
doubleArr[i] = currentItemsData.slice(tablePagination?.pageSize * i, tablePagination?.pageSize * (i + 1))
|
|
413
470
|
}
|
|
414
471
|
setDoubleArr(doubleArr)
|
|
415
472
|
setSelectedRowKeys(currentItemsData.map(i => i.value))
|
|
416
473
|
setPopValue(currentItemsData);
|
|
417
|
-
if(items.length < itemsTotal) {
|
|
474
|
+
if (items.length < itemsTotal) {
|
|
418
475
|
// TODO 请求接口获取所有数据
|
|
419
476
|
}
|
|
420
477
|
} else {
|
|
@@ -466,13 +523,13 @@ const SearchSelect = (props: any) => {
|
|
|
466
523
|
return res.filter(Boolean); //去掉undefined的情况
|
|
467
524
|
};
|
|
468
525
|
|
|
469
|
-
const onChangeSelectedKeys=(selectKeys,selectRows) => {
|
|
526
|
+
const onChangeSelectedKeys = (selectKeys, selectRows) => {
|
|
470
527
|
const nowPage = tablePagination?.current;
|
|
471
528
|
|
|
472
529
|
let filterRows = []; // 存放拼接后的一维数组的变量
|
|
473
530
|
let sksResult = [];
|
|
474
531
|
|
|
475
|
-
if(selectMode) {
|
|
532
|
+
if (selectMode) {
|
|
476
533
|
// 处理多选分页累计选中
|
|
477
534
|
// 勾选生成二维数组
|
|
478
535
|
doubleArr[nowPage ? nowPage - 1 : 0] = selectRows
|
|
@@ -500,7 +557,7 @@ const SearchSelect = (props: any) => {
|
|
|
500
557
|
|
|
501
558
|
// 生成唯一值
|
|
502
559
|
const makeUniqueValue = () => {
|
|
503
|
-
const generateUnitKey = (((1+Math.random())*0x10000)|0).toString(16);
|
|
560
|
+
const generateUnitKey = (((1 + Math.random()) * 0x10000) | 0).toString(16);
|
|
504
561
|
setUniqueValue(generateUnitKey);
|
|
505
562
|
return generateUnitKey;
|
|
506
563
|
}
|
|
@@ -511,15 +568,17 @@ const SearchSelect = (props: any) => {
|
|
|
511
568
|
onChange: (sks, srs) => {
|
|
512
569
|
onChangeSelectedKeys(sks, srs)
|
|
513
570
|
},
|
|
514
|
-
getCheckboxProps: () =>
|
|
515
|
-
|
|
516
|
-
|
|
571
|
+
getCheckboxProps: () => {
|
|
572
|
+
return ({
|
|
573
|
+
disabled: selectProps?.disabled || props?.disabled || !items.length,
|
|
574
|
+
})
|
|
575
|
+
},
|
|
517
576
|
};
|
|
518
577
|
|
|
519
578
|
const onDoubleClickSelect = (e, record) => {
|
|
520
|
-
if(!selectMode) {
|
|
579
|
+
if (!selectMode && !(selectProps?.disabled || props?.disabled || !items.length)) {
|
|
521
580
|
const srs = [JSON.parse(JSON.stringify(record))]
|
|
522
|
-
const sks = srs.map((i:any) => i.value)
|
|
581
|
+
const sks = srs.map((i: any) => i.value)
|
|
523
582
|
onChangeSelectedKeys(sks, srs)
|
|
524
583
|
}
|
|
525
584
|
}
|
|
@@ -527,9 +586,9 @@ const SearchSelect = (props: any) => {
|
|
|
527
586
|
const themeColor = { color: '#1890ff' }
|
|
528
587
|
|
|
529
588
|
const formItem = (list) => {
|
|
530
|
-
if(isModalVisible && list?.length) {
|
|
589
|
+
if (isModalVisible && list?.length) {
|
|
531
590
|
return list.map((i: any) => {
|
|
532
|
-
if(i?.type === 'select' || i?.field?.type === 'select') {
|
|
591
|
+
if (i?.type === 'select' || i?.field?.type === 'select') {
|
|
533
592
|
return (
|
|
534
593
|
<Form.Item name={i.name} label={i.label} key={i.name}>
|
|
535
594
|
<Select style={{ width: '100%' }} placeholder='请选择' {...i?.field?.props}>
|
|
@@ -541,7 +600,7 @@ const SearchSelect = (props: any) => {
|
|
|
541
600
|
)
|
|
542
601
|
}
|
|
543
602
|
|
|
544
|
-
if(i?.type === 'treeSelect' || i?.field?.type === 'treeSelect') {
|
|
603
|
+
if (i?.type === 'treeSelect' || i?.field?.type === 'treeSelect') {
|
|
545
604
|
return (
|
|
546
605
|
<Form.Item name={i.name} label={i.label} key={i.name}>
|
|
547
606
|
<TreeSelect style={{ width: '100%' }} placeholder='请选择' {...i?.field?.props}></TreeSelect>
|
|
@@ -549,7 +608,7 @@ const SearchSelect = (props: any) => {
|
|
|
549
608
|
)
|
|
550
609
|
}
|
|
551
610
|
|
|
552
|
-
if(i?.type === 'businessSearchSelect' || i?.field?.type === 'businessSearchSelect') {
|
|
611
|
+
if (i?.type === 'businessSearchSelect' || i?.field?.type === 'businessSearchSelect') {
|
|
553
612
|
return (
|
|
554
613
|
<div>
|
|
555
614
|
<Form.Item name={i.name} label={i.label} key={i.name}>
|
|
@@ -586,16 +645,16 @@ const SearchSelect = (props: any) => {
|
|
|
586
645
|
}
|
|
587
646
|
|
|
588
647
|
const maxTagPlaceholder = (selectedValues) => {
|
|
589
|
-
const onClose = (e: any,item: any) => {
|
|
648
|
+
const onClose = (e: any, item: any) => {
|
|
590
649
|
e.preventDefault();
|
|
591
|
-
const newValue = labelInValue ? JSON.parse(JSON.stringify(value)).filter((i: any) => i.value !== item.value): JSON.parse(JSON.stringify(value)).filter((i: any) => i !== item.value)
|
|
650
|
+
const newValue = labelInValue ? JSON.parse(JSON.stringify(value)).filter((i: any) => i.value !== item.value) : JSON.parse(JSON.stringify(value)).filter((i: any) => i !== item.value)
|
|
592
651
|
onChange(newValue);
|
|
593
652
|
}
|
|
594
653
|
return (
|
|
595
654
|
<Tooltip title={selectedValues.map((i: any) => (
|
|
596
655
|
<Tag
|
|
597
656
|
closable={true}
|
|
598
|
-
onClose={(e) => onClose(e,i)}
|
|
657
|
+
onClose={(e) => onClose(e, i)}
|
|
599
658
|
style={{ marginRight: 3, background: '#f5f5f5', height: '24px', border: '1px solid #f0f0f0' }}
|
|
600
659
|
>
|
|
601
660
|
{i.label}
|
|
@@ -608,19 +667,25 @@ const SearchSelect = (props: any) => {
|
|
|
608
667
|
|
|
609
668
|
return (
|
|
610
669
|
<div className={'search_select'}>
|
|
611
|
-
|
|
670
|
+
{fieldComponent ?
|
|
671
|
+
(<div onClick={() => {
|
|
672
|
+
fieldComponent.props?.onClick?.()
|
|
673
|
+
showModal()
|
|
674
|
+
}}>{fieldComponent}</div>) :
|
|
675
|
+
(<div className="search_select_show" id={`search_select_div_${uniqueValue}`}>
|
|
612
676
|
<Select
|
|
613
677
|
virtual
|
|
614
678
|
labelInValue={labelInValue}
|
|
615
679
|
value={value}
|
|
616
680
|
onChange={onChange}
|
|
681
|
+
disabled={props.disabled}
|
|
617
682
|
dropdownRender={menu => (
|
|
618
683
|
<>
|
|
619
684
|
<Input
|
|
620
685
|
value={searchValue}
|
|
621
686
|
style={{ width: '98%', marginLeft: '1%' }}
|
|
622
687
|
placeholder="请输入"
|
|
623
|
-
onChange={e=> onSearchChange(e)}
|
|
688
|
+
onChange={e => onSearchChange(e)}
|
|
624
689
|
onBlur={onSearchBlur}
|
|
625
690
|
onKeyDown={(e) => {
|
|
626
691
|
// 阻止多选的冒泡
|
|
@@ -633,7 +698,7 @@ const SearchSelect = (props: any) => {
|
|
|
633
698
|
)}
|
|
634
699
|
notFoundContent={
|
|
635
700
|
fetching ? <Spin size="small" /> :
|
|
636
|
-
<div style={{ textAlign: 'center'}}>
|
|
701
|
+
<div style={{ textAlign: 'center' }}>
|
|
637
702
|
<div style={{ marginBottom: 16 }}>
|
|
638
703
|
<CopyOutlined style={{ fontSize: '50px' }} />
|
|
639
704
|
</div>
|
|
@@ -641,7 +706,7 @@ const SearchSelect = (props: any) => {
|
|
|
641
706
|
</div>
|
|
642
707
|
}
|
|
643
708
|
onPopupScroll={SelectScroll}
|
|
644
|
-
style={{ width: needModalTable?'calc(100% - 30px)':'calc(100%)' }}
|
|
709
|
+
style={{ width: needModalTable ? 'calc(100% - 30px)' : 'calc(100%)' }}
|
|
645
710
|
placeholder="请选择"
|
|
646
711
|
maxTagPlaceholder={maxTagPlaceholder}
|
|
647
712
|
{...currentSelectProps}
|
|
@@ -654,11 +719,11 @@ const SearchSelect = (props: any) => {
|
|
|
654
719
|
))}
|
|
655
720
|
</Select>
|
|
656
721
|
{needModalTable && (
|
|
657
|
-
<Button style={{width: '30px', padding: '2px', height: 'auto'}} onClick={showModal} type="primary">
|
|
722
|
+
<Button style={{ width: '30px', padding: '2px', height: 'auto' }} onClick={showModal} type="primary">
|
|
658
723
|
<SearchOutlined />
|
|
659
724
|
</Button>
|
|
660
725
|
)}
|
|
661
|
-
</div>
|
|
726
|
+
</div>)}
|
|
662
727
|
{needModalTable && isModalVisible && (
|
|
663
728
|
<Modal
|
|
664
729
|
width='80%'
|
|
@@ -666,7 +731,7 @@ const SearchSelect = (props: any) => {
|
|
|
666
731
|
visible={isModalVisible}
|
|
667
732
|
onOk={handleOk}
|
|
668
733
|
onCancel={handleCancel}
|
|
669
|
-
footer={selectMode?[
|
|
734
|
+
footer={selectMode ? [
|
|
670
735
|
<Button key="back" onClick={handleCancel}>
|
|
671
736
|
取消
|
|
672
737
|
</Button>,
|
|
@@ -678,11 +743,11 @@ const SearchSelect = (props: any) => {
|
|
|
678
743
|
>
|
|
679
744
|
确定
|
|
680
745
|
</Button>,
|
|
681
|
-
]:null}
|
|
746
|
+
] : null}
|
|
682
747
|
>
|
|
683
748
|
<div className={'search_select_wrapper'}>
|
|
684
749
|
<div className={'search_select_wrapper_click_flag'} onClick={() => setCaretLeftFlag(!caretLeftFlag)}>
|
|
685
|
-
<CaretLeftOutlined className={caretLeftFlag ? 'search_select_wrapper_click_flag_arrow' : 'search_select_wrapper_click_flag_arrow_1'
|
|
750
|
+
<CaretLeftOutlined className={caretLeftFlag ? 'search_select_wrapper_click_flag_arrow' : 'search_select_wrapper_click_flag_arrow_1'} />
|
|
686
751
|
</div>
|
|
687
752
|
<div className={caretLeftFlag ? 'search_select_wrapper_left' : 'search_select_wrapper_left1'}>
|
|
688
753
|
<div className={'select_list_columns'}>
|
|
@@ -694,11 +759,11 @@ const SearchSelect = (props: any) => {
|
|
|
694
759
|
</div>
|
|
695
760
|
</div>
|
|
696
761
|
<div className={'select_list_searchButton'}>
|
|
697
|
-
<Button key='reset' className={'select_list_button_space'}
|
|
762
|
+
<Button key='reset' className={'select_list_button_space'} onClick={onResetTable}>重置</Button>
|
|
698
763
|
<Button key='search' type="primary" onClick={onSearchTable}>查询</Button>
|
|
699
764
|
</div>
|
|
700
765
|
</div>
|
|
701
|
-
<div className={caretLeftFlag ? 'search_select_wrapper_right': 'search_select_wrapper_right1'}>
|
|
766
|
+
<div className={caretLeftFlag ? 'search_select_wrapper_right' : 'search_select_wrapper_right1'}>
|
|
702
767
|
<div>
|
|
703
768
|
<div className={'select_list_selectTips'}>
|
|
704
769
|
<div style={{ marginLeft: 8 }}>搜索结果共<span style={themeColor}>{tablePagination?.total || 0}</span>项{selectMode ? <span>, 本次已选<span style={themeColor}>{selectedRowKeys?.length || 0}</span>项</span> : ''}</div>
|
|
@@ -727,6 +792,6 @@ const SearchSelect = (props: any) => {
|
|
|
727
792
|
)}
|
|
728
793
|
</div>
|
|
729
794
|
);
|
|
730
|
-
};
|
|
795
|
+
});
|
|
731
796
|
|
|
732
797
|
export default SearchSelect;
|
package/src/index.ts
CHANGED
|
@@ -20,3 +20,5 @@ export { default as CommodityEntry } from './components/Business/CommodityEntry'
|
|
|
20
20
|
export { default as CheckOneUser } from './utils/CheckOneUser';
|
|
21
21
|
export { default as TreeSearchSelect } from './components/Functional/TreeSearchSelect';
|
|
22
22
|
export { default as BusinessTreeSearchSelect } from './components/Business/TreeSearchSelect';
|
|
23
|
+
export { default as StateFlow } from './components/Business/StateFlow';
|
|
24
|
+
export { default as GuideWrapper } from './components/Business/CommonGuideWrapper';
|
package/typings.d.ts
CHANGED