@bit-sun/business-component 4.0.11-alpha.1 → 4.0.11-alpha.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/.umirc.ts +10 -6
- package/dist/components/Business/SearchSelect/BusinessUtils.d.ts +2 -1
- package/dist/components/Functional/SearchSelect/utils.d.ts +7 -0
- package/dist/index.esm.js +1590 -987
- package/dist/index.js +1589 -986
- package/package.json +1 -1
- package/src/assets/copyImg.svg +16 -0
- package/src/assets/zhankaitiaojian-icon.svg +18 -0
- package/src/components/Business/BsLayouts/index.tsx +17 -0
- package/src/components/Business/BsSulaQueryTable/index.tsx +17 -15
- package/src/components/Business/BsSulaQueryTable/utils.tsx +1 -1
- package/src/components/Business/DetailPageWrapper/index.less +1 -2
- package/src/components/Business/SearchSelect/BusinessUtils.tsx +774 -160
- package/src/components/Business/SearchSelect/index.md +180 -0
- package/src/components/Business/SearchSelect/index.tsx +2 -1
- package/src/components/Business/SearchSelect/utils.ts +4 -1
- package/src/components/Business/StateFlow/index.less +140 -124
- package/src/components/Business/StateFlow/index.tsx +3 -3
- package/src/components/Business/columnSettingTable/columnSetting.tsx +1 -1
- package/src/components/Business/columnSettingTable/index.tsx +3 -4
- package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +3 -5
- package/src/components/Common/ParagraphCopier/index.tsx +2 -6
- package/src/components/Functional/QueryMutipleInput/index.less +51 -19
- package/src/components/Functional/QueryMutipleInput/index.tsx +26 -22
- package/src/components/Functional/SearchSelect/index.less +220 -74
- package/src/components/Functional/SearchSelect/index.tsx +264 -217
- package/src/components/Functional/SearchSelect/utils.ts +24 -0
- package/src/components/Solution/RuleComponent/index.js +4 -3
- package/src/components/Solution/RuleSetter/function.ts +2 -1
- package/src/styles/bsDefault.less +2 -13
- package/src/utils/TableUtils.tsx +1 -1
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import React, { useState, useEffect, forwardRef, useImperativeHandle } from 'react';
|
|
3
3
|
import { useDebounceFn } from 'ahooks';
|
|
4
|
-
import { Input, Button, Modal, Select, Divider, message, Spin, Form, Table, Checkbox, TreeSelect, Tooltip, Tag } from 'antd';
|
|
4
|
+
import { Input, Button, Modal, Select, Divider, message, Spin, Form, Table, Checkbox, TreeSelect, Tooltip, Tag, Row, Col, Space, Tabs } from 'antd';
|
|
5
5
|
import { SearchOutlined, CopyOutlined, CaretLeftOutlined } from '@ant-design/icons';
|
|
6
6
|
import request from '@/utils/request';
|
|
7
7
|
import { stringify } from 'querystring';
|
|
8
|
-
import _, { escapeRegExp, isNil } from "lodash"
|
|
8
|
+
import _, { escapeRegExp, isNil, values } from "lodash"
|
|
9
9
|
import './index.less';
|
|
10
10
|
import { BusinessSearchSelect, QueryMutipleInput } from '@/index';
|
|
11
|
-
import { handleSourceName } from './utils';
|
|
11
|
+
import { handleSourceName, getFormRowInfo, hasMoreQueryFields, defaultVisibleFieldsCount } from './utils';
|
|
12
12
|
import { judgeIsRequestError } from '@/utils/requestUtils';
|
|
13
|
+
import zhankaitiaojian from '../../../assets/zhankaitiaojian-icon.svg';
|
|
13
14
|
|
|
14
15
|
const { Option } = Select;
|
|
16
|
+
const ColSpan = 6;
|
|
15
17
|
|
|
16
18
|
const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
17
19
|
const {
|
|
@@ -27,6 +29,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
27
29
|
needModalTable = true,
|
|
28
30
|
getPopupContainer = undefined,
|
|
29
31
|
fieldComponent,
|
|
32
|
+
onSaveCallback,
|
|
30
33
|
selectBusinessType,
|
|
31
34
|
} = props;
|
|
32
35
|
const {
|
|
@@ -40,7 +43,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
40
43
|
mappingTextShowKeyField,
|
|
41
44
|
mappingValueField = 'code',
|
|
42
45
|
mappingTextShowTextField,
|
|
43
|
-
init =
|
|
46
|
+
init = false,// 是否初始请求,默认初始不请求,查询需要限制录入4位数以上支持模糊查询
|
|
44
47
|
extralHeaders = {},// 额外请求头参数
|
|
45
48
|
specialBracket = false,// 是否使用特殊括弧显示选项 【value】text
|
|
46
49
|
noNeedSplit = false,// label显示不需要任何特殊化
|
|
@@ -50,23 +53,26 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
50
53
|
const selectMode = selectProps?.mode // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
|
|
51
54
|
const initVal = value || (selectMode ? [] : null);
|
|
52
55
|
const pageSize = 100 // 下拉框默认分页 条数
|
|
53
|
-
const tableInitPageSize =
|
|
56
|
+
const tableInitPageSize = 20 // 弹框默认分页 条数
|
|
54
57
|
const currentPage = 1
|
|
55
58
|
const selectParamsKey = requestConfig?.filter || 'qp-codeAndName-like'
|
|
56
59
|
const selectParamsInitKey = requestConfig?.filterInit || selectParamsKey
|
|
57
60
|
const currentSelectProps = {
|
|
58
61
|
...selectProps,
|
|
59
62
|
// 以下属性不可更改----设计配置项
|
|
60
|
-
|
|
63
|
+
showArrow: true,
|
|
64
|
+
showSearch: true,
|
|
61
65
|
filterOption: false,
|
|
62
66
|
allowClear: true,
|
|
63
67
|
listHeight: 160,
|
|
64
68
|
optionLabelProp: "label",
|
|
65
69
|
autoClearSearchValue: false
|
|
66
70
|
}
|
|
67
|
-
const
|
|
71
|
+
const initPagination = { showQuickJumper: true, showSizeChanger: true, showTotal: (total: any) => `共 ${total} 条` }
|
|
72
|
+
const tableInitPagination = { ...initPagination, total: 0, current: 1, pageSize: tableInitPageSize }
|
|
68
73
|
|
|
69
74
|
const [items, setItems] = useState([]);
|
|
75
|
+
const [selectOpen, setSelectOpen] = useState(false);
|
|
70
76
|
const [scrollPage, setScrollPage] = useState(1);
|
|
71
77
|
const [itemsTotal, setItemsTotal] = useState(0);
|
|
72
78
|
const [fetching, setFetching] = useState(false);
|
|
@@ -101,6 +107,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
101
107
|
);
|
|
102
108
|
|
|
103
109
|
const [form] = Form.useForm();
|
|
110
|
+
const [collapsed, setCollapsed] = useState(true);
|
|
104
111
|
const [caretLeftFlag, setCaretLeftFlag] = useState(true);
|
|
105
112
|
const [tableData, setTableData] = useState([]);
|
|
106
113
|
const [tablePagination, setTablePagination] = useState(tableInitPagination)
|
|
@@ -110,6 +117,8 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
110
117
|
const [indeterminate, setIndeterminate] = useState(false)
|
|
111
118
|
const [tableFormParams, setTableFormParams] = useState({});
|
|
112
119
|
const [tooltipVisible, setTooltipVisible] = useState(false);
|
|
120
|
+
const [tableShowColumns, setTabletShowColumns] = useState(modalTableProps?.tableColumns?.filter(s => typeof s.defaultSort == 'number')?.sort((a,b)=> a.defaultSort-b.defaultSort)||[]);
|
|
121
|
+
const [confirmLoading, setConfirmLoading] = useState(false);
|
|
113
122
|
|
|
114
123
|
useImperativeHandle(ref, () => ({
|
|
115
124
|
refreshDataSource: (reset: boolean = false) => {
|
|
@@ -314,7 +323,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
314
323
|
const keys = res.list ? 'list' : 'items';
|
|
315
324
|
source = res
|
|
316
325
|
? res[keys]
|
|
317
|
-
? res[keys].map((item: any) => {
|
|
326
|
+
? res[keys].map((item: any, index: number) => {
|
|
318
327
|
let textShowText = item[mappingTextField]
|
|
319
328
|
if (mappingTextShowTextField) {
|
|
320
329
|
textShowText = []
|
|
@@ -326,6 +335,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
326
335
|
textShowText = item[mappingTextShowTextField]
|
|
327
336
|
}
|
|
328
337
|
}
|
|
338
|
+
if(!item?.children?.length) {delete item?.children};
|
|
329
339
|
return {
|
|
330
340
|
...item,
|
|
331
341
|
text: specialBracket
|
|
@@ -334,10 +344,11 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
334
344
|
textShowText,
|
|
335
345
|
textShowKey: item[mappingTextShowKeyField || mappingValueField],
|
|
336
346
|
value: item[mappingValueField],
|
|
347
|
+
keyIndex: index + 1,
|
|
337
348
|
};
|
|
338
349
|
})
|
|
339
350
|
: Array.isArray(res) &&
|
|
340
|
-
res?.map((item: Record<string, any
|
|
351
|
+
res?.map((item: Record<string, any>, index: number) => {
|
|
341
352
|
let textShowText = item[mappingTextField]
|
|
342
353
|
if (mappingTextShowTextField) {
|
|
343
354
|
textShowText = []
|
|
@@ -349,6 +360,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
349
360
|
textShowText = item[mappingTextShowTextField]
|
|
350
361
|
}
|
|
351
362
|
}
|
|
363
|
+
if(!item?.children?.length) {delete item?.children};
|
|
352
364
|
return {
|
|
353
365
|
...item,
|
|
354
366
|
text: specialBracket
|
|
@@ -357,6 +369,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
357
369
|
textShowText,
|
|
358
370
|
textShowKey: item[mappingTextShowKeyField || mappingValueField],
|
|
359
371
|
value: item[mappingValueField],
|
|
372
|
+
keyIndex: index + 1,
|
|
360
373
|
};
|
|
361
374
|
})
|
|
362
375
|
: [];
|
|
@@ -438,8 +451,35 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
438
451
|
}
|
|
439
452
|
},[selectBusinessType])
|
|
440
453
|
|
|
454
|
+
// 处理键盘事件
|
|
455
|
+
const handleKeyPress = (event) => {
|
|
456
|
+
console.log(event,'----event')
|
|
457
|
+
if ((event.metaKey || event.ctrlKey) && (event.key === 'U' || event.keyCode == 85)) {
|
|
458
|
+
// ctrl + U 键 重置
|
|
459
|
+
onResetTable()
|
|
460
|
+
} else if (event.key === 'Enter' || event.keyCode == 13) {
|
|
461
|
+
// Enter 键 查询
|
|
462
|
+
onSearchTable()
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
useEffect(() => {
|
|
466
|
+
const removeListener = () => {
|
|
467
|
+
// 组件卸载时移除事件监听
|
|
468
|
+
document.removeEventListener('keydown', handleKeyPress);
|
|
469
|
+
}
|
|
470
|
+
if(isModalVisible) {
|
|
471
|
+
document.addEventListener('keydown', handleKeyPress);
|
|
472
|
+
} else {
|
|
473
|
+
removeListener()
|
|
474
|
+
}
|
|
475
|
+
return () => {
|
|
476
|
+
removeListener()
|
|
477
|
+
};
|
|
478
|
+
},[isModalVisible])
|
|
479
|
+
|
|
441
480
|
const showModal = () => {
|
|
442
|
-
|
|
481
|
+
// 弹窗打开默认不查询
|
|
482
|
+
// getData({ pageSize: tableInitPageSize, currentPage: 1 }, 3)
|
|
443
483
|
setIsModalVisible(true);
|
|
444
484
|
// 回显
|
|
445
485
|
if (value) {
|
|
@@ -470,10 +510,36 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
470
510
|
onChange(formatResult, selectedValue)
|
|
471
511
|
}
|
|
472
512
|
}
|
|
473
|
-
|
|
474
513
|
const handleOk = () => {
|
|
475
|
-
|
|
476
|
-
|
|
514
|
+
// 按钮保存可传入
|
|
515
|
+
if(onSaveCallback) {
|
|
516
|
+
setConfirmLoading(true)
|
|
517
|
+
onSaveCallback(popvalue).then(res => {
|
|
518
|
+
if(true) {
|
|
519
|
+
// 成功信息可以在调用处处理 即resolve({messageSuccessBackInfo: { needThrowSuccess: false } })、resolve({messageSuccessBackInfo: { needThrowSuccess: true, successMessage: '已保存' } })
|
|
520
|
+
let initSuccessMessage = '保存成功'
|
|
521
|
+
const rmsbi = res?.messageSuccessBackInfo || {};
|
|
522
|
+
if(rmsbi && Object.keys(rmsbi)?.length){
|
|
523
|
+
rmsbi?.needThrowSuccess ? message.success(rmsbi?.successMessage || initSuccessMessage) : null
|
|
524
|
+
} else {
|
|
525
|
+
message.success(initSuccessMessage)
|
|
526
|
+
}
|
|
527
|
+
handleCancel();
|
|
528
|
+
} else {
|
|
529
|
+
}
|
|
530
|
+
setConfirmLoading(false)
|
|
531
|
+
}).catch(Error => {
|
|
532
|
+
if(typeof Error === 'object') {
|
|
533
|
+
!Error.needThrowError ? null : message.error(Error.message)
|
|
534
|
+
} else {
|
|
535
|
+
message.error(Error);
|
|
536
|
+
}
|
|
537
|
+
setConfirmLoading(false)
|
|
538
|
+
})
|
|
539
|
+
} else {
|
|
540
|
+
handleSelectOver(popvalue)
|
|
541
|
+
handleCancel();
|
|
542
|
+
}
|
|
477
543
|
};
|
|
478
544
|
|
|
479
545
|
const formaData = (value: any, source: any) => {
|
|
@@ -524,13 +590,9 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
524
590
|
}
|
|
525
591
|
}
|
|
526
592
|
|
|
527
|
-
const onSearchChange = (
|
|
528
|
-
setSearchValue(
|
|
529
|
-
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
const onSearchBlur = () => {
|
|
533
|
-
setSearchValue('');
|
|
593
|
+
const onSearchChange = (v) => {
|
|
594
|
+
setSearchValue(v);
|
|
595
|
+
if(v?.length < 4) return;
|
|
534
596
|
refreshItems();
|
|
535
597
|
}
|
|
536
598
|
|
|
@@ -549,49 +611,13 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
549
611
|
getData({ pageSize: tableInitPageSize, currentPage: 1 }, 2)
|
|
550
612
|
}
|
|
551
613
|
|
|
614
|
+
const toggleCollapsed = () => {
|
|
615
|
+
setCollapsed(!collapsed);
|
|
616
|
+
};
|
|
617
|
+
|
|
552
618
|
const handleTableChange = (pagination) => {
|
|
553
619
|
getData({ ...tableFormParams, pageSize: pagination.pageSize, currentPage: pagination.current }, 2)
|
|
554
620
|
}
|
|
555
|
-
|
|
556
|
-
const onCheckAllData = (pSize) => {
|
|
557
|
-
getData({ ...tableFormParams, pageSize: pSize, currentPage: 1 }, 2,(source) => {
|
|
558
|
-
const currentItemsData = JSON.parse(JSON.stringify(source))
|
|
559
|
-
setSelectedRowKeys(currentItemsData.map(i => i.value))
|
|
560
|
-
setPopValue(currentItemsData);
|
|
561
|
-
setSelectedRows(currentItemsData)
|
|
562
|
-
})
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
const onChangeCheckAll = (e) => {
|
|
566
|
-
// 允许用户自定义 全选操作逻辑
|
|
567
|
-
if(modalTableProps?.onCheckAll) {
|
|
568
|
-
modalTableProps?.onCheckAll(e,{items,itemsTotal,tablePagination,onCheckAllData,setSelectedRowKeys,setPopValue,setSelectedRows,setIndeterminate,setCheckedAll})
|
|
569
|
-
return;
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
if (e.target.checked) {
|
|
573
|
-
// 如果下拉框有所有数据就处理选中所有【items.length === itemsTotal】(最多可选100条)
|
|
574
|
-
// 如果超过100条 就默认查出所有数据
|
|
575
|
-
if ((items.length < itemsTotal) || (items.length === itemsTotal && itemsTotal == 0)) {
|
|
576
|
-
const totalCount = tablePagination?.total || itemsTotal // 兼容有查询条件的情况 首次加载是没有所有数据的,默认给加载后端返回的总条数
|
|
577
|
-
const totalPage = Math.ceil(totalCount / tablePagination?.pageSize);
|
|
578
|
-
const allPageSize = totalPage * tablePagination?.pageSize;
|
|
579
|
-
onCheckAllData(allPageSize)
|
|
580
|
-
} else {
|
|
581
|
-
const currentItemsData = JSON.parse(JSON.stringify(items))
|
|
582
|
-
setSelectedRowKeys(currentItemsData.map(i => i.value))
|
|
583
|
-
setPopValue(currentItemsData);
|
|
584
|
-
setSelectedRows(currentItemsData)
|
|
585
|
-
}
|
|
586
|
-
} else {
|
|
587
|
-
setSelectedRowKeys([])
|
|
588
|
-
setPopValue([]);
|
|
589
|
-
setSelectedRows([])
|
|
590
|
-
}
|
|
591
|
-
setIndeterminate(false);
|
|
592
|
-
setCheckedAll(e.target.checked);
|
|
593
|
-
}
|
|
594
|
-
|
|
595
621
|
const LightHeightOption = (props) => {
|
|
596
622
|
const {
|
|
597
623
|
filterTxt, text,
|
|
@@ -634,7 +660,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
634
660
|
};
|
|
635
661
|
|
|
636
662
|
const onChangeSelectedKeys = (selectKeys, selectRows) => {
|
|
637
|
-
let sksResult = selectRows
|
|
663
|
+
let sksResult = selectRows?.map((i) => i.value)||[];
|
|
638
664
|
|
|
639
665
|
// 单选 默认直接选中 不需要确定 配置了modalRadioNeedFooter就需要确定
|
|
640
666
|
if(!selectMode && !modalTableProps?.modalRadioNeedFooter) {
|
|
@@ -693,40 +719,49 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
693
719
|
return false
|
|
694
720
|
}
|
|
695
721
|
};
|
|
696
|
-
|
|
722
|
+
|
|
723
|
+
const { emptyArray } = getFormRowInfo(list);
|
|
724
|
+
const addKong = emptyArray?.map((i: any) =>({ type: 'kong'}))||[];
|
|
725
|
+
return list?.concat(addKong)?.map((i: any, index: number) => {
|
|
726
|
+
if(i?.type === 'kong') return <Col span={ColSpan} key={i}></Col>;
|
|
727
|
+
|
|
697
728
|
if (i?.type === 'select' || i?.field?.type === 'select') {
|
|
698
729
|
return (
|
|
699
|
-
<
|
|
700
|
-
<
|
|
701
|
-
{i?.
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
730
|
+
<Col span={ColSpan} key={i.name}>
|
|
731
|
+
<Form.Item name={i.name} label={i.label} key={i.name}>
|
|
732
|
+
<Select style={{ width: '100%' }} placeholder='请选择' {...i?.field?.props} disabled={setDisabled(i.name)}>
|
|
733
|
+
{i?.initialSource?.length && i?.initialSource.map((m: any) => (
|
|
734
|
+
<Option value={m.value} key={m.value}>{m.text}</Option>
|
|
735
|
+
))}
|
|
736
|
+
</Select>
|
|
737
|
+
</Form.Item>
|
|
738
|
+
</Col>
|
|
706
739
|
)
|
|
707
740
|
}
|
|
708
741
|
|
|
709
742
|
if (i?.type === 'treeSelect' || i?.field?.type === 'treeSelect') {
|
|
710
743
|
return (
|
|
711
|
-
<
|
|
712
|
-
<
|
|
713
|
-
|
|
744
|
+
<Col span={ColSpan} key={i.name}>
|
|
745
|
+
<Form.Item name={i.name} label={i.label} key={i.name}>
|
|
746
|
+
<TreeSelect style={{ width: '100%' }} placeholder='请选择' {...i?.field?.props} disabled={setDisabled(i.name)}></TreeSelect>
|
|
747
|
+
</Form.Item>
|
|
748
|
+
</Col>
|
|
714
749
|
)
|
|
715
750
|
}
|
|
716
751
|
|
|
717
752
|
if (i?.type === 'businessSearchSelect' || i?.field?.type === 'businessSearchSelect') {
|
|
718
753
|
return (
|
|
719
|
-
<
|
|
754
|
+
<Col span={ColSpan} key={i.name}>
|
|
720
755
|
<Form.Item name={i.name} label={i.label} key={i.name}>
|
|
721
756
|
<BusinessSearchSelect {...i.field.props} disabled={setDisabled(i.name)} />
|
|
722
757
|
</Form.Item>
|
|
723
|
-
</
|
|
758
|
+
</Col>
|
|
724
759
|
)
|
|
725
760
|
}
|
|
726
761
|
|
|
727
762
|
if (i?.type === 'multipleQueryInput' || i?.field?.type === 'multipleQueryInput') {
|
|
728
763
|
return (
|
|
729
|
-
<
|
|
764
|
+
<Col span={ColSpan} key={i.name}>
|
|
730
765
|
<Form.Item name={i.name} label={i.label} key={i.name}>
|
|
731
766
|
<QueryMutipleInput onValueChange={(value) => {
|
|
732
767
|
form.setFieldsValue({
|
|
@@ -734,15 +769,17 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
734
769
|
})
|
|
735
770
|
}} />
|
|
736
771
|
</Form.Item>
|
|
737
|
-
</
|
|
772
|
+
</Col>
|
|
738
773
|
);
|
|
739
774
|
}
|
|
740
775
|
|
|
741
776
|
// 默认type是input
|
|
742
777
|
return (
|
|
743
|
-
<
|
|
744
|
-
<
|
|
745
|
-
|
|
778
|
+
<Col span={ColSpan} key={i.name}>
|
|
779
|
+
<Form.Item name={i.name} label={i.label} key={i.name}>
|
|
780
|
+
<Input style={{ width: '100%' }} placeholder='请输入' allowClear maxLength={100} {...i?.field?.props} disabled={setDisabled(i.name)} />
|
|
781
|
+
</Form.Item>
|
|
782
|
+
</Col>
|
|
746
783
|
)
|
|
747
784
|
})
|
|
748
785
|
} else {
|
|
@@ -750,6 +787,106 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
750
787
|
}
|
|
751
788
|
}
|
|
752
789
|
|
|
790
|
+
const renderFormItem = (list) => {
|
|
791
|
+
const viCount = modalTableProps?.visibleFieldsCount || defaultVisibleFieldsCount;
|
|
792
|
+
return collapsed ? formItem(list?.slice(0,viCount)) : formItem(list)
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
// const queryFieldsDom = <SearchItemTable
|
|
796
|
+
// ref={searchTableRef}
|
|
797
|
+
// setShowSearchFields={setShowSearchFields||[]}
|
|
798
|
+
// showSearchFields={showSearchFields||[]}
|
|
799
|
+
// datasource={modalTableProps?.tableSearchForm || []}
|
|
800
|
+
// bsTableCode={bsTableCode}
|
|
801
|
+
// />
|
|
802
|
+
|
|
803
|
+
const renderShowTable = (tableList, type,) => {
|
|
804
|
+
return (
|
|
805
|
+
<div style={{ height: '528px' }}>
|
|
806
|
+
<Table
|
|
807
|
+
bordered
|
|
808
|
+
size="middle"
|
|
809
|
+
rowSelection={rowSelection}
|
|
810
|
+
columns={tableShowColumns}
|
|
811
|
+
dataSource={tableList}
|
|
812
|
+
{...type=='noPage'?{
|
|
813
|
+
pagination: initPagination
|
|
814
|
+
}:{
|
|
815
|
+
pagination: tablePagination,
|
|
816
|
+
onChange: handleTableChange,
|
|
817
|
+
loading: fetching
|
|
818
|
+
}}
|
|
819
|
+
rowKey={mappingValueField}
|
|
820
|
+
scroll={{
|
|
821
|
+
x: modalTableProps.overScrollX || 'max-content',
|
|
822
|
+
y: modalTableProps.overScrollY || 440,
|
|
823
|
+
}}
|
|
824
|
+
onRow={(record) => {
|
|
825
|
+
return {
|
|
826
|
+
onDoubleClick: (event) =>
|
|
827
|
+
onDoubleClickSelect(event, record),
|
|
828
|
+
};
|
|
829
|
+
}}
|
|
830
|
+
/>
|
|
831
|
+
</div>
|
|
832
|
+
)
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
const tabsItems1 = [
|
|
836
|
+
{ label: `全部(${tablePagination?.total || 0})`, key: 'all', children: renderShowTable(tableData) }, // 务必填写 key
|
|
837
|
+
];
|
|
838
|
+
const tabsItems2 = [
|
|
839
|
+
{ label: `已选(${selectedRowKeys?.length || 0})`, key: 'selected', children: renderShowTable(selectedRows?.map((s,index)=> ({...s,keyIndex:index+1}))||[],'noPage') },
|
|
840
|
+
];
|
|
841
|
+
|
|
842
|
+
const onClear = () => {
|
|
843
|
+
formaData([], items);
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
const onDropdownVisibleChange = (visible) => {
|
|
847
|
+
setSelectOpen(visible);
|
|
848
|
+
// 解决多选时,关闭下拉框值 搜索项被清空但是没有重新调用onsearch事件的问题
|
|
849
|
+
selectMode && !visible && setSearchValue('')
|
|
850
|
+
}
|
|
851
|
+
const renderTable = (dataSource) => {
|
|
852
|
+
return (
|
|
853
|
+
<div className={`search_select_dropdown_table ${!selectMode?'search_select_dropdown_table1':''}`}>
|
|
854
|
+
<Table
|
|
855
|
+
virtual
|
|
856
|
+
bordered
|
|
857
|
+
{...(selectMode?{
|
|
858
|
+
rowSelection: {
|
|
859
|
+
type: 'checkbox',
|
|
860
|
+
selectedRowKeys: labelInValue ? value.map(s=> (s?.value||s)) : value,
|
|
861
|
+
onChange: (sks, srs) => {
|
|
862
|
+
formaData(srs, dataSource);
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
}:{
|
|
866
|
+
rowSelection: {
|
|
867
|
+
type: 'radio',
|
|
868
|
+
columnWidth: 0,
|
|
869
|
+
selectedRowKeys: labelInValue ? value?.value&&[value?.value]||[] : value&&[value]||[],
|
|
870
|
+
},
|
|
871
|
+
onRow: (record, rowKey) => ({
|
|
872
|
+
onDoubleClick: () => {
|
|
873
|
+
const srs = [JSON.parse(JSON.stringify(record))]
|
|
874
|
+
formaData(srs, dataSource);
|
|
875
|
+
setSelectOpen(false)
|
|
876
|
+
},
|
|
877
|
+
})
|
|
878
|
+
})}
|
|
879
|
+
columns={selectProps?.renderTableColumns||[]}
|
|
880
|
+
dataSource={items}
|
|
881
|
+
size="middle"
|
|
882
|
+
pagination={false}
|
|
883
|
+
rowKey={mappingValueField}
|
|
884
|
+
scroll={{ x: 'max-content', y: 288 }}
|
|
885
|
+
/>
|
|
886
|
+
</div>
|
|
887
|
+
);
|
|
888
|
+
}
|
|
889
|
+
|
|
753
890
|
const maxTagPlaceholder = (selectedValues) => {
|
|
754
891
|
const onClose = (e: any, item: any) => {
|
|
755
892
|
e.preventDefault();
|
|
@@ -830,44 +967,32 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
830
967
|
id={`search_select_div_${uniqueValue}`}
|
|
831
968
|
>
|
|
832
969
|
<Select
|
|
833
|
-
virtual
|
|
834
970
|
labelInValue={labelInValue}
|
|
835
971
|
value={value}
|
|
836
|
-
onChange={
|
|
972
|
+
onChange={onchange}
|
|
973
|
+
onClear={onClear}
|
|
837
974
|
disabled={props.disabled}
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
style={{ width: '98%', marginLeft: '1%' }}
|
|
843
|
-
placeholder="请输入"
|
|
844
|
-
onChange={(e) => onSearchChange(e)}
|
|
845
|
-
onBlur={onSearchBlur}
|
|
846
|
-
onKeyDown={(e) => {
|
|
847
|
-
// 阻止多选的冒泡
|
|
848
|
-
e.stopPropagation();
|
|
849
|
-
}}
|
|
850
|
-
/>
|
|
851
|
-
<Divider style={{ margin: '8px 0' }} />
|
|
852
|
-
{menu}
|
|
853
|
-
</>
|
|
854
|
-
)}
|
|
975
|
+
dropdownStyle={{ borderRadius: '2px', padding: '10px 2px' }}
|
|
976
|
+
open={selectOpen}
|
|
977
|
+
onDropdownVisibleChange={onDropdownVisibleChange}
|
|
978
|
+
dropdownRender={(menu) => items?.length ? renderTable(items) : menu}
|
|
855
979
|
notFoundContent={
|
|
856
980
|
fetching ? (
|
|
857
981
|
<Spin size="small" className='searchSelectSpin' />
|
|
858
982
|
) : (
|
|
859
983
|
<div style={{ textAlign: 'center' }}>
|
|
860
|
-
<div
|
|
861
|
-
<CopyOutlined style={{ fontSize: '50px' }} />
|
|
862
|
-
</div>
|
|
863
|
-
<div>无匹配结果,请更换其他内容再试</div>
|
|
984
|
+
<div>{searchValue?'无匹配结果,请更换其他内容再试':'请录入4位数以上字符进行模糊查询'}</div>
|
|
864
985
|
</div>
|
|
865
986
|
)
|
|
866
987
|
}
|
|
867
988
|
onPopupScroll={SelectScroll}
|
|
868
|
-
style={{ width:
|
|
989
|
+
style={{ width: 'calc(100%)' }}
|
|
869
990
|
placeholder="请选择"
|
|
870
991
|
maxTagPlaceholder={maxTagPlaceholder}
|
|
992
|
+
onSearch={(v) => onSearchChange(v)}
|
|
993
|
+
{...(needModalTable ? {
|
|
994
|
+
suffixIcon: <div className="search_select_expand_button" onClick={showModal}><SearchOutlined /></div>
|
|
995
|
+
} : {})}
|
|
871
996
|
{...currentSelectProps}
|
|
872
997
|
getPopupContainer={(triggerNode) => (getPopupContainer && getPopupContainer(triggerNode)) || triggerNode.parentElement}
|
|
873
998
|
>
|
|
@@ -880,22 +1005,15 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
880
1005
|
</Option>
|
|
881
1006
|
))}
|
|
882
1007
|
</Select>
|
|
883
|
-
{needModalTable && (
|
|
884
|
-
<Button
|
|
885
|
-
style={{ width: '30px', padding: '2px'}}
|
|
886
|
-
onClick={showModal}
|
|
887
|
-
type="primary"
|
|
888
|
-
>
|
|
889
|
-
<SearchOutlined />
|
|
890
|
-
</Button>
|
|
891
|
-
)}
|
|
892
1008
|
</div>
|
|
893
1009
|
)}
|
|
894
1010
|
{needModalTable && isModalVisible && (
|
|
895
1011
|
<Modal
|
|
1012
|
+
destroyOnClose
|
|
896
1013
|
width="80%"
|
|
897
1014
|
title={modalTableProps?.modalTableTitle}
|
|
898
1015
|
visible={isModalVisible}
|
|
1016
|
+
confirmLoading={confirmLoading}
|
|
899
1017
|
onOk={handleOk}
|
|
900
1018
|
onCancel={handleCancel}
|
|
901
1019
|
footer={
|
|
@@ -907,6 +1025,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
907
1025
|
<Button
|
|
908
1026
|
key="submit"
|
|
909
1027
|
type="primary"
|
|
1028
|
+
loading={confirmLoading}
|
|
910
1029
|
onClick={handleOk}
|
|
911
1030
|
disabled={
|
|
912
1031
|
!tableData.length ||
|
|
@@ -919,117 +1038,45 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
919
1038
|
]
|
|
920
1039
|
: null
|
|
921
1040
|
}
|
|
1041
|
+
wrapClassName={'search_select_modal_wrapper'}
|
|
922
1042
|
{...(modalTableProps?.modalProps || {})}
|
|
923
1043
|
>
|
|
924
1044
|
<div className={'search_select_wrapper'}>
|
|
925
|
-
<div
|
|
926
|
-
className={'search_select_wrapper_click_flag'}
|
|
927
|
-
onClick={() => setCaretLeftFlag(!caretLeftFlag)}
|
|
928
|
-
>
|
|
929
|
-
<CaretLeftOutlined
|
|
930
|
-
className={
|
|
931
|
-
caretLeftFlag
|
|
932
|
-
? 'search_select_wrapper_click_flag_arrow'
|
|
933
|
-
: 'search_select_wrapper_click_flag_arrow_1'
|
|
934
|
-
}
|
|
935
|
-
/>
|
|
936
|
-
</div>
|
|
937
|
-
<div
|
|
938
|
-
className={
|
|
939
|
-
caretLeftFlag
|
|
940
|
-
? 'search_select_wrapper_left'
|
|
941
|
-
: 'search_select_wrapper_left1'
|
|
942
|
-
}
|
|
943
|
-
>
|
|
1045
|
+
<div className={'search_select_wrapper_topForm'}>
|
|
944
1046
|
<div className={'select_list_columns'}>
|
|
945
|
-
<
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
{
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
1047
|
+
<Form form={form} layout={'horizontal'} colon={false} key="modalForm">
|
|
1048
|
+
<Row>
|
|
1049
|
+
{renderFormItem(modalTableProps?.tableSearchForm)}
|
|
1050
|
+
<Col span={6}>
|
|
1051
|
+
<Space>
|
|
1052
|
+
<Button key="search" type="primary" onClick={onSearchTable}>
|
|
1053
|
+
查询 Enter
|
|
1054
|
+
</Button>
|
|
1055
|
+
<Button key="reset" onClick={onResetTable}>
|
|
1056
|
+
重置 ctrl+U
|
|
1057
|
+
</Button>
|
|
1058
|
+
{/* <div>{queryFieldsDom}</div> */}
|
|
1059
|
+
<div style={{position: 'absolute',top: 0,right: 0}}>
|
|
1060
|
+
{hasMoreQueryFields(modalTableProps) && modalTableProps?.isHorizontally
|
|
1061
|
+
? <img onClick={() => {toggleCollapsed()}} style={{
|
|
1062
|
+
cursor: 'pointer',
|
|
1063
|
+
fontSize: '10px',
|
|
1064
|
+
transition: '0.3s all',
|
|
1065
|
+
transform: `rotate(${collapsed ? 0 : 0.5}turn)`,
|
|
1066
|
+
}} src={zhankaitiaojian} />
|
|
1067
|
+
: <></>
|
|
1068
|
+
}
|
|
1069
|
+
</div>
|
|
1070
|
+
</Space>
|
|
1071
|
+
</Col>
|
|
1072
|
+
</Row>
|
|
1073
|
+
</Form>
|
|
963
1074
|
</div>
|
|
964
1075
|
</div>
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
: 'search_select_wrapper_right1'
|
|
970
|
-
}
|
|
971
|
-
>
|
|
972
|
-
<div>
|
|
973
|
-
<div className={'select_list_selectTips'}>
|
|
974
|
-
<div style={{ marginLeft: 8 }}>
|
|
975
|
-
搜索结果共
|
|
976
|
-
<span style={themeColor}>
|
|
977
|
-
{tablePagination?.total || 0}
|
|
978
|
-
</span>
|
|
979
|
-
项
|
|
980
|
-
{selectMode ? (
|
|
981
|
-
<span>
|
|
982
|
-
, 本次已选
|
|
983
|
-
<span style={themeColor}>
|
|
984
|
-
{selectedRowKeys?.length || 0}
|
|
985
|
-
</span>
|
|
986
|
-
项
|
|
987
|
-
</span>
|
|
988
|
-
) : (
|
|
989
|
-
''
|
|
990
|
-
)}
|
|
991
|
-
</div>
|
|
992
|
-
<div
|
|
993
|
-
style={{ color: 'rgba(127, 127, 127, 0.6470588235294118)' }}
|
|
994
|
-
>
|
|
995
|
-
{selectMode
|
|
996
|
-
? '勾选后点击确定按钮完成选择'
|
|
997
|
-
: '双击数据行或点击单选图标完成选择'}
|
|
998
|
-
</div>
|
|
999
|
-
</div>
|
|
1000
|
-
<Table
|
|
1001
|
-
size="small"
|
|
1002
|
-
rowSelection={rowSelection}
|
|
1003
|
-
columns={modalTableProps?.tableColumns}
|
|
1004
|
-
dataSource={tableData}
|
|
1005
|
-
pagination={tablePagination}
|
|
1006
|
-
onChange={handleTableChange}
|
|
1007
|
-
rowKey={mappingValueField}
|
|
1008
|
-
scroll={{
|
|
1009
|
-
x: modalTableProps.overScrollX || 'max-content',
|
|
1010
|
-
y: modalTableProps.overScrollY || null,
|
|
1011
|
-
}}
|
|
1012
|
-
onRow={(record) => {
|
|
1013
|
-
return {
|
|
1014
|
-
onDoubleClick: (event) =>
|
|
1015
|
-
onDoubleClickSelect(event, record),
|
|
1016
|
-
};
|
|
1017
|
-
}}
|
|
1018
|
-
/>
|
|
1019
|
-
{(selectMode && !modalTableProps?.isHiddenCheckAll) ? (
|
|
1020
|
-
<div className={'select_list_selectAll'}>
|
|
1021
|
-
<Checkbox
|
|
1022
|
-
indeterminate={indeterminate}
|
|
1023
|
-
checked={checkedAll}
|
|
1024
|
-
onChange={onChangeCheckAll}
|
|
1025
|
-
disabled={selectProps?.disabled || props?.disabled}
|
|
1026
|
-
/>{' '}
|
|
1027
|
-
全选所有页面
|
|
1028
|
-
</div>
|
|
1029
|
-
) : (
|
|
1030
|
-
''
|
|
1031
|
-
)}
|
|
1032
|
-
</div>
|
|
1076
|
+
|
|
1077
|
+
<div className={'search_select_wrapper_bottomTable'}>
|
|
1078
|
+
<div className={selectMode ?'search_select_wrapper_bottomTable_wrapLeft2':'search_select_wrapper_bottomTable_wrapLeft1'}><Tabs items={tabsItems1} /></div>
|
|
1079
|
+
{selectMode ? <div className={'search_select_wrapper_bottomTable_wrapRight'}><Tabs items={tabsItems2} tabBarExtraContent={<span onClick={()=> onChangeSelectedKeys([], [])}>清空已选</span>} /></div> : null}
|
|
1033
1080
|
</div>
|
|
1034
1081
|
</div>
|
|
1035
1082
|
</Modal>
|