@bit-sun/business-component 2.4.19 → 2.4.21
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/.editorconfig +16 -16
- package/.fatherrc.ts +5 -5
- package/.gitlab-ci.yml +179 -179
- package/.prettierignore +7 -7
- package/.prettierrc +11 -11
- package/.umirc.ts +74 -74
- package/README.md +27 -27
- package/dist/index.esm.js +10 -6
- package/dist/index.js +10 -6
- package/docs/index.md +21 -21
- package/lib/assets/drag.svg +17 -17
- package/lib/assets/exportFail.svg +37 -37
- package/lib/assets/exportProcessing.svg +28 -28
- package/lib/assets/exportSuccess.svg +34 -34
- package/lib/assets/label_icon_bottom.svg +25 -25
- package/lib/assets/upExport.svg +22 -22
- package/package.json +79 -79
- package/src/assets/32.svg +27 -27
- package/src/assets/addIcon.svg +17 -17
- package/src/assets/allfunc.svg +27 -27
- package/src/assets/arrowRight.svg +24 -24
- package/src/assets/btn-delete.svg +29 -29
- package/src/assets/btn-edit.svg +19 -19
- package/src/assets/btn-more.svg +17 -17
- package/src/assets/btn-submit.svg +19 -19
- package/src/assets/caidan.svg +11 -11
- package/src/assets/close.svg +26 -26
- package/src/assets/drag.svg +17 -17
- package/src/assets/exportFail.svg +37 -37
- package/src/assets/exportProcessing.svg +28 -28
- package/src/assets/exportSuccess.svg +34 -34
- package/src/assets/fixed-left-active.svg +11 -11
- package/src/assets/fixed-left.svg +15 -15
- package/src/assets/fixed-right-active.svg +11 -11
- package/src/assets/fixed-right.svg +15 -15
- package/src/assets/guanbi.svg +15 -15
- package/src/assets/icon-quanping.svg +15 -15
- package/src/assets/icon-shezhi.svg +17 -17
- package/src/assets/label_icon_bottom.svg +25 -25
- package/src/assets/list-no-img.svg +21 -21
- package/src/assets/morentouxiang-32.svg +23 -23
- package/src/assets/scanning.svg +24 -24
- package/src/assets/upExport.svg +22 -22
- package/src/common/ENUM.ts +41 -41
- package/src/components/Business/AddSelectBusiness/index.md +162 -162
- package/src/components/Business/AddSelectBusiness/index.tsx +1061 -1061
- package/src/components/Business/BsLayouts/Components/AllFunc/drawContent.tsx +111 -111
- package/src/components/Business/BsLayouts/Components/AllFunc/index.less +153 -153
- package/src/components/Business/BsLayouts/Components/AllFunc/index.tsx +70 -70
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.less +90 -90
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.tsx +37 -37
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.tsx +242 -242
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.tsx +384 -384
- package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.tsx +285 -285
- package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.tsx +74 -74
- package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/drawContent.less +170 -170
- package/src/components/Business/BsLayouts/Components/CustomerMenu/index.less +64 -64
- package/src/components/Business/BsLayouts/Components/CustomerMenu/index.tsx +153 -153
- package/src/components/Business/BsLayouts/Components/GlobalHeader/index.less +72 -72
- package/src/components/Business/BsLayouts/Components/GlobalHeader/index.tsx +157 -157
- package/src/components/Business/BsLayouts/Components/RightContent/LoginModal.tsx +85 -85
- package/src/components/Business/BsLayouts/Components/RightContent/home.less +218 -218
- package/src/components/Business/BsLayouts/Components/RightContent/index.tsx +155 -155
- package/src/components/Business/BsLayouts/Components/SearchFunc/index.less +160 -160
- package/src/components/Business/BsLayouts/Components/SearchFunc/index.tsx +75 -75
- package/src/components/Business/BsLayouts/index.less +79 -79
- package/src/components/Business/BsLayouts/index.tsx +1484 -1484
- package/src/components/Business/BsLayouts/service.ts +10 -10
- package/src/components/Business/BsLayouts/utils.tsx +203 -203
- package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +566 -566
- package/src/components/Business/BsSulaQueryTable/index.less +221 -221
- package/src/components/Business/BsSulaQueryTable/index.tsx +558 -558
- package/src/components/Business/BsSulaQueryTable/setting.tsx +854 -854
- package/src/components/Business/BsSulaQueryTable/utils.less +65 -65
- package/src/components/Business/BsSulaQueryTable/utils.tsx +690 -690
- package/src/components/Business/CommodityEntry/index.md +70 -70
- package/src/components/Business/CommodityEntry/index.tsx +80 -80
- package/src/components/Business/CommonAlert/index.tsx +23 -23
- package/src/components/Business/CommonGuideWrapper/index.less +111 -111
- package/src/components/Business/CommonGuideWrapper/index.md +39 -39
- package/src/components/Business/CommonGuideWrapper/index.tsx +83 -83
- package/src/components/Business/DetailPageWrapper/index.less +79 -79
- package/src/components/Business/DetailPageWrapper/index.tsx +315 -315
- package/src/components/Business/DetailPageWrapper/utils.tsx +100 -100
- package/src/components/Business/HomePageWrapper/index.less +33 -33
- package/src/components/Business/HomePageWrapper/index.md +45 -45
- package/src/components/Business/HomePageWrapper/index.tsx +162 -162
- package/src/components/Business/JsonQueryTable/components/FieldsModifyModal.tsx +824 -824
- package/src/components/Business/JsonQueryTable/components/FieldsSettingsTable.tsx +205 -205
- package/src/components/Business/JsonQueryTable/components/Formula.tsx +206 -206
- package/src/components/Business/JsonQueryTable/components/MaintainOptions.tsx +127 -127
- package/src/components/Business/JsonQueryTable/configButton/index.js +20 -20
- package/src/components/Business/JsonQueryTable/configTree/component/compactArrayView.js +25 -25
- package/src/components/Business/JsonQueryTable/configTree/component/compactObjectView.js +30 -30
- package/src/components/Business/JsonQueryTable/configTree/index.js +82 -82
- package/src/components/Business/JsonQueryTable/configTree/index.less +44 -44
- package/src/components/Business/JsonQueryTable/configTree/parser/highlight.js +57 -57
- package/src/components/Business/JsonQueryTable/configTree/parser/index.js +124 -124
- package/src/components/Business/JsonQueryTable/configTree/render/iconRender.js +29 -29
- package/src/components/Business/JsonQueryTable/configTree/render/nameRender.js +22 -22
- package/src/components/Business/JsonQueryTable/configTree/treeNode.js +116 -116
- package/src/components/Business/JsonQueryTable/drawer/index.tsx +12 -12
- package/src/components/Business/JsonQueryTable/function.ts +62 -62
- package/src/components/Business/JsonQueryTable/index.less +16 -16
- package/src/components/Business/JsonQueryTable/index.md +328 -328
- package/src/components/Business/JsonQueryTable/index.tsx +537 -537
- package/src/components/Business/JsonQueryTable/jsonEditor/index.js +346 -346
- package/src/components/Business/JsonQueryTable/jsonEditor/index.less +22 -22
- package/src/components/Business/JsonQueryTable/jsonEditor/lint/basicType.js +147 -147
- package/src/components/Business/JsonQueryTable/jsonEditor/lint/index.js +389 -389
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/actions.js +118 -118
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/dependency.js +22 -22
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/index.js +21 -21
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/request.js +65 -65
- package/src/components/Business/JsonQueryTable/static.ts +450 -450
- package/src/components/Business/SearchSelect/BusinessUtils.ts +2057 -2057
- package/src/components/Business/SearchSelect/common.ts +134 -134
- package/src/components/Business/SearchSelect/index.md +1444 -1444
- package/src/components/Business/SearchSelect/index.tsx +55 -55
- package/src/components/Business/SearchSelect/utils.ts +101 -101
- package/src/components/Business/StateFlow/index.less +130 -130
- package/src/components/Business/StateFlow/index.md +60 -60
- package/src/components/Business/StateFlow/index.tsx +29 -29
- package/src/components/Business/TreeSearchSelect/index.md +185 -185
- package/src/components/Business/TreeSearchSelect/index.tsx +33 -33
- package/src/components/Business/TreeSearchSelect/utils.ts +104 -104
- package/src/components/Business/columnSettingTable/columnSetting.tsx +766 -766
- package/src/components/Business/columnSettingTable/index.less +247 -247
- package/src/components/Business/columnSettingTable/index.md +357 -357
- package/src/components/Business/columnSettingTable/index.tsx +235 -234
- package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +243 -242
- package/src/components/Business/columnSettingTable/utils.tsx +71 -71
- package/src/components/Business/moreTreeTable/FixedScrollBar.tsx +87 -87
- package/src/components/Business/moreTreeTable/hooks/useSticky.ts +21 -21
- package/src/components/Business/moreTreeTable/index.less +99 -99
- package/src/components/Business/moreTreeTable/index.md +448 -448
- package/src/components/Business/moreTreeTable/index.tsx +387 -387
- package/src/components/Business/moreTreeTable/utils.ts +126 -126
- package/src/components/Functional/AddSelect/helps.ts +80 -80
- package/src/components/Functional/AddSelect/index.less +367 -367
- package/src/components/Functional/AddSelect/index.md +155 -155
- package/src/components/Functional/AddSelect/index.tsx +1171 -1171
- package/src/components/Functional/BillEntry/index.less +371 -371
- package/src/components/Functional/BillEntry/index.md +39 -39
- package/src/components/Functional/BillEntry/index.tsx +773 -773
- package/src/components/Functional/BsAntdSula/BsCascader/index.md +62 -62
- package/src/components/Functional/BsAntdSula/BsCascader/index.tsx +178 -178
- package/src/components/Functional/BsAntdSula/index.ts +2 -2
- package/src/components/Functional/DataImport/index.less +63 -63
- package/src/components/Functional/DataImport/index.md +44 -44
- package/src/components/Functional/DataImport/index.tsx +696 -696
- package/src/components/Functional/DataValidation/index.less +63 -63
- package/src/components/Functional/DataValidation/index.md +39 -39
- package/src/components/Functional/DataValidation/index.tsx +688 -688
- package/src/components/Functional/EllipsisTooltip/index.d.ts +5 -5
- package/src/components/Functional/EllipsisTooltip/index.js +36 -36
- package/src/components/Functional/EllipsisTooltip/index.md +30 -30
- package/src/components/Functional/ExportFunctions/ExportIcon/index.md +37 -37
- package/src/components/Functional/ExportFunctions/ExportIcon/index.tsx +60 -60
- package/src/components/Functional/QueryMutipleInput/index.less +37 -37
- package/src/components/Functional/QueryMutipleInput/index.md +33 -33
- package/src/components/Functional/QueryMutipleInput/index.tsx +128 -128
- package/src/components/Functional/SearchSelect/index.less +115 -115
- package/src/components/Functional/SearchSelect/index.md +141 -141
- package/src/components/Functional/SearchSelect/index.tsx +896 -896
- package/src/components/Functional/SearchSelect/utils.ts +3 -3
- package/src/components/Functional/TreeSearchSelect/index.md +47 -47
- package/src/components/Functional/TreeSearchSelect/index.tsx +204 -204
- package/src/components/Solution/RuleComponent/Formula.tsx +335 -335
- package/src/components/Solution/RuleComponent/InnerSelect.tsx +62 -62
- package/src/components/Solution/RuleComponent/index.d.ts +29 -29
- package/src/components/Solution/RuleComponent/index.js +2073 -2073
- package/src/components/Solution/RuleComponent/index.less +230 -230
- package/src/components/Solution/RuleComponent/renderSpecificAction.js +99 -99
- package/src/components/Solution/RuleComponent/ruleFiled.js +2281 -2281
- package/src/components/Solution/RuleComponent/services.ts +13 -13
- package/src/components/Solution/RuleComponent/util.js +143 -143
- package/src/index.ts +38 -38
- package/src/plugin/TableColumnSetting/index.less +247 -247
- package/src/plugin/TableColumnSetting/index.md +50 -50
- package/src/plugin/TableColumnSetting/index.tsx +725 -725
- package/src/plugin/TableColumnSetting/utils.ts +19 -19
- package/src/styles/bsDefault.less +1912 -1912
- package/src/utils/CheckOneUser/index.md +39 -39
- package/src/utils/CheckOneUser/index.ts +51 -51
- package/src/utils/CustomLoginInfo.ts +55 -55
- package/src/utils/LocalstorageUtils.ts +95 -95
- package/src/utils/TableUtils.tsx +18 -18
- package/src/utils/checkUtils.ts +39 -39
- package/src/utils/enumConfig.ts +11 -11
- package/src/utils/getFormMode.js +12 -12
- package/src/utils/index.ts +4 -4
- package/src/utils/requestUtils.ts +166 -166
- package/src/utils/serialize.js +7 -7
- package/src/utils/utils.ts +195 -195
- package/tsconfig.json +29 -29
- package/typings.d.ts +4 -4
|
@@ -1,725 +1,725 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { Table, message, Checkbox, Modal, Input, Button, Tooltip } from 'antd';
|
|
4
|
-
import axios from 'axios';
|
|
5
|
-
// import { request } from 'umi';
|
|
6
|
-
import {
|
|
7
|
-
SortableContainer,
|
|
8
|
-
SortableElement,
|
|
9
|
-
SortableHandle,
|
|
10
|
-
} from 'react-sortable-hoc';
|
|
11
|
-
import { MenuOutlined, SearchOutlined } from '@ant-design/icons';
|
|
12
|
-
import { arrayMoveImmutable } from 'array-move';
|
|
13
|
-
import { setConfigTableColumns, getConfigTableColumns } from '@/utils/LocalstorageUtils';
|
|
14
|
-
import shezhi from '../../assets/icon-shezhi.svg';
|
|
15
|
-
import close from '../../assets/close.svg';
|
|
16
|
-
import drag from '../../assets/drag.svg';
|
|
17
|
-
import fixedLeft from '../../assets/fixed-left.svg';
|
|
18
|
-
import fixedLeftActive from '../../assets/fixed-left-active.svg';
|
|
19
|
-
import fixedRight from '../../assets/fixed-right.svg';
|
|
20
|
-
import fixedRightActive from '../../assets/fixed-right-active.svg';
|
|
21
|
-
import './index.less';
|
|
22
|
-
import { handleRequestUrl, judgeIsRequestSuccess } from '@/utils/requestUtils';
|
|
23
|
-
|
|
24
|
-
interface TableColumnSettingProps {
|
|
25
|
-
/** tableCode必填,做用户存储关键key,*/
|
|
26
|
-
tableCode: string;
|
|
27
|
-
/** datasource必填,为要操作的表头(即原始表头),*/
|
|
28
|
-
datasource: any;
|
|
29
|
-
/** showColumns必填,为当前用户设置的表头,*/
|
|
30
|
-
showColumns: any;
|
|
31
|
-
/** setShowColumns必填,设置当前表头的方法,*/
|
|
32
|
-
setShowColumns: void;
|
|
33
|
-
/** settingImgAttribute非必填,设置当前设置img样式,*/
|
|
34
|
-
settingImgAttribute: {
|
|
35
|
-
[propName: string]: any;
|
|
36
|
-
};
|
|
37
|
-
[propName: string]: any;
|
|
38
|
-
}
|
|
39
|
-
const { Search } = Input;
|
|
40
|
-
|
|
41
|
-
const DragHandle = SortableHandle(() => <img src={drag} />);
|
|
42
|
-
|
|
43
|
-
const SortableItem = SortableElement((props: any) => <tr {...props} />);
|
|
44
|
-
const SortableBody = SortableContainer((props: any) => <tbody {...props} />);
|
|
45
|
-
|
|
46
|
-
class TableColumnSetting extends React.Component<TableColumnSettingProps> {
|
|
47
|
-
state = {
|
|
48
|
-
dataSource: [],
|
|
49
|
-
columns: [],
|
|
50
|
-
selectedRowKeys: [],
|
|
51
|
-
sortDataSource: [],
|
|
52
|
-
setVisible: false,
|
|
53
|
-
searchDataSource: false,
|
|
54
|
-
onSearchSort: false,
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
patchUserColumnConfig = (config: any) => {
|
|
58
|
-
const { tableCode, appRequestConfig }: any = this.props;
|
|
59
|
-
if (!tableCode) return;
|
|
60
|
-
let configvalue = config.map((item:any) => ({
|
|
61
|
-
key: item.key,
|
|
62
|
-
dataIndex: item.dataIndex,
|
|
63
|
-
width: item.width,
|
|
64
|
-
hidden: item.hidden,
|
|
65
|
-
fixed: item.fixed
|
|
66
|
-
}))
|
|
67
|
-
|
|
68
|
-
axios({
|
|
69
|
-
url: handleRequestUrl('/user','/appConfig/saveUserOrder',appRequestConfig),
|
|
70
|
-
method:'POST',
|
|
71
|
-
data: {
|
|
72
|
-
"code": tableCode,
|
|
73
|
-
"detail": JSON.stringify(configvalue)
|
|
74
|
-
},
|
|
75
|
-
}).then((res:any) => {
|
|
76
|
-
if (judgeIsRequestSuccess(res?.data)) {
|
|
77
|
-
setConfigTableColumns(configvalue, tableCode)
|
|
78
|
-
} else {
|
|
79
|
-
message.error('保存表头列自定义失败,请稍后尝试');
|
|
80
|
-
}
|
|
81
|
-
})
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
setInitValue = (datasource: any[]) => {
|
|
85
|
-
const { showColumns=[], tableCode } = this.props;
|
|
86
|
-
// 获取当前列表定义数据
|
|
87
|
-
let columnConfig = getConfigTableColumns(tableCode);
|
|
88
|
-
let initialDataSourceData = columnConfig.length ? datasource.map(item => {
|
|
89
|
-
let inner = columnConfig.filter((innerItem: any) => (
|
|
90
|
-
innerItem.dataIndex && innerItem.dataIndex === item.dataIndex
|
|
91
|
-
) || (innerItem.key && innerItem.key === item.key));
|
|
92
|
-
let showColumnItem = showColumns.filter((inneritem:any) => ((inneritem.dataIndex && inneritem.dataIndex === item.dataIndex) || (inneritem.key && inneritem.key === item.key)))
|
|
93
|
-
return {
|
|
94
|
-
...item,
|
|
95
|
-
fixed: inner.length ? inner[0]?.fixed : item?.fixed,
|
|
96
|
-
key: item.key || item.dataIndex,
|
|
97
|
-
width: showColumnItem[0]?.width || inner[0]?.width || item.width,
|
|
98
|
-
hidden: columnConfig.length && !inner.length,
|
|
99
|
-
}
|
|
100
|
-
})
|
|
101
|
-
: [...datasource]
|
|
102
|
-
this.setState({
|
|
103
|
-
dataSource: initialDataSourceData.map((item: any) => ({
|
|
104
|
-
...item,
|
|
105
|
-
key: item.key || item.dataIndex,
|
|
106
|
-
})),
|
|
107
|
-
sortDataSource: initialDataSourceData.filter((item: any) => !item.hidden)
|
|
108
|
-
.map((item: any) => ({
|
|
109
|
-
...item,
|
|
110
|
-
key: item.key || item.dataIndex,
|
|
111
|
-
})),
|
|
112
|
-
});
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
componentWillReceiveProps(nextProps: any) {
|
|
116
|
-
if (
|
|
117
|
-
this.props?.datasource &&
|
|
118
|
-
JSON.stringify(this.props?.datasource) !=
|
|
119
|
-
JSON.stringify(nextProps?.datasource)
|
|
120
|
-
) {
|
|
121
|
-
this.setInitValue(nextProps?.datasource || []);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
componentDidMount() {
|
|
126
|
-
const { datasource = [] }: any = this.props;
|
|
127
|
-
this.setInitValue(datasource);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
columns = [
|
|
131
|
-
{
|
|
132
|
-
title: '列名称',
|
|
133
|
-
dataIndex: 'title',
|
|
134
|
-
className: 'drag-visible',
|
|
135
|
-
width: 100,
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
title: '列首',
|
|
139
|
-
dataIndex: 'fixedLeft',
|
|
140
|
-
render: (text, record) => {
|
|
141
|
-
return (
|
|
142
|
-
<span
|
|
143
|
-
onClick={() => {
|
|
144
|
-
const { sortDataSource } = this.state;
|
|
145
|
-
if (record?.fixed !== 'left') {
|
|
146
|
-
let newSortData = sortDataSource.map((item) => {
|
|
147
|
-
if (item.title === record.title) {
|
|
148
|
-
return {
|
|
149
|
-
...item,
|
|
150
|
-
fixed: 'left',
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
return item;
|
|
154
|
-
});
|
|
155
|
-
this.setState({
|
|
156
|
-
sortDataSource: [
|
|
157
|
-
...newSortData.filter((item) => item.fixed === 'left'),
|
|
158
|
-
...newSortData.filter((item) => !item.fixed),
|
|
159
|
-
...newSortData.filter((item) => item.fixed === 'right'),
|
|
160
|
-
],
|
|
161
|
-
dataSource: [
|
|
162
|
-
...this.state.dataSource.map((item) => {
|
|
163
|
-
if (item.title === record.title) {
|
|
164
|
-
return {
|
|
165
|
-
...item,
|
|
166
|
-
fixed: 'left',
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
return item;
|
|
170
|
-
}),
|
|
171
|
-
],
|
|
172
|
-
});
|
|
173
|
-
} else {
|
|
174
|
-
let newSortData = sortDataSource.map((item) => {
|
|
175
|
-
if (item.title === record.title) {
|
|
176
|
-
return {
|
|
177
|
-
...item,
|
|
178
|
-
fixed: null,
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
return item;
|
|
182
|
-
});
|
|
183
|
-
this.setState({
|
|
184
|
-
sortDataSource: [
|
|
185
|
-
...newSortData.filter((item) => item.fixed === 'left'),
|
|
186
|
-
...newSortData.filter((item) => !item.fixed),
|
|
187
|
-
...newSortData.filter((item) => item.fixed === 'right'),
|
|
188
|
-
],
|
|
189
|
-
dataSource: [
|
|
190
|
-
...this.state.dataSource.map((item) => {
|
|
191
|
-
if (item.title === record.title) {
|
|
192
|
-
return {
|
|
193
|
-
...item,
|
|
194
|
-
fixed: null,
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
return item;
|
|
198
|
-
}),
|
|
199
|
-
],
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
}}
|
|
203
|
-
>
|
|
204
|
-
<Tooltip
|
|
205
|
-
placement="top"
|
|
206
|
-
title={record?.fixed === 'left' ? '取消固定' : '固定列首'}
|
|
207
|
-
>
|
|
208
|
-
<img
|
|
209
|
-
src={record?.fixed === 'left' ? fixedLeftActive : fixedLeft}
|
|
210
|
-
/>
|
|
211
|
-
</Tooltip>
|
|
212
|
-
</span>
|
|
213
|
-
);
|
|
214
|
-
},
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
title: '列尾',
|
|
218
|
-
dataIndex: 'fixedRight',
|
|
219
|
-
render: (text, record) => {
|
|
220
|
-
return (
|
|
221
|
-
<span
|
|
222
|
-
onClick={() => {
|
|
223
|
-
const { sortDataSource } = this.state;
|
|
224
|
-
if (record?.fixed !== 'right') {
|
|
225
|
-
let newSortData = sortDataSource.map((item) => {
|
|
226
|
-
if (item.title === record.title) {
|
|
227
|
-
return {
|
|
228
|
-
...item,
|
|
229
|
-
fixed: 'right',
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
return item;
|
|
233
|
-
});
|
|
234
|
-
this.setState({
|
|
235
|
-
sortDataSource: [
|
|
236
|
-
...newSortData.filter((item) => item.fixed === 'left'),
|
|
237
|
-
...newSortData.filter((item) => !item.fixed),
|
|
238
|
-
...newSortData.filter((item) => item.fixed === 'right'),
|
|
239
|
-
],
|
|
240
|
-
dataSource: [
|
|
241
|
-
...this.state.dataSource.map((item) => {
|
|
242
|
-
if (item.title === record.title) {
|
|
243
|
-
return {
|
|
244
|
-
...item,
|
|
245
|
-
fixed: 'right',
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
return item;
|
|
249
|
-
}),
|
|
250
|
-
],
|
|
251
|
-
});
|
|
252
|
-
} else {
|
|
253
|
-
let newSortData = sortDataSource.map((item) => {
|
|
254
|
-
if (item.title === record.title) {
|
|
255
|
-
return {
|
|
256
|
-
...item,
|
|
257
|
-
fixed: null,
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
return item;
|
|
261
|
-
});
|
|
262
|
-
this.setState({
|
|
263
|
-
sortDataSource: [
|
|
264
|
-
...newSortData.filter((item) => item.fixed === 'left'),
|
|
265
|
-
...newSortData.filter((item) => !item.fixed),
|
|
266
|
-
...newSortData.filter((item) => item.fixed === 'right'),
|
|
267
|
-
],
|
|
268
|
-
dataSource: [
|
|
269
|
-
...this.state.dataSource.map((item) => {
|
|
270
|
-
if (item.title === record.title) {
|
|
271
|
-
return {
|
|
272
|
-
...item,
|
|
273
|
-
fixed: null,
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
return item;
|
|
277
|
-
}),
|
|
278
|
-
],
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
}}
|
|
282
|
-
>
|
|
283
|
-
<Tooltip
|
|
284
|
-
placement="top"
|
|
285
|
-
title={record?.fixed === 'right' ? '取消固定' : '固定列尾'}
|
|
286
|
-
>
|
|
287
|
-
<img
|
|
288
|
-
src={record?.fixed === 'right' ? fixedRightActive : fixedRight}
|
|
289
|
-
/>
|
|
290
|
-
</Tooltip>
|
|
291
|
-
</span>
|
|
292
|
-
);
|
|
293
|
-
},
|
|
294
|
-
},
|
|
295
|
-
{
|
|
296
|
-
title: '删除',
|
|
297
|
-
dataIndex: 'title1',
|
|
298
|
-
render: (text: any, record: any) => {
|
|
299
|
-
return (
|
|
300
|
-
<span
|
|
301
|
-
onClick={() => {
|
|
302
|
-
this.setState({
|
|
303
|
-
sortDataSource: this.state.sortDataSource.filter((item:any) => {
|
|
304
|
-
return item.title !== record.title;
|
|
305
|
-
}),
|
|
306
|
-
dataSource: [
|
|
307
|
-
...this.state.dataSource.map((item:any) => {
|
|
308
|
-
if (item.title === record.title) {
|
|
309
|
-
return {
|
|
310
|
-
...item,
|
|
311
|
-
hidden: true,
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
return item;
|
|
316
|
-
}),
|
|
317
|
-
],
|
|
318
|
-
});
|
|
319
|
-
}}
|
|
320
|
-
>
|
|
321
|
-
<img src={close} />
|
|
322
|
-
</span>
|
|
323
|
-
);
|
|
324
|
-
},
|
|
325
|
-
},
|
|
326
|
-
{
|
|
327
|
-
title: 'Sort',
|
|
328
|
-
dataIndex: 'sort',
|
|
329
|
-
className: 'drag-visible',
|
|
330
|
-
render: () => <DragHandle />,
|
|
331
|
-
},
|
|
332
|
-
];
|
|
333
|
-
|
|
334
|
-
showModal = () => {
|
|
335
|
-
const { datasource = [] }: any = this.props;
|
|
336
|
-
this.setState({
|
|
337
|
-
visible: true,
|
|
338
|
-
});
|
|
339
|
-
this.setInitValue(datasource);
|
|
340
|
-
};
|
|
341
|
-
|
|
342
|
-
handleOk = (e?: React.MouseEvent<HTMLElement>) => {
|
|
343
|
-
const { sortDataSource }: any = this.state;
|
|
344
|
-
const { setShowColumns }: any = this.props;
|
|
345
|
-
if (!sortDataSource.length) {
|
|
346
|
-
message.warning('至少选择一列!')
|
|
347
|
-
return;
|
|
348
|
-
}
|
|
349
|
-
this.setState({
|
|
350
|
-
visible: false,
|
|
351
|
-
});
|
|
352
|
-
setShowColumns([...sortDataSource]);
|
|
353
|
-
this.patchUserColumnConfig(sortDataSource)
|
|
354
|
-
};
|
|
355
|
-
|
|
356
|
-
handleCancel = (e: React.MouseEvent<HTMLElement>) => {
|
|
357
|
-
this.setState({
|
|
358
|
-
visible: false,
|
|
359
|
-
});
|
|
360
|
-
};
|
|
361
|
-
|
|
362
|
-
handleTableHeadHidden = (title: string) => {
|
|
363
|
-
const { sortDataSource, dataSource } = this.state;
|
|
364
|
-
this.setState(
|
|
365
|
-
{
|
|
366
|
-
sortDataSource: sortDataSource.filter((item: any) => {
|
|
367
|
-
return item.title !== title;
|
|
368
|
-
}),
|
|
369
|
-
dataSource: [
|
|
370
|
-
...dataSource.map((item:any) => {
|
|
371
|
-
if (item.title === title) {
|
|
372
|
-
return {
|
|
373
|
-
...item,
|
|
374
|
-
hidden: true,
|
|
375
|
-
};
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
return item;
|
|
379
|
-
}),
|
|
380
|
-
],
|
|
381
|
-
},
|
|
382
|
-
() => {
|
|
383
|
-
this.handleOk();
|
|
384
|
-
},
|
|
385
|
-
);
|
|
386
|
-
};
|
|
387
|
-
|
|
388
|
-
onSortEnd = ({ oldIndex, newIndex }: any) => {
|
|
389
|
-
const { sortDataSource } = this.state;
|
|
390
|
-
const { value, setValue }: any = this.props;
|
|
391
|
-
// if (sortDataSource[oldIndex]['fixed']) {
|
|
392
|
-
// message.warning('固定列不可移动');
|
|
393
|
-
// return;
|
|
394
|
-
// }
|
|
395
|
-
if (oldIndex !== newIndex) {
|
|
396
|
-
const newData = arrayMoveImmutable(
|
|
397
|
-
[].concat(sortDataSource),
|
|
398
|
-
oldIndex,
|
|
399
|
-
newIndex,
|
|
400
|
-
).filter((el) => !!el);
|
|
401
|
-
this.setState({
|
|
402
|
-
sortDataSource: [
|
|
403
|
-
...newData.filter((item) => item.fixed === 'left'),
|
|
404
|
-
...newData.filter((item) => !item.fixed),
|
|
405
|
-
...newData.filter((item) => item.fixed === 'right'),
|
|
406
|
-
],
|
|
407
|
-
});
|
|
408
|
-
}
|
|
409
|
-
};
|
|
410
|
-
|
|
411
|
-
DraggableContainer = (props: any) => (
|
|
412
|
-
<SortableBody
|
|
413
|
-
useDragHandle
|
|
414
|
-
disableAutoscroll
|
|
415
|
-
helperClass="row-dragging"
|
|
416
|
-
onSortEnd={this.onSortEnd}
|
|
417
|
-
{...props}
|
|
418
|
-
/>
|
|
419
|
-
);
|
|
420
|
-
|
|
421
|
-
DraggableBodyRow = ({ className, style, ...restProps }: any) => {
|
|
422
|
-
const { sortDataSource } = this.state;
|
|
423
|
-
// function findIndex base on Table rowKey props and should always be a right array index
|
|
424
|
-
const index = sortDataSource.findIndex(
|
|
425
|
-
(x:any) => x.key === restProps['data-row-key'],
|
|
426
|
-
);
|
|
427
|
-
return <SortableItem index={index} {...restProps} />;
|
|
428
|
-
};
|
|
429
|
-
|
|
430
|
-
onChange = (e: any, title: any) => {
|
|
431
|
-
const { sortDataSource, dataSource } = this.state;
|
|
432
|
-
if (!e.target.checked) {
|
|
433
|
-
this.setState({
|
|
434
|
-
sortDataSource: sortDataSource.filter((item: any) => {
|
|
435
|
-
return item.title !== title;
|
|
436
|
-
}),
|
|
437
|
-
dataSource: [
|
|
438
|
-
...dataSource.map((item: any) => {
|
|
439
|
-
if (item.title === title) {
|
|
440
|
-
return {
|
|
441
|
-
...item,
|
|
442
|
-
hidden: true,
|
|
443
|
-
};
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
return item;
|
|
447
|
-
}),
|
|
448
|
-
],
|
|
449
|
-
});
|
|
450
|
-
} else {
|
|
451
|
-
let fixedLeft: any[] = [];
|
|
452
|
-
let fixedRight: any[] = [];
|
|
453
|
-
let noFixedSortSource: any = [];
|
|
454
|
-
sortDataSource.forEach((item: any) => {
|
|
455
|
-
if (item?.fixed === 'left') {
|
|
456
|
-
fixedLeft.push(item);
|
|
457
|
-
} else if (item?.fixed === 'right') {
|
|
458
|
-
fixedRight.push(item);
|
|
459
|
-
} else {
|
|
460
|
-
noFixedSortSource.push(item);
|
|
461
|
-
}
|
|
462
|
-
});
|
|
463
|
-
this.setState({
|
|
464
|
-
sortDataSource: [
|
|
465
|
-
...fixedLeft,
|
|
466
|
-
...noFixedSortSource,
|
|
467
|
-
...dataSource
|
|
468
|
-
.filter((item: any) => item.title === title)
|
|
469
|
-
.map((source: any) => {
|
|
470
|
-
return {
|
|
471
|
-
...source,
|
|
472
|
-
hidden: false,
|
|
473
|
-
};
|
|
474
|
-
}),
|
|
475
|
-
...fixedRight,
|
|
476
|
-
],
|
|
477
|
-
dataSource: [
|
|
478
|
-
...dataSource.map((item: any) => {
|
|
479
|
-
if (item.title === title) {
|
|
480
|
-
return {
|
|
481
|
-
...item,
|
|
482
|
-
hidden: false,
|
|
483
|
-
};
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
return item;
|
|
487
|
-
}),
|
|
488
|
-
],
|
|
489
|
-
});
|
|
490
|
-
}
|
|
491
|
-
};
|
|
492
|
-
|
|
493
|
-
handleReset = () => {
|
|
494
|
-
const { datasource = [] }: any = this.props;
|
|
495
|
-
this.setInitValue(datasource);
|
|
496
|
-
};
|
|
497
|
-
|
|
498
|
-
onSearch = (e: any) => {
|
|
499
|
-
this.setState({
|
|
500
|
-
searchDataSource: e.target.value,
|
|
501
|
-
});
|
|
502
|
-
};
|
|
503
|
-
|
|
504
|
-
onSearchSort = (e: any) => {
|
|
505
|
-
this.setState({
|
|
506
|
-
onSearchSort: e.target.value,
|
|
507
|
-
});
|
|
508
|
-
};
|
|
509
|
-
|
|
510
|
-
render() {
|
|
511
|
-
const {
|
|
512
|
-
dataSource,
|
|
513
|
-
searchDataSource,
|
|
514
|
-
sortDataSource,
|
|
515
|
-
visible,
|
|
516
|
-
onSearchSort,
|
|
517
|
-
}: any = this.state;
|
|
518
|
-
const { settingImgAttribute={} } = this.props;
|
|
519
|
-
const settingImgAttributeProps={width: 32,...settingImgAttribute};
|
|
520
|
-
|
|
521
|
-
let seatchDataSource = dataSource.filter(
|
|
522
|
-
(item: any) => item?.title?.indexOf(searchDataSource || '') > -1,
|
|
523
|
-
);
|
|
524
|
-
|
|
525
|
-
return (
|
|
526
|
-
<div className={'sort_table_wrapper'}>
|
|
527
|
-
<Modal
|
|
528
|
-
title="设置表头内容"
|
|
529
|
-
wrapClassName={'sort_table_wrapper'}
|
|
530
|
-
width={820}
|
|
531
|
-
visible={visible}
|
|
532
|
-
onOk={this.handleOk}
|
|
533
|
-
onCancel={this.handleCancel}
|
|
534
|
-
footer={[
|
|
535
|
-
<Button key="back" onClick={this.handleReset}>
|
|
536
|
-
恢复默认
|
|
537
|
-
</Button>,
|
|
538
|
-
<Button key="submit" onClick={this.handleOk}>
|
|
539
|
-
取消
|
|
540
|
-
</Button>,
|
|
541
|
-
<Button key="submit" type="primary" onClick={this.handleOk}>
|
|
542
|
-
确认
|
|
543
|
-
</Button>,
|
|
544
|
-
]}
|
|
545
|
-
>
|
|
546
|
-
<div className={'sort_table'}>
|
|
547
|
-
<div className={'sort_table_column_wrapper'}>
|
|
548
|
-
<span className={'sort_table_column_count'}>
|
|
549
|
-
可选字段 <span>(共{dataSource.length}个)</span>
|
|
550
|
-
</span>
|
|
551
|
-
<div className={'sort_table_column'}>
|
|
552
|
-
<Input
|
|
553
|
-
prefix={<SearchOutlined className="site-form-item-icon" />}
|
|
554
|
-
placeholder="搜索"
|
|
555
|
-
allowClear
|
|
556
|
-
onChange={this.onSearch}
|
|
557
|
-
style={{ width: 540 }}
|
|
558
|
-
/>
|
|
559
|
-
<div>
|
|
560
|
-
{!searchDataSource && (
|
|
561
|
-
<Checkbox
|
|
562
|
-
checked={
|
|
563
|
-
!dataSource.some((item: any) => {
|
|
564
|
-
if (item.hidden) return true;
|
|
565
|
-
|
|
566
|
-
return false;
|
|
567
|
-
})
|
|
568
|
-
}
|
|
569
|
-
onClick={(e:any) => {
|
|
570
|
-
this.setState({
|
|
571
|
-
dataSource: [
|
|
572
|
-
...dataSource.map((item: any) => {
|
|
573
|
-
return {
|
|
574
|
-
...item,
|
|
575
|
-
hidden: !e.target.checked,
|
|
576
|
-
};
|
|
577
|
-
}),
|
|
578
|
-
],
|
|
579
|
-
sortDataSource: e.target.checked
|
|
580
|
-
? [
|
|
581
|
-
...dataSource.map((item: any) => {
|
|
582
|
-
return {
|
|
583
|
-
...item,
|
|
584
|
-
hidden: false,
|
|
585
|
-
};
|
|
586
|
-
}),
|
|
587
|
-
]
|
|
588
|
-
: [],
|
|
589
|
-
});
|
|
590
|
-
}}
|
|
591
|
-
>
|
|
592
|
-
全选
|
|
593
|
-
</Checkbox>
|
|
594
|
-
)}
|
|
595
|
-
</div>
|
|
596
|
-
<div className={'sort_table_column_all'}>
|
|
597
|
-
{searchDataSource
|
|
598
|
-
? seatchDataSource.map((item: any) => {
|
|
599
|
-
return (
|
|
600
|
-
<Checkbox
|
|
601
|
-
checked={!item.hidden}
|
|
602
|
-
onChange={(e) => {
|
|
603
|
-
this.onChange(e, item.title);
|
|
604
|
-
}}
|
|
605
|
-
>
|
|
606
|
-
{item.title}
|
|
607
|
-
</Checkbox>
|
|
608
|
-
);
|
|
609
|
-
})
|
|
610
|
-
: dataSource
|
|
611
|
-
.filter(
|
|
612
|
-
(item: any) =>
|
|
613
|
-
item?.title?.indexOf('人') === -1 &&
|
|
614
|
-
item?.title?.indexOf('日期') === -1,
|
|
615
|
-
)
|
|
616
|
-
.map((item: any) => {
|
|
617
|
-
return (
|
|
618
|
-
<Checkbox
|
|
619
|
-
checked={!item.hidden}
|
|
620
|
-
onChange={(e) => {
|
|
621
|
-
this.onChange(e, item.title);
|
|
622
|
-
}}
|
|
623
|
-
>
|
|
624
|
-
{item.title}
|
|
625
|
-
</Checkbox>
|
|
626
|
-
);
|
|
627
|
-
})}
|
|
628
|
-
{!!seatchDataSource.length && (
|
|
629
|
-
<span style={{ width: '144px' }}></span>
|
|
630
|
-
)}
|
|
631
|
-
|
|
632
|
-
{!seatchDataSource.length && (
|
|
633
|
-
<div className={'sort_table_column_all_empty'}>
|
|
634
|
-
未查询到结果
|
|
635
|
-
</div>
|
|
636
|
-
)}
|
|
637
|
-
</div>
|
|
638
|
-
{!searchDataSource && (
|
|
639
|
-
<div>
|
|
640
|
-
<div className={'sort_table_column_special'}>
|
|
641
|
-
<span>人员时间字段</span>
|
|
642
|
-
</div>
|
|
643
|
-
<div className={'sort_table_column_all'}>
|
|
644
|
-
{[...dataSource]
|
|
645
|
-
.filter(
|
|
646
|
-
(item) =>
|
|
647
|
-
item?.title?.indexOf('人') > -1 ||
|
|
648
|
-
item?.title?.indexOf('日期') > -1,
|
|
649
|
-
)
|
|
650
|
-
.map((item) => {
|
|
651
|
-
return (
|
|
652
|
-
<Checkbox
|
|
653
|
-
checked={!item.hidden}
|
|
654
|
-
onChange={(e) => {
|
|
655
|
-
this.onChange(e, item.title);
|
|
656
|
-
}}
|
|
657
|
-
>
|
|
658
|
-
{item.title}
|
|
659
|
-
</Checkbox>
|
|
660
|
-
);
|
|
661
|
-
})}
|
|
662
|
-
<span style={{ width: '144px' }}></span>
|
|
663
|
-
</div>
|
|
664
|
-
</div>
|
|
665
|
-
)}
|
|
666
|
-
|
|
667
|
-
{/* <Checkbox.Group
|
|
668
|
-
options={dataSource.map(item => {
|
|
669
|
-
return {
|
|
670
|
-
label: item.title,
|
|
671
|
-
value: item.title,
|
|
672
|
-
}
|
|
673
|
-
})}
|
|
674
|
-
defaultValue={selectedRowKeys}
|
|
675
|
-
onChange={() => {}}
|
|
676
|
-
/> */}
|
|
677
|
-
</div>
|
|
678
|
-
</div>
|
|
679
|
-
<div className={'sort_table_content_wrapper'}>
|
|
680
|
-
<span className={'sort_table_content_count'}>
|
|
681
|
-
已选字段 <span>(共{sortDataSource.length}个)</span>
|
|
682
|
-
</span>
|
|
683
|
-
<div className={'sort_table_content'}>
|
|
684
|
-
<span style={{ paddingLeft: '10px' }}>
|
|
685
|
-
<Input
|
|
686
|
-
prefix={<SearchOutlined className="site-form-item-icon" />}
|
|
687
|
-
placeholder="搜索"
|
|
688
|
-
allowClear
|
|
689
|
-
onChange={this.onSearchSort}
|
|
690
|
-
style={{ width: 190 }}
|
|
691
|
-
/>
|
|
692
|
-
</span>
|
|
693
|
-
<Table
|
|
694
|
-
pagination={false}
|
|
695
|
-
showHeader={false}
|
|
696
|
-
dataSource={
|
|
697
|
-
onSearchSort
|
|
698
|
-
? sortDataSource.filter(
|
|
699
|
-
(item:any) => item?.title?.indexOf(onSearchSort) > -1,
|
|
700
|
-
)
|
|
701
|
-
: sortDataSource
|
|
702
|
-
}
|
|
703
|
-
columns={this.columns}
|
|
704
|
-
rowKey="key"
|
|
705
|
-
// rowSelection={rowSelection}
|
|
706
|
-
components={{
|
|
707
|
-
body: {
|
|
708
|
-
wrapper: this.DraggableContainer,
|
|
709
|
-
row: this.DraggableBodyRow,
|
|
710
|
-
},
|
|
711
|
-
}}
|
|
712
|
-
/>
|
|
713
|
-
</div>
|
|
714
|
-
</div>
|
|
715
|
-
</div>
|
|
716
|
-
</Modal>
|
|
717
|
-
<Tooltip title="列设置">
|
|
718
|
-
<img {...settingImgAttributeProps} onClick={this.showModal} src={shezhi} />
|
|
719
|
-
</Tooltip>
|
|
720
|
-
</div>
|
|
721
|
-
);
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
export default TableColumnSetting;
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Table, message, Checkbox, Modal, Input, Button, Tooltip } from 'antd';
|
|
4
|
+
import axios from 'axios';
|
|
5
|
+
// import { request } from 'umi';
|
|
6
|
+
import {
|
|
7
|
+
SortableContainer,
|
|
8
|
+
SortableElement,
|
|
9
|
+
SortableHandle,
|
|
10
|
+
} from 'react-sortable-hoc';
|
|
11
|
+
import { MenuOutlined, SearchOutlined } from '@ant-design/icons';
|
|
12
|
+
import { arrayMoveImmutable } from 'array-move';
|
|
13
|
+
import { setConfigTableColumns, getConfigTableColumns } from '@/utils/LocalstorageUtils';
|
|
14
|
+
import shezhi from '../../assets/icon-shezhi.svg';
|
|
15
|
+
import close from '../../assets/close.svg';
|
|
16
|
+
import drag from '../../assets/drag.svg';
|
|
17
|
+
import fixedLeft from '../../assets/fixed-left.svg';
|
|
18
|
+
import fixedLeftActive from '../../assets/fixed-left-active.svg';
|
|
19
|
+
import fixedRight from '../../assets/fixed-right.svg';
|
|
20
|
+
import fixedRightActive from '../../assets/fixed-right-active.svg';
|
|
21
|
+
import './index.less';
|
|
22
|
+
import { handleRequestUrl, judgeIsRequestSuccess } from '@/utils/requestUtils';
|
|
23
|
+
|
|
24
|
+
interface TableColumnSettingProps {
|
|
25
|
+
/** tableCode必填,做用户存储关键key,*/
|
|
26
|
+
tableCode: string;
|
|
27
|
+
/** datasource必填,为要操作的表头(即原始表头),*/
|
|
28
|
+
datasource: any;
|
|
29
|
+
/** showColumns必填,为当前用户设置的表头,*/
|
|
30
|
+
showColumns: any;
|
|
31
|
+
/** setShowColumns必填,设置当前表头的方法,*/
|
|
32
|
+
setShowColumns: void;
|
|
33
|
+
/** settingImgAttribute非必填,设置当前设置img样式,*/
|
|
34
|
+
settingImgAttribute: {
|
|
35
|
+
[propName: string]: any;
|
|
36
|
+
};
|
|
37
|
+
[propName: string]: any;
|
|
38
|
+
}
|
|
39
|
+
const { Search } = Input;
|
|
40
|
+
|
|
41
|
+
const DragHandle = SortableHandle(() => <img src={drag} />);
|
|
42
|
+
|
|
43
|
+
const SortableItem = SortableElement((props: any) => <tr {...props} />);
|
|
44
|
+
const SortableBody = SortableContainer((props: any) => <tbody {...props} />);
|
|
45
|
+
|
|
46
|
+
class TableColumnSetting extends React.Component<TableColumnSettingProps> {
|
|
47
|
+
state = {
|
|
48
|
+
dataSource: [],
|
|
49
|
+
columns: [],
|
|
50
|
+
selectedRowKeys: [],
|
|
51
|
+
sortDataSource: [],
|
|
52
|
+
setVisible: false,
|
|
53
|
+
searchDataSource: false,
|
|
54
|
+
onSearchSort: false,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
patchUserColumnConfig = (config: any) => {
|
|
58
|
+
const { tableCode, appRequestConfig }: any = this.props;
|
|
59
|
+
if (!tableCode) return;
|
|
60
|
+
let configvalue = config.map((item:any) => ({
|
|
61
|
+
key: item.key,
|
|
62
|
+
dataIndex: item.dataIndex,
|
|
63
|
+
width: item.width,
|
|
64
|
+
hidden: item.hidden,
|
|
65
|
+
fixed: item.fixed
|
|
66
|
+
}))
|
|
67
|
+
|
|
68
|
+
axios({
|
|
69
|
+
url: handleRequestUrl('/user','/appConfig/saveUserOrder',appRequestConfig),
|
|
70
|
+
method:'POST',
|
|
71
|
+
data: {
|
|
72
|
+
"code": tableCode,
|
|
73
|
+
"detail": JSON.stringify(configvalue)
|
|
74
|
+
},
|
|
75
|
+
}).then((res:any) => {
|
|
76
|
+
if (judgeIsRequestSuccess(res?.data)) {
|
|
77
|
+
setConfigTableColumns(configvalue, tableCode)
|
|
78
|
+
} else {
|
|
79
|
+
message.error('保存表头列自定义失败,请稍后尝试');
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
setInitValue = (datasource: any[]) => {
|
|
85
|
+
const { showColumns=[], tableCode } = this.props;
|
|
86
|
+
// 获取当前列表定义数据
|
|
87
|
+
let columnConfig = getConfigTableColumns(tableCode);
|
|
88
|
+
let initialDataSourceData = columnConfig.length ? datasource.map(item => {
|
|
89
|
+
let inner = columnConfig.filter((innerItem: any) => (
|
|
90
|
+
innerItem.dataIndex && innerItem.dataIndex === item.dataIndex
|
|
91
|
+
) || (innerItem.key && innerItem.key === item.key));
|
|
92
|
+
let showColumnItem = showColumns.filter((inneritem:any) => ((inneritem.dataIndex && inneritem.dataIndex === item.dataIndex) || (inneritem.key && inneritem.key === item.key)))
|
|
93
|
+
return {
|
|
94
|
+
...item,
|
|
95
|
+
fixed: inner.length ? inner[0]?.fixed : item?.fixed,
|
|
96
|
+
key: item.key || item.dataIndex,
|
|
97
|
+
width: showColumnItem[0]?.width || inner[0]?.width || item.width,
|
|
98
|
+
hidden: columnConfig.length && !inner.length,
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
: [...datasource]
|
|
102
|
+
this.setState({
|
|
103
|
+
dataSource: initialDataSourceData.map((item: any) => ({
|
|
104
|
+
...item,
|
|
105
|
+
key: item.key || item.dataIndex,
|
|
106
|
+
})),
|
|
107
|
+
sortDataSource: initialDataSourceData.filter((item: any) => !item.hidden)
|
|
108
|
+
.map((item: any) => ({
|
|
109
|
+
...item,
|
|
110
|
+
key: item.key || item.dataIndex,
|
|
111
|
+
})),
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
componentWillReceiveProps(nextProps: any) {
|
|
116
|
+
if (
|
|
117
|
+
this.props?.datasource &&
|
|
118
|
+
JSON.stringify(this.props?.datasource) !=
|
|
119
|
+
JSON.stringify(nextProps?.datasource)
|
|
120
|
+
) {
|
|
121
|
+
this.setInitValue(nextProps?.datasource || []);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
componentDidMount() {
|
|
126
|
+
const { datasource = [] }: any = this.props;
|
|
127
|
+
this.setInitValue(datasource);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
columns = [
|
|
131
|
+
{
|
|
132
|
+
title: '列名称',
|
|
133
|
+
dataIndex: 'title',
|
|
134
|
+
className: 'drag-visible',
|
|
135
|
+
width: 100,
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
title: '列首',
|
|
139
|
+
dataIndex: 'fixedLeft',
|
|
140
|
+
render: (text, record) => {
|
|
141
|
+
return (
|
|
142
|
+
<span
|
|
143
|
+
onClick={() => {
|
|
144
|
+
const { sortDataSource } = this.state;
|
|
145
|
+
if (record?.fixed !== 'left') {
|
|
146
|
+
let newSortData = sortDataSource.map((item) => {
|
|
147
|
+
if (item.title === record.title) {
|
|
148
|
+
return {
|
|
149
|
+
...item,
|
|
150
|
+
fixed: 'left',
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
return item;
|
|
154
|
+
});
|
|
155
|
+
this.setState({
|
|
156
|
+
sortDataSource: [
|
|
157
|
+
...newSortData.filter((item) => item.fixed === 'left'),
|
|
158
|
+
...newSortData.filter((item) => !item.fixed),
|
|
159
|
+
...newSortData.filter((item) => item.fixed === 'right'),
|
|
160
|
+
],
|
|
161
|
+
dataSource: [
|
|
162
|
+
...this.state.dataSource.map((item) => {
|
|
163
|
+
if (item.title === record.title) {
|
|
164
|
+
return {
|
|
165
|
+
...item,
|
|
166
|
+
fixed: 'left',
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
return item;
|
|
170
|
+
}),
|
|
171
|
+
],
|
|
172
|
+
});
|
|
173
|
+
} else {
|
|
174
|
+
let newSortData = sortDataSource.map((item) => {
|
|
175
|
+
if (item.title === record.title) {
|
|
176
|
+
return {
|
|
177
|
+
...item,
|
|
178
|
+
fixed: null,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
return item;
|
|
182
|
+
});
|
|
183
|
+
this.setState({
|
|
184
|
+
sortDataSource: [
|
|
185
|
+
...newSortData.filter((item) => item.fixed === 'left'),
|
|
186
|
+
...newSortData.filter((item) => !item.fixed),
|
|
187
|
+
...newSortData.filter((item) => item.fixed === 'right'),
|
|
188
|
+
],
|
|
189
|
+
dataSource: [
|
|
190
|
+
...this.state.dataSource.map((item) => {
|
|
191
|
+
if (item.title === record.title) {
|
|
192
|
+
return {
|
|
193
|
+
...item,
|
|
194
|
+
fixed: null,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
return item;
|
|
198
|
+
}),
|
|
199
|
+
],
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
}}
|
|
203
|
+
>
|
|
204
|
+
<Tooltip
|
|
205
|
+
placement="top"
|
|
206
|
+
title={record?.fixed === 'left' ? '取消固定' : '固定列首'}
|
|
207
|
+
>
|
|
208
|
+
<img
|
|
209
|
+
src={record?.fixed === 'left' ? fixedLeftActive : fixedLeft}
|
|
210
|
+
/>
|
|
211
|
+
</Tooltip>
|
|
212
|
+
</span>
|
|
213
|
+
);
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
title: '列尾',
|
|
218
|
+
dataIndex: 'fixedRight',
|
|
219
|
+
render: (text, record) => {
|
|
220
|
+
return (
|
|
221
|
+
<span
|
|
222
|
+
onClick={() => {
|
|
223
|
+
const { sortDataSource } = this.state;
|
|
224
|
+
if (record?.fixed !== 'right') {
|
|
225
|
+
let newSortData = sortDataSource.map((item) => {
|
|
226
|
+
if (item.title === record.title) {
|
|
227
|
+
return {
|
|
228
|
+
...item,
|
|
229
|
+
fixed: 'right',
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
return item;
|
|
233
|
+
});
|
|
234
|
+
this.setState({
|
|
235
|
+
sortDataSource: [
|
|
236
|
+
...newSortData.filter((item) => item.fixed === 'left'),
|
|
237
|
+
...newSortData.filter((item) => !item.fixed),
|
|
238
|
+
...newSortData.filter((item) => item.fixed === 'right'),
|
|
239
|
+
],
|
|
240
|
+
dataSource: [
|
|
241
|
+
...this.state.dataSource.map((item) => {
|
|
242
|
+
if (item.title === record.title) {
|
|
243
|
+
return {
|
|
244
|
+
...item,
|
|
245
|
+
fixed: 'right',
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
return item;
|
|
249
|
+
}),
|
|
250
|
+
],
|
|
251
|
+
});
|
|
252
|
+
} else {
|
|
253
|
+
let newSortData = sortDataSource.map((item) => {
|
|
254
|
+
if (item.title === record.title) {
|
|
255
|
+
return {
|
|
256
|
+
...item,
|
|
257
|
+
fixed: null,
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
return item;
|
|
261
|
+
});
|
|
262
|
+
this.setState({
|
|
263
|
+
sortDataSource: [
|
|
264
|
+
...newSortData.filter((item) => item.fixed === 'left'),
|
|
265
|
+
...newSortData.filter((item) => !item.fixed),
|
|
266
|
+
...newSortData.filter((item) => item.fixed === 'right'),
|
|
267
|
+
],
|
|
268
|
+
dataSource: [
|
|
269
|
+
...this.state.dataSource.map((item) => {
|
|
270
|
+
if (item.title === record.title) {
|
|
271
|
+
return {
|
|
272
|
+
...item,
|
|
273
|
+
fixed: null,
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
return item;
|
|
277
|
+
}),
|
|
278
|
+
],
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
}}
|
|
282
|
+
>
|
|
283
|
+
<Tooltip
|
|
284
|
+
placement="top"
|
|
285
|
+
title={record?.fixed === 'right' ? '取消固定' : '固定列尾'}
|
|
286
|
+
>
|
|
287
|
+
<img
|
|
288
|
+
src={record?.fixed === 'right' ? fixedRightActive : fixedRight}
|
|
289
|
+
/>
|
|
290
|
+
</Tooltip>
|
|
291
|
+
</span>
|
|
292
|
+
);
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
title: '删除',
|
|
297
|
+
dataIndex: 'title1',
|
|
298
|
+
render: (text: any, record: any) => {
|
|
299
|
+
return (
|
|
300
|
+
<span
|
|
301
|
+
onClick={() => {
|
|
302
|
+
this.setState({
|
|
303
|
+
sortDataSource: this.state.sortDataSource.filter((item:any) => {
|
|
304
|
+
return item.title !== record.title;
|
|
305
|
+
}),
|
|
306
|
+
dataSource: [
|
|
307
|
+
...this.state.dataSource.map((item:any) => {
|
|
308
|
+
if (item.title === record.title) {
|
|
309
|
+
return {
|
|
310
|
+
...item,
|
|
311
|
+
hidden: true,
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return item;
|
|
316
|
+
}),
|
|
317
|
+
],
|
|
318
|
+
});
|
|
319
|
+
}}
|
|
320
|
+
>
|
|
321
|
+
<img src={close} />
|
|
322
|
+
</span>
|
|
323
|
+
);
|
|
324
|
+
},
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
title: 'Sort',
|
|
328
|
+
dataIndex: 'sort',
|
|
329
|
+
className: 'drag-visible',
|
|
330
|
+
render: () => <DragHandle />,
|
|
331
|
+
},
|
|
332
|
+
];
|
|
333
|
+
|
|
334
|
+
showModal = () => {
|
|
335
|
+
const { datasource = [] }: any = this.props;
|
|
336
|
+
this.setState({
|
|
337
|
+
visible: true,
|
|
338
|
+
});
|
|
339
|
+
this.setInitValue(datasource);
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
handleOk = (e?: React.MouseEvent<HTMLElement>) => {
|
|
343
|
+
const { sortDataSource }: any = this.state;
|
|
344
|
+
const { setShowColumns }: any = this.props;
|
|
345
|
+
if (!sortDataSource.length) {
|
|
346
|
+
message.warning('至少选择一列!')
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
this.setState({
|
|
350
|
+
visible: false,
|
|
351
|
+
});
|
|
352
|
+
setShowColumns([...sortDataSource]);
|
|
353
|
+
this.patchUserColumnConfig(sortDataSource)
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
handleCancel = (e: React.MouseEvent<HTMLElement>) => {
|
|
357
|
+
this.setState({
|
|
358
|
+
visible: false,
|
|
359
|
+
});
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
handleTableHeadHidden = (title: string) => {
|
|
363
|
+
const { sortDataSource, dataSource } = this.state;
|
|
364
|
+
this.setState(
|
|
365
|
+
{
|
|
366
|
+
sortDataSource: sortDataSource.filter((item: any) => {
|
|
367
|
+
return item.title !== title;
|
|
368
|
+
}),
|
|
369
|
+
dataSource: [
|
|
370
|
+
...dataSource.map((item:any) => {
|
|
371
|
+
if (item.title === title) {
|
|
372
|
+
return {
|
|
373
|
+
...item,
|
|
374
|
+
hidden: true,
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
return item;
|
|
379
|
+
}),
|
|
380
|
+
],
|
|
381
|
+
},
|
|
382
|
+
() => {
|
|
383
|
+
this.handleOk();
|
|
384
|
+
},
|
|
385
|
+
);
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
onSortEnd = ({ oldIndex, newIndex }: any) => {
|
|
389
|
+
const { sortDataSource } = this.state;
|
|
390
|
+
const { value, setValue }: any = this.props;
|
|
391
|
+
// if (sortDataSource[oldIndex]['fixed']) {
|
|
392
|
+
// message.warning('固定列不可移动');
|
|
393
|
+
// return;
|
|
394
|
+
// }
|
|
395
|
+
if (oldIndex !== newIndex) {
|
|
396
|
+
const newData = arrayMoveImmutable(
|
|
397
|
+
[].concat(sortDataSource),
|
|
398
|
+
oldIndex,
|
|
399
|
+
newIndex,
|
|
400
|
+
).filter((el) => !!el);
|
|
401
|
+
this.setState({
|
|
402
|
+
sortDataSource: [
|
|
403
|
+
...newData.filter((item) => item.fixed === 'left'),
|
|
404
|
+
...newData.filter((item) => !item.fixed),
|
|
405
|
+
...newData.filter((item) => item.fixed === 'right'),
|
|
406
|
+
],
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
DraggableContainer = (props: any) => (
|
|
412
|
+
<SortableBody
|
|
413
|
+
useDragHandle
|
|
414
|
+
disableAutoscroll
|
|
415
|
+
helperClass="row-dragging"
|
|
416
|
+
onSortEnd={this.onSortEnd}
|
|
417
|
+
{...props}
|
|
418
|
+
/>
|
|
419
|
+
);
|
|
420
|
+
|
|
421
|
+
DraggableBodyRow = ({ className, style, ...restProps }: any) => {
|
|
422
|
+
const { sortDataSource } = this.state;
|
|
423
|
+
// function findIndex base on Table rowKey props and should always be a right array index
|
|
424
|
+
const index = sortDataSource.findIndex(
|
|
425
|
+
(x:any) => x.key === restProps['data-row-key'],
|
|
426
|
+
);
|
|
427
|
+
return <SortableItem index={index} {...restProps} />;
|
|
428
|
+
};
|
|
429
|
+
|
|
430
|
+
onChange = (e: any, title: any) => {
|
|
431
|
+
const { sortDataSource, dataSource } = this.state;
|
|
432
|
+
if (!e.target.checked) {
|
|
433
|
+
this.setState({
|
|
434
|
+
sortDataSource: sortDataSource.filter((item: any) => {
|
|
435
|
+
return item.title !== title;
|
|
436
|
+
}),
|
|
437
|
+
dataSource: [
|
|
438
|
+
...dataSource.map((item: any) => {
|
|
439
|
+
if (item.title === title) {
|
|
440
|
+
return {
|
|
441
|
+
...item,
|
|
442
|
+
hidden: true,
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
return item;
|
|
447
|
+
}),
|
|
448
|
+
],
|
|
449
|
+
});
|
|
450
|
+
} else {
|
|
451
|
+
let fixedLeft: any[] = [];
|
|
452
|
+
let fixedRight: any[] = [];
|
|
453
|
+
let noFixedSortSource: any = [];
|
|
454
|
+
sortDataSource.forEach((item: any) => {
|
|
455
|
+
if (item?.fixed === 'left') {
|
|
456
|
+
fixedLeft.push(item);
|
|
457
|
+
} else if (item?.fixed === 'right') {
|
|
458
|
+
fixedRight.push(item);
|
|
459
|
+
} else {
|
|
460
|
+
noFixedSortSource.push(item);
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
this.setState({
|
|
464
|
+
sortDataSource: [
|
|
465
|
+
...fixedLeft,
|
|
466
|
+
...noFixedSortSource,
|
|
467
|
+
...dataSource
|
|
468
|
+
.filter((item: any) => item.title === title)
|
|
469
|
+
.map((source: any) => {
|
|
470
|
+
return {
|
|
471
|
+
...source,
|
|
472
|
+
hidden: false,
|
|
473
|
+
};
|
|
474
|
+
}),
|
|
475
|
+
...fixedRight,
|
|
476
|
+
],
|
|
477
|
+
dataSource: [
|
|
478
|
+
...dataSource.map((item: any) => {
|
|
479
|
+
if (item.title === title) {
|
|
480
|
+
return {
|
|
481
|
+
...item,
|
|
482
|
+
hidden: false,
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
return item;
|
|
487
|
+
}),
|
|
488
|
+
],
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
handleReset = () => {
|
|
494
|
+
const { datasource = [] }: any = this.props;
|
|
495
|
+
this.setInitValue(datasource);
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
onSearch = (e: any) => {
|
|
499
|
+
this.setState({
|
|
500
|
+
searchDataSource: e.target.value,
|
|
501
|
+
});
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
onSearchSort = (e: any) => {
|
|
505
|
+
this.setState({
|
|
506
|
+
onSearchSort: e.target.value,
|
|
507
|
+
});
|
|
508
|
+
};
|
|
509
|
+
|
|
510
|
+
render() {
|
|
511
|
+
const {
|
|
512
|
+
dataSource,
|
|
513
|
+
searchDataSource,
|
|
514
|
+
sortDataSource,
|
|
515
|
+
visible,
|
|
516
|
+
onSearchSort,
|
|
517
|
+
}: any = this.state;
|
|
518
|
+
const { settingImgAttribute={} } = this.props;
|
|
519
|
+
const settingImgAttributeProps={width: 32,...settingImgAttribute};
|
|
520
|
+
|
|
521
|
+
let seatchDataSource = dataSource.filter(
|
|
522
|
+
(item: any) => item?.title?.indexOf(searchDataSource || '') > -1,
|
|
523
|
+
);
|
|
524
|
+
|
|
525
|
+
return (
|
|
526
|
+
<div className={'sort_table_wrapper'}>
|
|
527
|
+
<Modal
|
|
528
|
+
title="设置表头内容"
|
|
529
|
+
wrapClassName={'sort_table_wrapper'}
|
|
530
|
+
width={820}
|
|
531
|
+
visible={visible}
|
|
532
|
+
onOk={this.handleOk}
|
|
533
|
+
onCancel={this.handleCancel}
|
|
534
|
+
footer={[
|
|
535
|
+
<Button key="back" onClick={this.handleReset}>
|
|
536
|
+
恢复默认
|
|
537
|
+
</Button>,
|
|
538
|
+
<Button key="submit" onClick={this.handleOk}>
|
|
539
|
+
取消
|
|
540
|
+
</Button>,
|
|
541
|
+
<Button key="submit" type="primary" onClick={this.handleOk}>
|
|
542
|
+
确认
|
|
543
|
+
</Button>,
|
|
544
|
+
]}
|
|
545
|
+
>
|
|
546
|
+
<div className={'sort_table'}>
|
|
547
|
+
<div className={'sort_table_column_wrapper'}>
|
|
548
|
+
<span className={'sort_table_column_count'}>
|
|
549
|
+
可选字段 <span>(共{dataSource.length}个)</span>
|
|
550
|
+
</span>
|
|
551
|
+
<div className={'sort_table_column'}>
|
|
552
|
+
<Input
|
|
553
|
+
prefix={<SearchOutlined className="site-form-item-icon" />}
|
|
554
|
+
placeholder="搜索"
|
|
555
|
+
allowClear
|
|
556
|
+
onChange={this.onSearch}
|
|
557
|
+
style={{ width: 540 }}
|
|
558
|
+
/>
|
|
559
|
+
<div>
|
|
560
|
+
{!searchDataSource && (
|
|
561
|
+
<Checkbox
|
|
562
|
+
checked={
|
|
563
|
+
!dataSource.some((item: any) => {
|
|
564
|
+
if (item.hidden) return true;
|
|
565
|
+
|
|
566
|
+
return false;
|
|
567
|
+
})
|
|
568
|
+
}
|
|
569
|
+
onClick={(e:any) => {
|
|
570
|
+
this.setState({
|
|
571
|
+
dataSource: [
|
|
572
|
+
...dataSource.map((item: any) => {
|
|
573
|
+
return {
|
|
574
|
+
...item,
|
|
575
|
+
hidden: !e.target.checked,
|
|
576
|
+
};
|
|
577
|
+
}),
|
|
578
|
+
],
|
|
579
|
+
sortDataSource: e.target.checked
|
|
580
|
+
? [
|
|
581
|
+
...dataSource.map((item: any) => {
|
|
582
|
+
return {
|
|
583
|
+
...item,
|
|
584
|
+
hidden: false,
|
|
585
|
+
};
|
|
586
|
+
}),
|
|
587
|
+
]
|
|
588
|
+
: [],
|
|
589
|
+
});
|
|
590
|
+
}}
|
|
591
|
+
>
|
|
592
|
+
全选
|
|
593
|
+
</Checkbox>
|
|
594
|
+
)}
|
|
595
|
+
</div>
|
|
596
|
+
<div className={'sort_table_column_all'}>
|
|
597
|
+
{searchDataSource
|
|
598
|
+
? seatchDataSource.map((item: any) => {
|
|
599
|
+
return (
|
|
600
|
+
<Checkbox
|
|
601
|
+
checked={!item.hidden}
|
|
602
|
+
onChange={(e) => {
|
|
603
|
+
this.onChange(e, item.title);
|
|
604
|
+
}}
|
|
605
|
+
>
|
|
606
|
+
{item.title}
|
|
607
|
+
</Checkbox>
|
|
608
|
+
);
|
|
609
|
+
})
|
|
610
|
+
: dataSource
|
|
611
|
+
.filter(
|
|
612
|
+
(item: any) =>
|
|
613
|
+
item?.title?.indexOf('人') === -1 &&
|
|
614
|
+
item?.title?.indexOf('日期') === -1,
|
|
615
|
+
)
|
|
616
|
+
.map((item: any) => {
|
|
617
|
+
return (
|
|
618
|
+
<Checkbox
|
|
619
|
+
checked={!item.hidden}
|
|
620
|
+
onChange={(e) => {
|
|
621
|
+
this.onChange(e, item.title);
|
|
622
|
+
}}
|
|
623
|
+
>
|
|
624
|
+
{item.title}
|
|
625
|
+
</Checkbox>
|
|
626
|
+
);
|
|
627
|
+
})}
|
|
628
|
+
{!!seatchDataSource.length && (
|
|
629
|
+
<span style={{ width: '144px' }}></span>
|
|
630
|
+
)}
|
|
631
|
+
|
|
632
|
+
{!seatchDataSource.length && (
|
|
633
|
+
<div className={'sort_table_column_all_empty'}>
|
|
634
|
+
未查询到结果
|
|
635
|
+
</div>
|
|
636
|
+
)}
|
|
637
|
+
</div>
|
|
638
|
+
{!searchDataSource && (
|
|
639
|
+
<div>
|
|
640
|
+
<div className={'sort_table_column_special'}>
|
|
641
|
+
<span>人员时间字段</span>
|
|
642
|
+
</div>
|
|
643
|
+
<div className={'sort_table_column_all'}>
|
|
644
|
+
{[...dataSource]
|
|
645
|
+
.filter(
|
|
646
|
+
(item) =>
|
|
647
|
+
item?.title?.indexOf('人') > -1 ||
|
|
648
|
+
item?.title?.indexOf('日期') > -1,
|
|
649
|
+
)
|
|
650
|
+
.map((item) => {
|
|
651
|
+
return (
|
|
652
|
+
<Checkbox
|
|
653
|
+
checked={!item.hidden}
|
|
654
|
+
onChange={(e) => {
|
|
655
|
+
this.onChange(e, item.title);
|
|
656
|
+
}}
|
|
657
|
+
>
|
|
658
|
+
{item.title}
|
|
659
|
+
</Checkbox>
|
|
660
|
+
);
|
|
661
|
+
})}
|
|
662
|
+
<span style={{ width: '144px' }}></span>
|
|
663
|
+
</div>
|
|
664
|
+
</div>
|
|
665
|
+
)}
|
|
666
|
+
|
|
667
|
+
{/* <Checkbox.Group
|
|
668
|
+
options={dataSource.map(item => {
|
|
669
|
+
return {
|
|
670
|
+
label: item.title,
|
|
671
|
+
value: item.title,
|
|
672
|
+
}
|
|
673
|
+
})}
|
|
674
|
+
defaultValue={selectedRowKeys}
|
|
675
|
+
onChange={() => {}}
|
|
676
|
+
/> */}
|
|
677
|
+
</div>
|
|
678
|
+
</div>
|
|
679
|
+
<div className={'sort_table_content_wrapper'}>
|
|
680
|
+
<span className={'sort_table_content_count'}>
|
|
681
|
+
已选字段 <span>(共{sortDataSource.length}个)</span>
|
|
682
|
+
</span>
|
|
683
|
+
<div className={'sort_table_content'}>
|
|
684
|
+
<span style={{ paddingLeft: '10px' }}>
|
|
685
|
+
<Input
|
|
686
|
+
prefix={<SearchOutlined className="site-form-item-icon" />}
|
|
687
|
+
placeholder="搜索"
|
|
688
|
+
allowClear
|
|
689
|
+
onChange={this.onSearchSort}
|
|
690
|
+
style={{ width: 190 }}
|
|
691
|
+
/>
|
|
692
|
+
</span>
|
|
693
|
+
<Table
|
|
694
|
+
pagination={false}
|
|
695
|
+
showHeader={false}
|
|
696
|
+
dataSource={
|
|
697
|
+
onSearchSort
|
|
698
|
+
? sortDataSource.filter(
|
|
699
|
+
(item:any) => item?.title?.indexOf(onSearchSort) > -1,
|
|
700
|
+
)
|
|
701
|
+
: sortDataSource
|
|
702
|
+
}
|
|
703
|
+
columns={this.columns}
|
|
704
|
+
rowKey="key"
|
|
705
|
+
// rowSelection={rowSelection}
|
|
706
|
+
components={{
|
|
707
|
+
body: {
|
|
708
|
+
wrapper: this.DraggableContainer,
|
|
709
|
+
row: this.DraggableBodyRow,
|
|
710
|
+
},
|
|
711
|
+
}}
|
|
712
|
+
/>
|
|
713
|
+
</div>
|
|
714
|
+
</div>
|
|
715
|
+
</div>
|
|
716
|
+
</Modal>
|
|
717
|
+
<Tooltip title="列设置">
|
|
718
|
+
<img {...settingImgAttributeProps} onClick={this.showModal} src={shezhi} />
|
|
719
|
+
</Tooltip>
|
|
720
|
+
</div>
|
|
721
|
+
);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
export default TableColumnSetting;
|