@bit-sun/business-component 2.0.32 → 2.0.33

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