@bit-sun/business-component 4.0.13-alpha.8 → 4.2.0-aiwei-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.umirc.ts +21 -10
- package/dist/components/Business/AddSelectBusiness/index.d.ts +3 -4
- package/dist/components/Business/BsLayouts/Components/AllFunc/drawContent.d.ts +1 -2
- package/dist/components/Business/BsLayouts/Components/ChooseStore/index.d.ts +1 -2
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.d.ts +1 -1
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.d.ts +1 -1
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.d.ts +2 -2
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.d.ts +1 -2
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.d.ts +1 -2
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/index.d.ts +1 -1
- package/dist/components/Business/BsLayouts/Components/GlobalHeader/index.d.ts +1 -2
- package/dist/components/Business/BsLayouts/Components/RightContent/LoginModal.d.ts +1 -2
- package/dist/components/Business/BsLayouts/index.d.ts +1 -1
- package/dist/components/Business/BsSulaQueryTable/SearchItemSetting.d.ts +5 -5
- package/dist/components/Business/BsSulaQueryTable/index.d.ts +1 -2
- package/dist/components/Business/BsSulaQueryTable/setting.d.ts +11 -8
- package/dist/components/Business/BsSulaQueryTable/utils.d.ts +14 -15
- package/dist/components/Business/CommodityEntry/index.d.ts +1 -2
- package/dist/components/Business/CommonAlert/index.d.ts +1 -2
- package/dist/components/Business/CommonGuideWrapper/index.d.ts +3 -3
- package/dist/components/Business/DetailPageWrapper/index.d.ts +11 -6
- package/dist/components/Business/HomePageWrapper/index.d.ts +1 -2
- package/dist/components/Business/ItemPropertySelector/index.d.ts +2 -0
- package/dist/components/Business/JsonQueryTable/components/FieldsModifyModal.d.ts +1 -2
- package/dist/components/Business/JsonQueryTable/components/FieldsSettingsTable.d.ts +1 -2
- package/dist/components/Business/JsonQueryTable/components/Formula.d.ts +1 -2
- package/dist/components/Business/JsonQueryTable/components/MaintainOptions.d.ts +1 -2
- package/dist/components/Business/JsonQueryTable/drawer/index.d.ts +1 -2
- package/dist/components/Business/ModalUtils/index.d.ts +8 -0
- package/dist/components/Business/PropertyModal/index.d.ts +1 -2
- package/dist/components/Business/PropertyModal/propertyGroup.d.ts +1 -1
- package/dist/components/Business/SearchSelect/index.d.ts +1 -1
- package/dist/components/Business/SearchSelect/utils.d.ts +4 -2
- package/dist/components/Business/StateFlow/index.d.ts +1 -2
- package/dist/components/Business/SystemLog/index.d.ts +78 -0
- package/dist/components/Business/TreeSearchSelect/index.d.ts +1 -1
- package/dist/components/Business/columnSettingTable/columnSetting.d.ts +9 -8
- package/dist/components/Business/columnSettingTable/components/TableSumComponent.d.ts +1 -2
- package/dist/components/Business/columnSettingTable/index.d.ts +21 -4
- package/dist/components/Business/columnSettingTable/sulaSettingTable.d.ts +22 -5
- package/dist/components/Business/columnSettingTable/utils.d.ts +1 -2
- package/dist/components/Business/moreTreeTable/FixedScrollBar.d.ts +1 -1
- package/dist/components/Common/ParagraphCopier/index.d.ts +1 -1
- package/dist/components/Common/Section/index.d.ts +1 -1
- package/dist/components/Functional/AddSelect/index.d.ts +1 -2
- package/dist/components/Functional/AuthButton/index.d.ts +1 -2
- package/dist/components/Functional/DataImport/index.d.ts +3 -3
- package/dist/components/Functional/DataValidation/index.d.ts +15 -5
- package/dist/components/Functional/ExportFunctions/ExportIcon/index.d.ts +1 -2
- package/dist/components/Functional/QueryMutipleInput/index.d.ts +3 -3
- package/dist/components/Functional/QueryMutipleSelect/index.d.ts +1 -2
- package/dist/components/Functional/SearchSelect/index.d.ts +1 -1
- package/dist/components/Functional/SearchSelect/utils.d.ts +4 -4
- package/dist/components/Functional/TreeSearchSelect/index.d.ts +1 -2
- package/dist/components/Solution/RuleComponent/CustomPlugin/CustomSelector/CustomSelectorModal.d.ts +1 -1
- package/dist/components/Solution/RuleComponent/CustomPlugin/CustomSelector/index.d.ts +1 -2
- package/dist/components/Solution/RuleComponent/Formula.d.ts +1 -2
- package/dist/components/Solution/RuleComponent/InnerSelect.d.ts +1 -2
- package/dist/components/Solution/RuleComponent/RenderCompItem.d.ts +1 -2
- package/dist/components/Solution/RuleSetter/RuleInstance.d.ts +1 -2
- package/dist/components/Solution/RuleSetter/baseRule.d.ts +1 -1
- package/dist/components/Solution/RuleSetter/index.d.ts +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +4206 -2108
- package/dist/index.js +4215 -2106
- package/dist/plugin/TableColumnSetting/index.d.ts +6 -5
- package/dist/utils/RequestCacheManager.d.ts +82 -0
- package/dist/utils/TableUtils.d.ts +18 -19
- package/dist/utils/cachedRequest.d.ts +76 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/utils.d.ts +41 -0
- package/package.json +16 -14
- package/src/assets/btn-cancel.svg +3 -0
- package/src/assets/btn-copy.svg +3 -0
- package/src/assets/btn-delete.svg +2 -29
- package/src/assets/btn-edit.svg +2 -19
- package/src/assets/btn-hangUp.svg +3 -0
- package/src/assets/btn-print.svg +3 -0
- package/src/assets/btn-refresh.svg +3 -0
- package/src/assets/btn-unhook.svg +3 -0
- package/src/components/Business/AddSelectBusiness/index.md +8 -2
- package/src/components/Business/AddSelectBusiness/index.tsx +4 -1
- package/src/components/Business/BsLayouts/Components/ChooseStore/services.ts +1 -1
- package/src/components/Business/BsLayouts/Components/GlobalHeader/index.less +1 -1
- package/src/components/Business/BsLayouts/Components/RightContent/LoginModal.tsx +1 -1
- package/src/components/Business/BsLayouts/Components/RightContent/home.less +1 -1
- package/src/components/Business/BsLayouts/Components/SearchFunc/index.less +2 -2
- package/src/components/Business/BsLayouts/service.ts +1 -1
- package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +6 -5
- package/src/components/Business/BsSulaQueryTable/index.less +5 -3
- package/src/components/Business/BsSulaQueryTable/index.md +45 -32
- package/src/components/Business/BsSulaQueryTable/index.tsx +154 -76
- package/src/components/Business/BsSulaQueryTable/setting.tsx +47 -11
- package/src/components/Business/BsSulaQueryTable/utils.less +1 -1
- package/src/components/Business/BsSulaQueryTable/utils.tsx +15 -12
- package/src/components/Business/CommodityEntry/index.md +1 -1
- package/src/components/Business/CommodityEntry/index.tsx +11 -9
- package/src/components/Business/DetailPageWrapper/index.less +1 -1
- package/src/components/Business/DetailPageWrapper/index.tsx +24 -5
- package/src/components/Business/DetailPageWrapper/utils.tsx +7 -2
- package/src/components/Business/HomePageWrapper/index.less +1 -1
- package/src/components/Business/ItemPropertySelector/index.tsx +88 -0
- package/src/components/Business/JsonQueryTable/function.ts +1 -1
- package/src/components/Business/JsonQueryTable/index.tsx +1 -1
- package/src/components/Business/ModalUtils/index.tsx +45 -0
- package/src/components/Business/PropertyModal/index.tsx +1 -1
- package/src/components/Business/SearchSelect/BusinessUtils.tsx +625 -76
- package/src/components/Business/SearchSelect/index.md +4 -4
- package/src/components/Business/SearchSelect/utils.ts +27 -5
- package/src/components/Business/SystemLog/index.md +37 -0
- package/src/components/Business/SystemLog/index.tsx +87 -0
- package/src/components/Business/columnSettingTable/columnSetting.tsx +28 -12
- package/src/components/Business/columnSettingTable/index.less +5 -3
- package/src/components/Business/columnSettingTable/index.md +200 -136
- package/src/components/Business/columnSettingTable/index.tsx +168 -39
- package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +188 -56
- package/src/components/Functional/AddSelect/helps.ts +1 -1
- package/src/components/Functional/AddSelect/index.tsx +132 -13
- package/src/components/Functional/BillEntry/index.less +3 -0
- package/src/components/Functional/BillEntry/index.tsx +1 -1
- package/src/components/Functional/DataImport/index.tsx +1 -1
- package/src/components/Functional/DataValidation/index.md +1 -0
- package/src/components/Functional/DataValidation/index.tsx +161 -27
- package/src/components/Functional/ExportFunctions/ExportIcon/index.tsx +1 -1
- package/src/components/Functional/QueryMutipleInput/index.tsx +12 -3
- package/src/components/Functional/QueryMutipleSelect/index.tsx +3 -2
- package/src/components/Functional/SearchSelect/index.less +4 -0
- package/src/components/Functional/SearchSelect/index.tsx +68 -24
- package/src/components/Functional/SearchSelect/utils.tsx +17 -11
- package/src/components/Functional/TreeSearchSelect/index.tsx +3 -2
- package/src/components/Solution/RuleComponent/InnerSelect.tsx +1 -0
- package/src/components/Solution/RuleComponent/RenderCompItem.tsx +11 -2
- package/src/components/Solution/RuleComponent/index.js +75 -4
- package/src/components/Solution/RuleComponent/ruleFiled.js +26 -2
- package/src/components/Solution/RuleComponent/services.ts +1 -1
- package/src/components/Solution/RuleSetter/service.js +1 -1
- package/src/index.ts +3 -0
- package/src/plugin/TableColumnSetting/index.less +5 -3
- package/src/plugin/TableColumnSetting/index.tsx +80 -13
- package/src/styles/bsDefault.less +9 -3
- package/src/utils/RequestCacheManager.ts +213 -0
- package/src/utils/RequestCache_Examples.md +137 -0
- package/src/utils/RequestCache_README.md +170 -0
- package/src/utils/TableUtils.less +1 -1
- package/src/utils/cachedRequest.ts +288 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/request.ts +8 -4
- package/src/utils/requestUtils.ts +1 -1
- package/src/utils/utils.ts +41 -1
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
SortableElement,
|
|
15
15
|
SortableHandle,
|
|
16
16
|
} from 'react-sortable-hoc';
|
|
17
|
-
import request from '@/utils/
|
|
17
|
+
import request from '@/utils/cachedRequest';
|
|
18
18
|
import { SearchOutlined } from '@ant-design/icons';
|
|
19
19
|
import { arrayMoveImmutable } from 'array-move';
|
|
20
20
|
import close from '../../../assets/close.svg';
|
|
@@ -312,7 +312,7 @@ class SearchItemTable extends React.Component {
|
|
|
312
312
|
DraggableContainer = (props) => (
|
|
313
313
|
<SortableBody
|
|
314
314
|
useDragHandle
|
|
315
|
-
|
|
315
|
+
lockAxis='y'
|
|
316
316
|
helperClass="row-dragging"
|
|
317
317
|
onSortEnd={this.onSortEnd}
|
|
318
318
|
{...props}
|
|
@@ -405,9 +405,9 @@ class SearchItemTable extends React.Component {
|
|
|
405
405
|
} else {
|
|
406
406
|
switch(item.field.type){
|
|
407
407
|
//多值录入搜索组件 默认使用下拉框第一个选项
|
|
408
|
-
case 'bs-multiInput':
|
|
408
|
+
case 'bs-multiInput': case 'bs-multiTimeCustom': case 'bs-multiRemark': case 'bs-multiSelectCustom':
|
|
409
409
|
const { options = [] } = item?.field?.props;
|
|
410
|
-
return options[0]?.text;
|
|
410
|
+
return options[0]?.text || options[0]?.label;
|
|
411
411
|
default:
|
|
412
412
|
return '';
|
|
413
413
|
}
|
|
@@ -580,13 +580,14 @@ class SearchItemTable extends React.Component {
|
|
|
580
580
|
row: this.DraggableBodyRow,
|
|
581
581
|
},
|
|
582
582
|
}}
|
|
583
|
+
scroll={{ y: 364 }}
|
|
583
584
|
/>
|
|
584
585
|
</div>
|
|
585
586
|
</div>
|
|
586
587
|
</div>
|
|
587
588
|
</Modal>
|
|
588
589
|
)}
|
|
589
|
-
<div onClick={this.showModal} style={{fontSize:14, textAlign: 'center', border: '0.67px solid #D9D9D9', width: '24px', height: '24px', lineHeight: '20px'}}><img style={{width: '20px', height: '20px'}} src={shezhi} /></div>
|
|
590
|
+
<div onClick={this.showModal} style={{fontSize:14, cursor: 'pointer', textAlign: 'center', border: '0.67px solid #D9D9D9', width: '24px', height: '24px', lineHeight: '20px'}}><img style={{width: '20px', height: '20px'}} src={shezhi} /></div>
|
|
590
591
|
</div>
|
|
591
592
|
);
|
|
592
593
|
}
|
|
@@ -151,16 +151,18 @@
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
.ant-table-
|
|
154
|
+
.ant-table-body::-webkit-scrollbar {
|
|
155
155
|
display: none;
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
.ant-table-wrapper {
|
|
159
159
|
margin-top: 10px;
|
|
160
|
-
height: 364px;
|
|
161
|
-
overflow: scroll;
|
|
162
160
|
padding-bottom: 50px;
|
|
163
161
|
|
|
162
|
+
tbody tr:first-child {
|
|
163
|
+
display: none;
|
|
164
|
+
}
|
|
165
|
+
|
|
164
166
|
tr {
|
|
165
167
|
height: 30px;
|
|
166
168
|
td {
|
|
@@ -38,6 +38,7 @@ export default () => {
|
|
|
38
38
|
return {
|
|
39
39
|
...item,
|
|
40
40
|
id: `${index}`,
|
|
41
|
+
orderStatus: index === 1 ? '-1' : '',
|
|
41
42
|
name: `${item.name.first} ${item.name.last}`,
|
|
42
43
|
};
|
|
43
44
|
}),
|
|
@@ -118,83 +119,95 @@ export default () => {
|
|
|
118
119
|
title: '邮箱',
|
|
119
120
|
},
|
|
120
121
|
{
|
|
121
|
-
key: '
|
|
122
|
-
title: '
|
|
122
|
+
key: 'id1',
|
|
123
|
+
title: 'ID1',
|
|
123
124
|
},
|
|
124
125
|
{
|
|
125
|
-
key: '
|
|
126
|
-
title: '姓名',
|
|
126
|
+
key: 'name1',
|
|
127
|
+
title: '姓名1',
|
|
127
128
|
},
|
|
128
129
|
{
|
|
129
|
-
key: '
|
|
130
|
-
title: '国家',
|
|
130
|
+
key: 'nat1',
|
|
131
|
+
title: '国家1',
|
|
131
132
|
},
|
|
132
133
|
{
|
|
133
|
-
key: '
|
|
134
|
-
title: '性别',
|
|
134
|
+
key: 'gender1',
|
|
135
|
+
title: '性别1',
|
|
135
136
|
render: ({ text }) => {
|
|
136
137
|
return text === 'male' ? '男' : '女';
|
|
137
138
|
},
|
|
138
139
|
},
|
|
139
140
|
{
|
|
140
|
-
key: '
|
|
141
|
-
title: '邮箱',
|
|
141
|
+
key: 'email1',
|
|
142
|
+
title: '邮箱1',
|
|
142
143
|
},
|
|
143
144
|
{
|
|
144
|
-
key: '
|
|
145
|
-
title: '
|
|
145
|
+
key: 'id2',
|
|
146
|
+
title: 'ID2',
|
|
146
147
|
},
|
|
147
148
|
{
|
|
148
|
-
key: '
|
|
149
|
-
title: '姓名',
|
|
149
|
+
key: 'name2',
|
|
150
|
+
title: '姓名2',
|
|
150
151
|
},
|
|
151
152
|
{
|
|
152
|
-
key: '
|
|
153
|
-
title: '国家',
|
|
153
|
+
key: 'nat2',
|
|
154
|
+
title: '国家2',
|
|
154
155
|
},
|
|
155
156
|
{
|
|
156
|
-
key: '
|
|
157
|
-
title: '
|
|
157
|
+
key: 'orderStatus2',
|
|
158
|
+
title: '单据状态2',
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
key: 'gender2',
|
|
162
|
+
title: '性别2',
|
|
158
163
|
render: ({ text }) => {
|
|
159
164
|
return text === 'male' ? '男' : '女';
|
|
160
165
|
},
|
|
161
166
|
},
|
|
162
167
|
{
|
|
163
|
-
key: '
|
|
164
|
-
title: '邮箱',
|
|
168
|
+
key: 'email2',
|
|
169
|
+
title: '邮箱2',
|
|
165
170
|
},
|
|
166
171
|
{
|
|
167
|
-
key: '
|
|
168
|
-
title: '
|
|
172
|
+
key: 'id3',
|
|
173
|
+
title: 'ID3',
|
|
169
174
|
},
|
|
170
175
|
{
|
|
171
|
-
key: '
|
|
172
|
-
title: '姓名',
|
|
176
|
+
key: 'name3',
|
|
177
|
+
title: '姓名3',
|
|
173
178
|
},
|
|
174
179
|
{
|
|
175
|
-
key: '
|
|
176
|
-
title: '国家',
|
|
180
|
+
key: 'nat3',
|
|
181
|
+
title: '国家3',
|
|
177
182
|
},
|
|
178
183
|
{
|
|
179
|
-
key: '
|
|
180
|
-
title: '性别',
|
|
184
|
+
key: 'gender3',
|
|
185
|
+
title: '性别3',
|
|
181
186
|
render: ({ text }) => {
|
|
182
187
|
return text === 'male' ? '男' : '女';
|
|
183
188
|
},
|
|
184
189
|
},
|
|
185
190
|
{
|
|
186
|
-
key: '
|
|
187
|
-
title: '邮箱',
|
|
191
|
+
key: 'email3',
|
|
192
|
+
title: '邮箱3',
|
|
188
193
|
},
|
|
189
194
|
],
|
|
195
|
+
rowSelection: {
|
|
196
|
+
onChange: (rowKey: any, rows: any) => {
|
|
197
|
+
console.log(rowKey, rows);
|
|
198
|
+
setRows(rows);
|
|
199
|
+
},
|
|
200
|
+
},
|
|
190
201
|
rowKey: 'id',
|
|
191
202
|
tableProps: {
|
|
192
203
|
initialPaging: {
|
|
193
204
|
pagination: {
|
|
194
205
|
pageSize: 10,
|
|
195
206
|
}
|
|
196
|
-
}
|
|
197
|
-
|
|
207
|
+
},
|
|
208
|
+
showStatusRowClass: true,
|
|
209
|
+
showStatusFields: ['orderStatus']
|
|
210
|
+
},
|
|
198
211
|
};
|
|
199
212
|
return (
|
|
200
213
|
<div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import React, { useState, useEffect, useRef, useMemo } from 'react';
|
|
2
|
+
import React, { useState, useEffect, useRef, useMemo, useCallback, } from 'react';
|
|
3
3
|
import { useLocation, history } from 'umi';
|
|
4
4
|
import { QueryTable } from 'bssula';
|
|
5
5
|
import { Menu, Tooltip, Dropdown, Table, Typography } from 'antd';
|
|
@@ -7,7 +7,7 @@ import { Resizable } from 'react-resizable';
|
|
|
7
7
|
import { debounce } from 'lodash';
|
|
8
8
|
import ExportIcon from '@/components/Functional/ExportFunctions/ExportIcon';
|
|
9
9
|
import ENUM from '@/utils/enumConfig';
|
|
10
|
-
import { handleBssulaColumnsSpecialParams, uuid } from '@/utils/utils';
|
|
10
|
+
import { handleBssulaColumnsSpecialParams, uuid, parseWidth, } from '@/utils/utils';
|
|
11
11
|
import { getMenuAuthDataKey } from '@/utils/LocalstorageUtils';
|
|
12
12
|
import { shouldUseAuth } from '@/utils';
|
|
13
13
|
import {
|
|
@@ -164,6 +164,8 @@ const ResizeableTitle = (props: any) => {
|
|
|
164
164
|
export default (props: any) => {
|
|
165
165
|
const bsTableCode = props?.tableCode || window.location.hash; //设置列字段的唯一标识
|
|
166
166
|
|
|
167
|
+
const rowsRef = useRef<any>(null);
|
|
168
|
+
|
|
167
169
|
// 获取 table columns中所有的 key 防止有的地方是 dataindex
|
|
168
170
|
const checkedList = useMemo(
|
|
169
171
|
() =>
|
|
@@ -337,6 +339,26 @@ export default (props: any) => {
|
|
|
337
339
|
globalDocument.webkitFullscreenElement;
|
|
338
340
|
if (isFull == undefined) isFull = false;
|
|
339
341
|
return isFull;
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
const getResizeShowColumns = (showColumns, ) => {
|
|
345
|
+
showColumns.forEach((item, index) => {
|
|
346
|
+
item.width = item.width || getItemDefaultWidth(item);
|
|
347
|
+
// handleBssulaColumnsSpecialParams(item);
|
|
348
|
+
item.onHeaderCell = (column) => ({
|
|
349
|
+
...item,
|
|
350
|
+
width:
|
|
351
|
+
typeof column.width === 'number'
|
|
352
|
+
? column.width
|
|
353
|
+
: parseWidth(column.width),
|
|
354
|
+
onResize: handleResize(index),
|
|
355
|
+
});
|
|
356
|
+
});
|
|
357
|
+
return showColumns;
|
|
358
|
+
}
|
|
359
|
+
const setResizeShowColumns = (showColumns: any) => {
|
|
360
|
+
let newShowColumns = getResizeShowColumns(showColumns);
|
|
361
|
+
setShowColumns([...newShowColumns]);
|
|
340
362
|
}
|
|
341
363
|
|
|
342
364
|
const setInitialTableInfo = (isReset) => {
|
|
@@ -370,7 +392,7 @@ export default (props: any) => {
|
|
|
370
392
|
}
|
|
371
393
|
});
|
|
372
394
|
}
|
|
373
|
-
handleBssulaColumnsSpecialParams(d);
|
|
395
|
+
// handleBssulaColumnsSpecialParams(d);
|
|
374
396
|
});
|
|
375
397
|
setCommonRenderFn(props.columns);
|
|
376
398
|
const authButton = localStorage.getItem(getMenuAuthDataKey())
|
|
@@ -396,49 +418,14 @@ export default (props: any) => {
|
|
|
396
418
|
ENUM.BROWSER_CACHE.COLUMN_CONDITION,
|
|
397
419
|
);
|
|
398
420
|
|
|
399
|
-
const parseWidth = (widthStr: string): number => {
|
|
400
|
-
const parsedWidth = parseInt(widthStr.replace('px', ''));
|
|
401
|
-
return isNaN(parsedWidth) ? 0 : parsedWidth;
|
|
402
|
-
};
|
|
403
|
-
|
|
404
421
|
let showColumns = getSettingFieldOrColumn(isReset ? [] : columnConfig, columns, 'columns');
|
|
405
|
-
|
|
406
|
-
showColumns.forEach((item, index) => {
|
|
407
|
-
item.width = item.width || getItemDefaultWidth(item);
|
|
408
|
-
handleBssulaColumnsSpecialParams(item);
|
|
409
|
-
item.onHeaderCell = (column) => ({
|
|
410
|
-
...item,
|
|
411
|
-
width:
|
|
412
|
-
typeof column.width === 'number'
|
|
413
|
-
? column.width
|
|
414
|
-
: parseWidth(column.width),
|
|
415
|
-
onResize: handleResize(index),
|
|
416
|
-
});
|
|
417
|
-
});
|
|
418
|
-
setShowColumns([...showColumns]);
|
|
422
|
+
setResizeShowColumns(showColumns);
|
|
419
423
|
|
|
420
424
|
let exportColumnConfig = getConfigFromlocalstorage(
|
|
421
425
|
ENUM.BROWSER_CACHE.COLUMN_CONDITION,
|
|
422
426
|
bsTableCodeExport,
|
|
423
427
|
);
|
|
424
|
-
let showExportColumns = getSettingFieldOrColumn(
|
|
425
|
-
exportColumnConfig,
|
|
426
|
-
columns,
|
|
427
|
-
'columns',
|
|
428
|
-
);
|
|
429
|
-
|
|
430
|
-
showExportColumns.forEach((item, index) => {
|
|
431
|
-
item.width = item.width || getItemDefaultWidth(item);
|
|
432
|
-
handleBssulaColumnsSpecialParams(item);
|
|
433
|
-
item.onHeaderCell = (column) => ({
|
|
434
|
-
...item,
|
|
435
|
-
width:
|
|
436
|
-
typeof column.width === 'number'
|
|
437
|
-
? column.width
|
|
438
|
-
: parseInt(column.width.replace('px', '')),
|
|
439
|
-
onResize: handleResize(index),
|
|
440
|
-
});
|
|
441
|
-
});
|
|
428
|
+
let showExportColumns = getSettingFieldOrColumn(exportColumnConfig,columns,'columns');
|
|
442
429
|
setShowExportColumns([...showExportColumns]);
|
|
443
430
|
};
|
|
444
431
|
|
|
@@ -527,49 +514,97 @@ export default (props: any) => {
|
|
|
527
514
|
|
|
528
515
|
// 处理 table 基本参数
|
|
529
516
|
const setTableProps = () => {
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
...tableProps,
|
|
517
|
+
const defaultPageSize = 20;
|
|
518
|
+
const baseTableProps = {
|
|
533
519
|
size: value.size || 'middle',
|
|
534
|
-
defaultPageSize
|
|
535
|
-
pageSize:
|
|
536
|
-
initialPaging: {
|
|
537
|
-
pagination: props?.pagination
|
|
538
|
-
? false
|
|
539
|
-
: {
|
|
540
|
-
defaultPageSize: 20,
|
|
541
|
-
pageSize: 20,
|
|
542
|
-
showTotal: (total: any) => `共 ${total} 条`,
|
|
543
|
-
showQuickJumper: true,
|
|
544
|
-
hideOnSinglePage: value.hideOnSinglePage || false,
|
|
545
|
-
|
|
546
|
-
...tableProps?.initialPaging?.pagination,
|
|
547
|
-
},
|
|
548
|
-
},
|
|
520
|
+
defaultPageSize,
|
|
521
|
+
pageSize: defaultPageSize,
|
|
549
522
|
initialSelectedRowKeys: value.initialSelectedRowKeys || [],
|
|
550
523
|
expandable: props.expandable,
|
|
551
524
|
scroll: {
|
|
552
525
|
x: props.overScrollX || 'max-content',
|
|
553
526
|
y: props?.overScrollY || height,
|
|
554
527
|
},
|
|
555
|
-
bordered: value.bordered
|
|
556
|
-
sticky: true,
|
|
557
|
-
rowClassName: (record
|
|
558
|
-
|
|
528
|
+
bordered: typeof value.bordered === 'boolean' ? value.bordered : true,
|
|
529
|
+
sticky: typeof value.sticky === 'boolean' ? value.sticky : true,
|
|
530
|
+
rowClassName: (record, index) => {
|
|
531
|
+
if (props?.rowClassName) {
|
|
532
|
+
return props.rowClassName(record, index);
|
|
533
|
+
}
|
|
534
|
+
if (value?.tableProps?.showStatusFields && value?.tableProps?.showStatusFields?.some(status => record?.[status] == -1)) {
|
|
535
|
+
return 'table_gray';
|
|
536
|
+
}
|
|
537
|
+
return index % 2 === 0 ? 'table_base' : 'table_odd';
|
|
538
|
+
},
|
|
559
539
|
components: {
|
|
560
540
|
header: {
|
|
561
541
|
cell: ResizeableTitle,
|
|
562
542
|
},
|
|
563
|
-
...tableProps?.components,
|
|
543
|
+
...value.tableProps?.components,
|
|
564
544
|
},
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
const paginationConfig = props?.pagination
|
|
548
|
+
? false
|
|
549
|
+
: {
|
|
550
|
+
defaultPageSize,
|
|
551
|
+
pageSize: defaultPageSize,
|
|
552
|
+
showTotal: (total) => `共 ${total} 条`,
|
|
553
|
+
showQuickJumper: true,
|
|
554
|
+
hideOnSinglePage: value.hideOnSinglePage || false,
|
|
555
|
+
...value.tableProps?.initialPaging?.pagination,
|
|
556
|
+
};
|
|
557
|
+
|
|
558
|
+
const handleRowClick = (record) => {
|
|
559
|
+
const { rowKey } = value;
|
|
560
|
+
|
|
561
|
+
let newSelectedRowKeys = [...(rowsRef?.current?.selectedRowKeys || [])];
|
|
562
|
+
let newSelectedRows = [...(rowsRef?.current?.selectedRows || [])];
|
|
563
|
+
|
|
564
|
+
const keyIndex = newSelectedRowKeys.indexOf(record[rowKey]);
|
|
565
|
+
if (keyIndex > -1) {
|
|
566
|
+
// 如果已经选中,则取消选中
|
|
567
|
+
newSelectedRowKeys.splice(keyIndex, 1);
|
|
568
|
+
newSelectedRows.splice(keyIndex, 1);
|
|
569
|
+
} else {
|
|
570
|
+
// 如果未选中,则添加到选中列表
|
|
571
|
+
newSelectedRowKeys.push(record[rowKey]);
|
|
572
|
+
newSelectedRows.push(record);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
rowsRef.current = {
|
|
576
|
+
selectedRowKeys: newSelectedRowKeys,
|
|
577
|
+
selectedRows: newSelectedRows,
|
|
578
|
+
};
|
|
579
|
+
|
|
580
|
+
// 手动调用外部传入的 onChange 函数
|
|
581
|
+
const { rowSelection } = value;
|
|
582
|
+
if (rowSelection && typeof rowSelection.onChange === 'function') {
|
|
583
|
+
// 直接将 record 作为数组元素传递
|
|
584
|
+
rowSelection.onChange(newSelectedRowKeys, newSelectedRows);
|
|
585
|
+
}
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
const handleRowDoubleClick = (record) => {
|
|
589
|
+
console.log('handleRowDoubleClick', record);
|
|
590
|
+
if (props.viewPagePath) {
|
|
591
|
+
const path = eval(`\`${props.viewPagePath.replace(/'/g, '`').replace(/#{(.*?)}/g, (match, p) => `\${${p}}`)}\``);
|
|
592
|
+
history.push(path);
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
|
|
596
|
+
const tableProps = {
|
|
597
|
+
...baseTableProps,
|
|
598
|
+
initialPaging: {
|
|
599
|
+
pagination: paginationConfig,
|
|
600
|
+
},
|
|
601
|
+
onRow: (record) => {
|
|
602
|
+
return {
|
|
603
|
+
onClick: () => handleRowClick(record), // 绑定行点击事件
|
|
604
|
+
onDoubleClick: () => handleRowDoubleClick(record), // 绑定行点击事件
|
|
605
|
+
};
|
|
606
|
+
},
|
|
607
|
+
...value?.tableProps || {}
|
|
573
608
|
};
|
|
574
609
|
|
|
575
610
|
// @ts-ignore
|
|
@@ -715,9 +750,9 @@ export default (props: any) => {
|
|
|
715
750
|
...newColumns[index],
|
|
716
751
|
width: size.width,
|
|
717
752
|
};
|
|
718
|
-
newColumns.forEach((d: any) => {
|
|
719
|
-
|
|
720
|
-
});
|
|
753
|
+
// newColumns.forEach((d: any) => {
|
|
754
|
+
// handleBssulaColumnsSpecialParams(d);
|
|
755
|
+
// });
|
|
721
756
|
return [...newColumns];
|
|
722
757
|
});
|
|
723
758
|
};
|
|
@@ -747,6 +782,36 @@ export default (props: any) => {
|
|
|
747
782
|
return cols;
|
|
748
783
|
};
|
|
749
784
|
|
|
785
|
+
const onSelectChange = useCallback((newSelectedRowKeys: any, newSelectedRows: any) => {
|
|
786
|
+
const originalSelectedRowKeys = rowsRef?.current?.selectedRowKeys || [];
|
|
787
|
+
const originalSelectedRows = rowsRef?.current?.selectedRows || [];
|
|
788
|
+
|
|
789
|
+
// 合并新的 selectedRowKeys,去除重复项
|
|
790
|
+
const mergedSelectedRowKeys = [...new Set([...originalSelectedRowKeys, ...newSelectedRowKeys])];
|
|
791
|
+
// 合并新的 selectedRows
|
|
792
|
+
const rowKey = props.rowKey;
|
|
793
|
+
const mergedSelectedRows = mergedSelectedRowKeys.map((key) => {
|
|
794
|
+
const existingRow = originalSelectedRows.find((row) => row[rowKey] === key);
|
|
795
|
+
const newRow = newSelectedRows.find((row) => row[rowKey] === key);
|
|
796
|
+
return newRow || existingRow || {};
|
|
797
|
+
});
|
|
798
|
+
|
|
799
|
+
rowsRef.current = {
|
|
800
|
+
selectedRowKeys: mergedSelectedRowKeys,
|
|
801
|
+
selectedRows: mergedSelectedRows,
|
|
802
|
+
};
|
|
803
|
+
|
|
804
|
+
// 如果外部传入了 rowSelection 的 onChange 事件,调用它
|
|
805
|
+
if (value.rowSelection && typeof value.rowSelection.onChange === 'function') {
|
|
806
|
+
value.rowSelection.onChange(newSelectedRowKeys, newSelectedRows);
|
|
807
|
+
}
|
|
808
|
+
}, [value.rowKey, value.rowSelection]);
|
|
809
|
+
|
|
810
|
+
const isObject = (value: any) => typeof value === 'object' && value!== null;
|
|
811
|
+
const hasValidRowSelection = (propRowSelection: any) => {
|
|
812
|
+
return isObject(propRowSelection) && Object.keys(propRowSelection).length > 0;
|
|
813
|
+
};
|
|
814
|
+
|
|
750
815
|
const config = {
|
|
751
816
|
visibleFieldsCount: 7,
|
|
752
817
|
tableWrapperStyle: {
|
|
@@ -765,9 +830,21 @@ export default (props: any) => {
|
|
|
765
830
|
span: 16,
|
|
766
831
|
},
|
|
767
832
|
},
|
|
768
|
-
rowSelection: false, // 默认无多选
|
|
769
833
|
...handleTimeValue(),
|
|
770
834
|
tableProps: setTableProps(),
|
|
835
|
+
rowSelection: value.rowSelection ? {
|
|
836
|
+
...value.rowSelection,
|
|
837
|
+
selectedRowKeys: rowsRef?.current?.selectedRowKeys || [],
|
|
838
|
+
onChange: (selectedRowKeys: any, selectedRows: any) => {
|
|
839
|
+
rowsRef.current = {
|
|
840
|
+
selectedRowKeys: selectedRowKeys,
|
|
841
|
+
selectedRows: selectedRows,
|
|
842
|
+
};
|
|
843
|
+
if (value.rowSelection && typeof value.rowSelection.onChange === 'function') {
|
|
844
|
+
value.rowSelection.onChange(selectedRowKeys, selectedRows);
|
|
845
|
+
}
|
|
846
|
+
},
|
|
847
|
+
} : false,
|
|
771
848
|
columns: [...getColumns()],
|
|
772
849
|
fields: [...showSearchFields],
|
|
773
850
|
ref: props.forwardedRef || refs,
|
|
@@ -890,7 +967,8 @@ export default (props: any) => {
|
|
|
890
967
|
{/* 列设置弹出框表格 */}
|
|
891
968
|
<SortableTable
|
|
892
969
|
ref={sortTableRef}
|
|
893
|
-
|
|
970
|
+
disableColumnFixed={props.tableProps?.isVirtualTable}
|
|
971
|
+
setShowColumns={setResizeShowColumns}
|
|
894
972
|
showColumn={showColumn}
|
|
895
973
|
setInitialTableInfo={setInitialTableInfo}
|
|
896
974
|
datasource={value?.columns || []}
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
SortableElement,
|
|
16
16
|
SortableHandle,
|
|
17
17
|
} from 'react-sortable-hoc';
|
|
18
|
-
import request from '@/utils/
|
|
18
|
+
import request from '@/utils/cachedRequest';
|
|
19
19
|
import { SearchOutlined } from '@ant-design/icons';
|
|
20
20
|
import { arrayMoveImmutable } from 'array-move';
|
|
21
21
|
import shezhi from '../../../assets/icon-shezhi.svg';
|
|
@@ -48,9 +48,10 @@ class SortableTable extends React.Component {
|
|
|
48
48
|
bsTableCode: '', //设置table 列的标识
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
patchUserColumnConfig = (config) => {
|
|
51
|
+
patchUserColumnConfig = (config: any, tableCode: any) => {
|
|
52
52
|
const { appRequestConfig } = this.props;
|
|
53
53
|
let that = this;
|
|
54
|
+
const newTableCode = tableCode || that.state.bsTableCode;
|
|
54
55
|
let configvalue = config
|
|
55
56
|
? config.map((item) => ({
|
|
56
57
|
key: item.key,
|
|
@@ -65,12 +66,12 @@ class SortableTable extends React.Component {
|
|
|
65
66
|
url: handleRequestUrl('/user','/appConfig/saveUserOrder', appRequestConfig),
|
|
66
67
|
method: 'POST',
|
|
67
68
|
data: {
|
|
68
|
-
code:
|
|
69
|
+
code: newTableCode,
|
|
69
70
|
detail: configvalue ? JSON.stringify(configvalue) : '',
|
|
70
71
|
},
|
|
71
72
|
}).then((res:any) => {
|
|
72
73
|
if (judgeIsRequestSuccess(res?.data)) {
|
|
73
|
-
this.patchConfigToLocalstorage(configvalue);
|
|
74
|
+
this.patchConfigToLocalstorage(configvalue, newTableCode, config);
|
|
74
75
|
resolve({ status: '0' });
|
|
75
76
|
} else {
|
|
76
77
|
message.error('保存表头列自定义失败,请稍后尝试');
|
|
@@ -93,20 +94,22 @@ class SortableTable extends React.Component {
|
|
|
93
94
|
return [];
|
|
94
95
|
};
|
|
95
96
|
|
|
96
|
-
patchConfigToLocalstorage = (configvalue) => {
|
|
97
|
+
patchConfigToLocalstorage = (configvalue, tableCode: any, newDataSource: any) => {
|
|
97
98
|
const { setShowColumns, datasource = [] } = this.props;
|
|
98
99
|
const { sortDataSource, bsTableCode } = this.state;
|
|
100
|
+
|
|
101
|
+
const sourceList = newDataSource || sortDataSource;
|
|
99
102
|
let config =
|
|
100
103
|
localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]';
|
|
101
104
|
let configArray = JSON.parse(config);
|
|
102
105
|
let currentSetting = configArray.filter(
|
|
103
|
-
(item) => item.code ===
|
|
106
|
+
(item) => item.code === tableCode,
|
|
104
107
|
);
|
|
105
108
|
if (currentSetting.length) {
|
|
106
109
|
currentSetting[0].detail = JSON.stringify(configvalue);
|
|
107
110
|
} else {
|
|
108
111
|
configArray.push({
|
|
109
|
-
code:
|
|
112
|
+
code: tableCode,
|
|
110
113
|
detail: JSON.stringify(configvalue),
|
|
111
114
|
});
|
|
112
115
|
}
|
|
@@ -119,7 +122,7 @@ class SortableTable extends React.Component {
|
|
|
119
122
|
visible: false,
|
|
120
123
|
});
|
|
121
124
|
if (configvalue) {
|
|
122
|
-
setShowColumns([...
|
|
125
|
+
setShowColumns([...sourceList]);
|
|
123
126
|
} else {
|
|
124
127
|
this.setState({
|
|
125
128
|
isDefaultValue: true,
|
|
@@ -140,6 +143,30 @@ class SortableTable extends React.Component {
|
|
|
140
143
|
}
|
|
141
144
|
};
|
|
142
145
|
|
|
146
|
+
isColumnsChange = (pre=[], next=[]) => {
|
|
147
|
+
const preKeyStr = pre.map(item => item.key || item.dataIndex).join(',');
|
|
148
|
+
const nextKeyStr = next.map(item => item.key || item.dataIndex).join(',');
|
|
149
|
+
return preKeyStr !== nextKeyStr;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// 提取逻辑到单独的方法
|
|
153
|
+
validateLocalStorageConfig = (datasource: any, tableCode: string) => {
|
|
154
|
+
let config = localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]';
|
|
155
|
+
let configArray = JSON.parse(config);
|
|
156
|
+
let currentSetting = configArray.filter((item: any) => item.code === tableCode);
|
|
157
|
+
let configvalue = currentSetting?.[0]?.detail ? JSON.parse(currentSetting[0].detail) : [];
|
|
158
|
+
if (currentSetting.length === 0 || configvalue.length === 0) {
|
|
159
|
+
this.patchUserColumnConfig(datasource || [], tableCode);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
componentWillReceiveProps(nextProps: any) {
|
|
164
|
+
if (this.isColumnsChange(this.props?.datasource, nextProps?.datasource)) {
|
|
165
|
+
//this.setInitValue(nextProps?.datasource || []);
|
|
166
|
+
this.validateLocalStorageConfig(nextProps?.datasource, nextProps?.bsTableCode);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
143
170
|
setInitValue = (isClick = false) => {
|
|
144
171
|
const { datasource, showColumn }: any = this.props;
|
|
145
172
|
let config = this.getConfigFromlocalstorage();
|
|
@@ -188,6 +215,8 @@ class SortableTable extends React.Component {
|
|
|
188
215
|
const { datasource, showColumn, bsTableCode }: any = this.props;
|
|
189
216
|
let config = this.getConfigFromlocalstorage();
|
|
190
217
|
|
|
218
|
+
this.validateLocalStorageConfig(datasource, bsTableCode);
|
|
219
|
+
|
|
191
220
|
this.setState({
|
|
192
221
|
dataSource: datasource.map((item) => {
|
|
193
222
|
let innerItem = config.filter((inneritem) => {
|
|
@@ -259,6 +288,9 @@ class SortableTable extends React.Component {
|
|
|
259
288
|
title: '列首',
|
|
260
289
|
dataIndex: 'fixedLeft',
|
|
261
290
|
render: (text, record) => {
|
|
291
|
+
if(this.props.disableColumnFixed) {
|
|
292
|
+
return null
|
|
293
|
+
}
|
|
262
294
|
return (
|
|
263
295
|
<span
|
|
264
296
|
onClick={() => {
|
|
@@ -346,6 +378,9 @@ class SortableTable extends React.Component {
|
|
|
346
378
|
title: '列尾',
|
|
347
379
|
dataIndex: 'fixedRight',
|
|
348
380
|
render: (text, record) => {
|
|
381
|
+
if(this.props.disableColumnFixed) {
|
|
382
|
+
return null
|
|
383
|
+
}
|
|
349
384
|
return (
|
|
350
385
|
<span
|
|
351
386
|
onClick={() => {
|
|
@@ -544,7 +579,7 @@ class SortableTable extends React.Component {
|
|
|
544
579
|
DraggableContainer = (props) => (
|
|
545
580
|
<SortableBody
|
|
546
581
|
useDragHandle
|
|
547
|
-
|
|
582
|
+
lockAxis='y'
|
|
548
583
|
helperClass="row-dragging"
|
|
549
584
|
onSortEnd={this.onSortEnd}
|
|
550
585
|
{...props}
|
|
@@ -555,9 +590,9 @@ class SortableTable extends React.Component {
|
|
|
555
590
|
const { sortDataSource } = this.state;
|
|
556
591
|
// function findIndex base on Table rowKey props and should always be a right array index
|
|
557
592
|
const index = sortDataSource.findIndex(
|
|
558
|
-
(x) => x.key
|
|
593
|
+
(x) => (x.key||x.dataIndex) == restProps['data-row-key'],
|
|
559
594
|
);
|
|
560
|
-
return <SortableItem index={index} {...restProps} />;
|
|
595
|
+
return <SortableItem key={restProps['data-row-key']} index={index} {...restProps} />;
|
|
561
596
|
};
|
|
562
597
|
|
|
563
598
|
|
|
@@ -918,6 +953,7 @@ class SortableTable extends React.Component {
|
|
|
918
953
|
row: this.DraggableBodyRow,
|
|
919
954
|
},
|
|
920
955
|
}}
|
|
956
|
+
scroll={{ y: 364 }}
|
|
921
957
|
/>
|
|
922
958
|
</div>
|
|
923
959
|
</div>
|