@bit-sun/business-component 2.2.0-alpha.4 → 2.2.0-alpha.46

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 (196) hide show
  1. package/.editorconfig +16 -16
  2. package/.fatherrc.ts +5 -5
  3. package/.gitlab-ci.yml +179 -179
  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/components/Business/AddSelectBusiness/index.d.ts +2 -0
  9. package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.d.ts +1 -1
  10. package/dist/components/Business/BsLayouts/Components/CustomerMenu/index.d.ts +1 -1
  11. package/dist/components/Business/BsLayouts/utils.d.ts +0 -4
  12. package/dist/components/Business/BsSulaQueryTable/SearchItemSetting.d.ts +60 -0
  13. package/dist/components/Business/BsSulaQueryTable/setting.d.ts +1 -0
  14. package/dist/components/Business/JsonQueryTable/static.d.ts +2 -0
  15. package/dist/components/Business/SearchSelect/index.d.ts +1 -1
  16. package/dist/components/Business/moreTreeTable/FixedScrollBar.d.ts +3 -0
  17. package/dist/components/Business/moreTreeTable/hooks/useSticky.d.ts +8 -0
  18. package/dist/components/Functional/AddSelect/helps.d.ts +1 -0
  19. package/dist/components/Functional/SearchSelect/index.d.ts +1 -1
  20. package/dist/index.esm.js +4683 -2535
  21. package/dist/index.js +4690 -2540
  22. package/dist/utils/LocalstorageUtils.d.ts +15 -0
  23. package/dist/utils/enumConfig.d.ts +1 -0
  24. package/dist/utils/index.d.ts +1 -0
  25. package/dist/utils/utils.d.ts +1 -1
  26. package/docs/index.md +21 -21
  27. package/lib/assets/drag.svg +17 -17
  28. package/lib/assets/exportFail.svg +37 -37
  29. package/lib/assets/exportProcessing.svg +28 -28
  30. package/lib/assets/exportSuccess.svg +34 -34
  31. package/lib/assets/label_icon_bottom.svg +25 -25
  32. package/lib/assets/upExport.svg +22 -22
  33. package/package.json +77 -77
  34. package/src/assets/32.svg +27 -27
  35. package/src/assets/addIcon.svg +17 -17
  36. package/src/assets/allfunc.svg +27 -27
  37. package/src/assets/arrowRight.svg +24 -24
  38. package/src/assets/btn-delete.svg +29 -29
  39. package/src/assets/btn-edit.svg +19 -19
  40. package/src/assets/btn-more.svg +17 -17
  41. package/src/assets/btn-submit.svg +19 -19
  42. package/src/assets/caidan.svg +11 -11
  43. package/src/assets/close.svg +26 -26
  44. package/src/assets/drag.svg +17 -17
  45. package/src/assets/exportFail.svg +37 -37
  46. package/src/assets/exportProcessing.svg +28 -28
  47. package/src/assets/exportSuccess.svg +34 -34
  48. package/src/assets/fixed-left-active.svg +11 -11
  49. package/src/assets/fixed-left.svg +15 -15
  50. package/src/assets/fixed-right-active.svg +11 -11
  51. package/src/assets/fixed-right.svg +15 -15
  52. package/src/assets/guanbi.svg +15 -15
  53. package/src/assets/icon-quanping.svg +15 -15
  54. package/src/assets/icon-shezhi.svg +17 -17
  55. package/src/assets/label_icon_bottom.svg +25 -25
  56. package/src/assets/list-no-img.svg +21 -21
  57. package/src/assets/morentouxiang-32.svg +23 -23
  58. package/src/assets/scanning.svg +24 -24
  59. package/src/assets/upExport.svg +22 -22
  60. package/src/components/Business/AddSelectBusiness/index.md +161 -63
  61. package/src/components/Business/AddSelectBusiness/index.tsx +887 -344
  62. package/src/components/Business/BsLayouts/Components/AllFunc/drawContent.tsx +111 -111
  63. package/src/components/Business/BsLayouts/Components/AllFunc/index.less +153 -153
  64. package/src/components/Business/BsLayouts/Components/AllFunc/index.tsx +70 -70
  65. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.less +90 -90
  66. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.tsx +37 -37
  67. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.tsx +242 -242
  68. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.tsx +384 -384
  69. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.tsx +285 -285
  70. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.tsx +74 -74
  71. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/drawContent.less +170 -170
  72. package/src/components/Business/BsLayouts/Components/CustomerMenu/index.less +64 -64
  73. package/src/components/Business/BsLayouts/Components/CustomerMenu/index.tsx +153 -153
  74. package/src/components/Business/BsLayouts/Components/GlobalHeader/index.less +72 -72
  75. package/src/components/Business/BsLayouts/Components/GlobalHeader/index.tsx +157 -157
  76. package/src/components/Business/BsLayouts/Components/RightContent/LoginModal.tsx +85 -85
  77. package/src/components/Business/BsLayouts/Components/RightContent/home.less +218 -218
  78. package/src/components/Business/BsLayouts/Components/RightContent/index.tsx +155 -156
  79. package/src/components/Business/BsLayouts/Components/SearchFunc/index.less +160 -160
  80. package/src/components/Business/BsLayouts/Components/SearchFunc/index.tsx +75 -75
  81. package/src/components/Business/BsLayouts/index.less +79 -79
  82. package/src/components/Business/BsLayouts/index.tsx +1484 -1475
  83. package/src/components/Business/BsLayouts/service.ts +10 -10
  84. package/src/components/Business/BsLayouts/utils.tsx +203 -226
  85. package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +564 -0
  86. package/src/components/Business/BsSulaQueryTable/index.less +221 -219
  87. package/src/components/Business/BsSulaQueryTable/index.tsx +527 -471
  88. package/src/components/Business/BsSulaQueryTable/setting.tsx +832 -802
  89. package/src/components/Business/BsSulaQueryTable/utils.less +65 -65
  90. package/src/components/Business/BsSulaQueryTable/utils.tsx +688 -688
  91. package/src/components/Business/CommodityEntry/index.md +70 -70
  92. package/src/components/Business/CommodityEntry/index.tsx +80 -80
  93. package/src/components/Business/CommonAlert/index.tsx +23 -23
  94. package/src/components/Business/CommonGuideWrapper/index.less +111 -111
  95. package/src/components/Business/CommonGuideWrapper/index.md +39 -39
  96. package/src/components/Business/CommonGuideWrapper/index.tsx +83 -83
  97. package/src/components/Business/DetailPageWrapper/index.less +79 -79
  98. package/src/components/Business/DetailPageWrapper/index.tsx +313 -313
  99. package/src/components/Business/DetailPageWrapper/utils.tsx +100 -100
  100. package/src/components/Business/HomePageWrapper/index.less +33 -33
  101. package/src/components/Business/HomePageWrapper/index.md +45 -45
  102. package/src/components/Business/HomePageWrapper/index.tsx +162 -162
  103. package/src/components/Business/JsonQueryTable/components/FieldsModifyModal.tsx +824 -824
  104. package/src/components/Business/JsonQueryTable/components/FieldsSettingsTable.tsx +205 -201
  105. package/src/components/Business/JsonQueryTable/components/Formula.tsx +205 -205
  106. package/src/components/Business/JsonQueryTable/components/MaintainOptions.tsx +127 -127
  107. package/src/components/Business/JsonQueryTable/configButton/index.js +20 -20
  108. package/src/components/Business/JsonQueryTable/configTree/component/compactArrayView.js +25 -25
  109. package/src/components/Business/JsonQueryTable/configTree/component/compactObjectView.js +30 -30
  110. package/src/components/Business/JsonQueryTable/configTree/index.js +82 -82
  111. package/src/components/Business/JsonQueryTable/configTree/index.less +44 -44
  112. package/src/components/Business/JsonQueryTable/configTree/parser/highlight.js +57 -57
  113. package/src/components/Business/JsonQueryTable/configTree/parser/index.js +124 -124
  114. package/src/components/Business/JsonQueryTable/configTree/render/iconRender.js +29 -29
  115. package/src/components/Business/JsonQueryTable/configTree/render/nameRender.js +22 -22
  116. package/src/components/Business/JsonQueryTable/configTree/treeNode.js +116 -116
  117. package/src/components/Business/JsonQueryTable/drawer/index.tsx +12 -12
  118. package/src/components/Business/JsonQueryTable/function.ts +62 -62
  119. package/src/components/Business/JsonQueryTable/index.less +16 -16
  120. package/src/components/Business/JsonQueryTable/index.md +328 -328
  121. package/src/components/Business/JsonQueryTable/index.tsx +535 -320
  122. package/src/components/Business/JsonQueryTable/jsonEditor/index.js +346 -346
  123. package/src/components/Business/JsonQueryTable/jsonEditor/index.less +22 -22
  124. package/src/components/Business/JsonQueryTable/jsonEditor/lint/basicType.js +147 -147
  125. package/src/components/Business/JsonQueryTable/jsonEditor/lint/index.js +389 -389
  126. package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/actions.js +118 -118
  127. package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/dependency.js +22 -22
  128. package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/index.js +21 -21
  129. package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/request.js +65 -65
  130. package/src/components/Business/JsonQueryTable/static.ts +390 -356
  131. package/src/components/Business/SearchSelect/BusinessUtils.ts +1732 -1586
  132. package/src/components/Business/SearchSelect/common.ts +53 -53
  133. package/src/components/Business/SearchSelect/index.md +1319 -1254
  134. package/src/components/Business/SearchSelect/index.tsx +55 -52
  135. package/src/components/Business/SearchSelect/utils.ts +100 -100
  136. package/src/components/Business/StateFlow/index.less +130 -130
  137. package/src/components/Business/StateFlow/index.md +60 -60
  138. package/src/components/Business/StateFlow/index.tsx +29 -29
  139. package/src/components/Business/TreeSearchSelect/index.md +154 -126
  140. package/src/components/Business/TreeSearchSelect/index.tsx +34 -34
  141. package/src/components/Business/TreeSearchSelect/utils.ts +69 -60
  142. package/src/components/Business/columnSettingTable/columnSetting.tsx +764 -764
  143. package/src/components/Business/columnSettingTable/index.less +247 -247
  144. package/src/components/Business/columnSettingTable/index.md +357 -357
  145. package/src/components/Business/columnSettingTable/index.tsx +232 -232
  146. package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +240 -240
  147. package/src/components/Business/columnSettingTable/utils.tsx +68 -68
  148. package/src/components/Business/moreTreeTable/FixedScrollBar.tsx +86 -0
  149. package/src/components/Business/moreTreeTable/hooks/useSticky.ts +21 -0
  150. package/src/components/Business/moreTreeTable/index.less +99 -99
  151. package/src/components/Business/moreTreeTable/index.md +448 -508
  152. package/src/components/Business/moreTreeTable/index.tsx +380 -315
  153. package/src/components/Business/moreTreeTable/utils.ts +126 -126
  154. package/src/components/Functional/AddSelect/helps.ts +14 -0
  155. package/src/components/Functional/AddSelect/index.less +367 -367
  156. package/src/components/Functional/AddSelect/index.md +155 -155
  157. package/src/components/Functional/AddSelect/index.tsx +1279 -1072
  158. package/src/components/Functional/BillEntry/index.less +371 -371
  159. package/src/components/Functional/BillEntry/index.md +39 -39
  160. package/src/components/Functional/BillEntry/index.tsx +772 -766
  161. package/src/components/Functional/DataImport/index.less +63 -63
  162. package/src/components/Functional/DataImport/index.md +44 -44
  163. package/src/components/Functional/DataImport/index.tsx +695 -695
  164. package/src/components/Functional/DataValidation/index.less +63 -63
  165. package/src/components/Functional/DataValidation/index.md +39 -39
  166. package/src/components/Functional/DataValidation/index.tsx +687 -687
  167. package/src/components/Functional/ExportFunctions/ExportIcon/index.md +37 -37
  168. package/src/components/Functional/ExportFunctions/ExportIcon/index.tsx +59 -59
  169. package/src/components/Functional/QueryMutipleInput/index.less +37 -37
  170. package/src/components/Functional/QueryMutipleInput/index.md +33 -33
  171. package/src/components/Functional/QueryMutipleInput/index.tsx +128 -128
  172. package/src/components/Functional/SearchSelect/index.less +115 -115
  173. package/src/components/Functional/SearchSelect/index.md +141 -141
  174. package/src/components/Functional/SearchSelect/index.tsx +858 -813
  175. package/src/components/Functional/SearchSelect/utils.ts +3 -3
  176. package/src/components/Functional/TreeSearchSelect/index.md +47 -47
  177. package/src/components/Functional/TreeSearchSelect/index.tsx +162 -160
  178. package/src/index.ts +34 -34
  179. package/src/plugin/TableColumnSetting/index.less +247 -247
  180. package/src/plugin/TableColumnSetting/index.md +50 -50
  181. package/src/plugin/TableColumnSetting/index.tsx +724 -724
  182. package/src/plugin/TableColumnSetting/utils.ts +19 -19
  183. package/src/styles/bsDefault.less +1912 -1906
  184. package/src/utils/CheckOneUser/index.md +39 -39
  185. package/src/utils/CheckOneUser/index.ts +51 -51
  186. package/src/utils/LocalstorageUtils.ts +95 -33
  187. package/src/utils/TableUtils.tsx +18 -18
  188. package/src/utils/checkUtils.ts +39 -39
  189. package/src/utils/enumConfig.ts +11 -10
  190. package/src/utils/getFormMode.js +12 -12
  191. package/src/utils/index.ts +3 -2
  192. package/src/utils/requestUtils.ts +34 -33
  193. package/src/utils/serialize.js +7 -7
  194. package/src/utils/utils.ts +183 -183
  195. package/tsconfig.json +29 -29
  196. package/typings.d.ts +4 -4
@@ -1,471 +1,527 @@
1
- // @ts-nocheck
2
- import React, { useState, useEffect, useRef, useMemo } from 'react';
3
- import { useLocation } from 'umi';
4
- import { QueryTable } from 'bssula';
5
- import {
6
- userColumns,
7
- getItemDefaultWidth,
8
- authFn,
9
- queryParams,
10
- } from './utils';
11
- import { Menu, Tooltip, } from 'antd';
12
- import SortableTable from './setting';
13
- import { Resizable } from 'react-resizable';
14
- import quanping from '../../../assets/icon-quanping.svg';
15
- import scanning from '../../../assets/scanning.svg';
16
- import { debounce } from 'lodash';
17
- import ExportIcon from '@/components/Functional/ExportFunctions/ExportIcon';
18
- import ENUM from '@/utils/enumConfig';
19
- import { handleBssulaColumnsSpecialParams } from '@/utils/utils';
20
-
21
- const MemoQueryTable = React.memo(QueryTable);
22
-
23
- const ResizeableTitle = (props) => {
24
- const { onResize, width, ...restProps } = props;
25
-
26
- if (!width) {
27
- return <th {...restProps} />;
28
- }
29
- return (
30
- <Resizable
31
- width={width}
32
- height={0}
33
- onResize={onResize}
34
- draggableOpts={{ enableUserSelectHack: false }}
35
- >
36
- <th {...restProps} />
37
- </Resizable>
38
- );
39
- };
40
-
41
- export default (props: any) => {
42
- const refs = useRef(null);
43
- const [pagePath, setPagePath] = useState('');
44
- // 获取 table columns中所有的 key 防止有的地方是 dataindex
45
- const [checkedList, setCheckedList] = useState(
46
- props.columns.filter((col: any) => !col.hidden).map((d: any) => Array.isArray(d.key || d.dataIndex) ? JSON.stringify(d.key || d.dataIndex) : (d.key || d.dataIndex)),
47
- );
48
- const { pathname } = useLocation();
49
- const [id]: any = useState(
50
- Number(Math.random().toString().substr(2, 0) + Date.now()).toString(36),
51
- );
52
- const [isFullScreen, setIsFnllScreen]: any = useState(false);
53
- // @ts-nocheck
54
- const [value, setValue]: any = useState(props);
55
- const [showColumn, setShowColumns] = useState([]);
56
-
57
- const { isPage = true, pagination, tableCode } = props;
58
-
59
- const [height, setHeight]: any = useState('100vh');
60
- const sortTableRef = useRef(null);
61
-
62
- const bsTableCode = tableCode || window.location.hash; //设置列字段的唯一标识
63
- // 获取table高度
64
- const getTableHeight = () => {
65
- setTimeout(() => {
66
- const cancelHeight = window.top == window ? 303 : 223;
67
- const isFullScreen: any =
68
- window.top.document.fullScreen ||
69
- window.top.document.webkitIsFullScreen ||
70
- window.top.document.mozFullScreen;
71
- const h =
72
- document.body.clientHeight -
73
- (document.querySelector(`.ant-tabs-tabpane-active .table-bssula-summary`)?.clientHeight || 0) -
74
- (document.querySelector(`.ant-tabs-tabpane-active .list_top_tab .ant-tabs-nav`)?.clientHeight || 0) -
75
- (document.querySelector(`.ant-tabs-tabpane-active .ant-form ant-form-horizontal`)?.clientHeight ||
76
- 0) -
77
- (isFullScreen
78
- ? 0
79
- : document.querySelector(`.ant-tabs-tabpane-active .ant-pro-page-container-warp`)
80
- ?.clientHeight || 0) -
81
- cancelHeight +
82
- 'px';
83
- setHeight(h);
84
- setValue({ ...value });
85
- }, 0)
86
- };
87
-
88
- //监测是否按下esc键
89
- function checkFull() {
90
- let globalDocument = window?.parent?.document || document;
91
- var isFull =
92
- globalDocument.fullscreenElement ||
93
- globalDocument.mozFullScreenElement ||
94
- globalDocument.webkitFullscreenElement;
95
- if (isFull == undefined) isFull = false;
96
- return isFull;
97
- }
98
-
99
- const getConfigFromlocalstorage = () => {
100
- let config = localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]';
101
- let configArray = JSON.parse(config);
102
- let configSetting = configArray.filter(
103
- (item) => item.code === bsTableCode,
104
- );
105
-
106
- if (configSetting.length && configSetting[0].detail) {
107
- return JSON.parse(configSetting[0].detail);
108
- }
109
- return [];
110
- };
111
-
112
- const setInitialTableInfo = () => {
113
- const resourceCodeArray = {};
114
- if (props.actionsRender && props.actionsRender.length) {
115
- props.actionsRender.forEach((item: any) => {
116
- if (item.code) {
117
- if (resourceCodeArray[item.code]) {
118
- resourceCodeArray[item.code + 1] = item;
119
- } else {
120
- resourceCodeArray[item.code] = item;
121
- }
122
- }
123
- });
124
- }
125
- if (props.columns && props.columns.length) {
126
- props.columns.forEach((d: any) => {
127
- if (d.isPermissionColumn && d.render && d.render.length) {
128
- d.render.forEach((inneritem: any) => {
129
- if (inneritem.code) {
130
- if (resourceCodeArray[inneritem.code]) {
131
- resourceCodeArray[inneritem.code + 1] = inneritem;
132
- } else {
133
- resourceCodeArray[inneritem.code] = inneritem;
134
- }
135
- }
136
- });
137
- }
138
- handleBssulaColumnsSpecialParams(d);
139
- });
140
- setCommonRenderFn(props.columns);
141
- const authButton = localStorage.getItem(ENUM.BROWSER_CACHE.MAIN_AUTH_CODES)
142
- ? JSON.parse(localStorage.getItem(ENUM.BROWSER_CACHE.MAIN_AUTH_CODES) as string)
143
- : [];
144
- Object.keys(resourceCodeArray).forEach((item: any) => {
145
- let Item = item;
146
- if (Number(item.slice(-1)) >= 1) {
147
- Item = item.substr(0, item.length - 1);
148
- }
149
- if (!authButton.filter((itemInner: any) => Item === itemInner).length) {
150
- resourceCodeArray[item].visible = false;
151
- }
152
- });
153
-
154
- }
155
- setValue({
156
- ...value,
157
- columns: [...props.columns],
158
- });
159
- const { columns } = props;
160
- let columnConfig = getConfigFromlocalstorage();
161
- let showColumns = columnConfig.length ? columnConfig.map((item) => {
162
- let inner = columns.filter(
163
- (inneritem) => {
164
- let innerKey = Array.isArray(inneritem.key || inneritem.dataIndex) ? JSON.stringify(inneritem.key || inneritem.dataIndex) : (inneritem.key || inneritem.dataIndex);
165
- let itemKey = Array.isArray(item.key || item.dataIndex) ? JSON.stringify(item.key || item.dataIndex) : (item.key || item.dataIndex);
166
- return innerKey && innerKey === itemKey;
167
- }
168
- )[0];
169
-
170
- return {
171
- ...inner,
172
- ...item,
173
- };
174
- }) : columns.filter(
175
- (column) => {
176
- let columnKey = Array.isArray(column.key || column.dataIndex) ? JSON.stringify(column.key || column.dataIndex) : (column.key || column.dataIndex);
177
- return column.notRegularCheckList || checkedList.indexOf(columnKey) > -1;
178
- }
179
- )
180
-
181
- showColumns.forEach((item, index) => {
182
- item.width = item.width || getItemDefaultWidth(item);
183
- handleBssulaColumnsSpecialParams(item);
184
- item.onHeaderCell = (column) => ({
185
- ...item,
186
- width:
187
- typeof column.width === 'number'
188
- ? column.width
189
- : parseInt(column.width.replace('px', '')),
190
- onResize: handleResize(index),
191
- });
192
- });
193
- setShowColumns([...showColumns]);
194
- }
195
-
196
- //组件初始挂载
197
- useEffect(() => {
198
- getTableHeight();
199
- setInitialTableInfo();
200
- window.addEventListener('resize', (e) => {
201
- watchWinResize();
202
- });
203
-
204
- setPagePath(pathname); // 做处理,记录当前页面渲染的初始pathname,用于进行判断当前列表页面数据是否需要重新渲染
205
- }, []);
206
-
207
- useEffect(() => {
208
- if (props?.columns && value?.columns) {
209
- let newKeys = props.columns.map((d: any) => Array.isArray(d.key || d.dataIndex) ? JSON.stringify(d.key || d.dataIndex) : (d.key || d.dataIndex));
210
- let oldKeys = value.columns.map((d: any) => Array.isArray(d.key || d.dataIndex) ? JSON.stringify(d.key || d.dataIndex) : (d.key || d.dataIndex));
211
- JSON.stringify(newKeys) !== JSON.stringify(oldKeys) && setInitialTableInfo();
212
- }
213
- }, [props?.columns])
214
-
215
- useEffect(() => {
216
- setInitialTableInfo();
217
- }, [props?.refreshColumns]);
218
-
219
-
220
- const watchWinResize = debounce(() => {
221
- getTableHeight();
222
- if (!checkFull()) {
223
- // addTabsNavStyle(true);
224
- // 全屏下按键esc后要执行的动作
225
- // isFullScreen 为true 此时为全屏状态 false 为非全屏状态
226
- if (!isFullScreen) {
227
- // 按下esc键退出全屏
228
- setIsFnllScreen(false);
229
- } else {
230
- setIsFnllScreen(false);
231
- }
232
- }
233
- }, 10);
234
-
235
- const setCommonRenderFn = (columns: any[]) => {
236
- columns.forEach((column) => {
237
- if (column.showDetailUserInfo) {
238
- column.render = ({ text }: any) => userColumns({ name: text });
239
- }
240
- });
241
- };
242
-
243
- // 处理 table 基本参数
244
- const setTableProps = () => {
245
- let tableProps = value.tableProps || {};
246
- tableProps = {
247
- ...tableProps,
248
- size: value.size || 'middle',
249
- defaultPageSize: 20,
250
- pageSize: 20,
251
- initialPaging: {
252
- pagination: pagination
253
- ? false
254
- : {
255
- defaultPageSize: 20,
256
- pageSize: 20,
257
- showTotal: (total: any) => `共 ${total} 条`,
258
- showQuickJumper: true,
259
- hideOnSinglePage: value.hideOnSinglePage || false,
260
- },
261
- },
262
- initialSelectedRowKeys: value.initialSelectedRowKeys || [],
263
- expandable: value.expandable,
264
- scroll: { x: props.overScrollX || 'max-content', y: height },
265
- bordered: value.bordered || false,
266
- sticky: true,
267
- rowClassName: (record: object | null | undefined, index: number) =>
268
- index % 2 === 0 ? 'table_base' : 'table_odd',
269
- ...value.tableProps,
270
- components: {
271
- header: {
272
- cell: ResizeableTitle,
273
- },
274
- },
275
- };
276
-
277
- // @ts-ignore
278
- if (tableProps?.initialPaging?.pagination) {
279
- // @ts-ignore
280
- tableProps.initialPaging.pagination.showSizeChanger = true;
281
- }
282
- return tableProps;
283
- };
284
-
285
-
286
- const ShowFullScreen = () => {
287
- const isFullScreen: any =
288
- window.top.document.fullScreen ||
289
- window.top.document.webkitIsFullScreen ||
290
- window.top.document.mozFullScreen;
291
- let contentEle: any = window.top.document.querySelector(`body`);
292
- // addTabsNavStyle(isFullScreen);
293
- if (contentEle && !isFullScreen) {
294
- let fullScreenEle =
295
- contentEle.requestFullscreen ||
296
- contentEle.mozRequestFullScreen ||
297
- contentEle.webkitRequestFullScreen ||
298
- contentEle.msRequestFullscreen;
299
- if (fullScreenEle) {
300
- fullScreenEle.call(contentEle);
301
- setIsFnllScreen(true);
302
- // getTableHeight(true);
303
- return;
304
- }
305
- }
306
- if (window.top.document && isFullScreen) {
307
- let exitFullScreen =
308
- window.top.document.exitFullscreen ||
309
- window.top.document.mozCancelFullScreen ||
310
- window.top.document.webkitCancelFullScreen ||
311
- window.top.document.msExitFullscreen;
312
- if (exitFullScreen) {
313
- exitFullScreen.call(window.top.document);
314
- setIsFnllScreen(false);
315
- // getTableHeight();
316
- return;
317
- }
318
- }
319
- };
320
-
321
- const handleTimeValue = () => {
322
- let actionsRender = value.actionsRender || [];
323
- actionsRender = [
324
- ...actionsRender,
325
- {
326
- type: 'text',
327
- props: {
328
- children: (
329
- <>
330
- <Tooltip title="列设置">
331
- <span className="ant-dropdown-link">
332
- <SortableTable
333
- ref={sortTableRef}
334
- setShowColumns={setShowColumns}
335
- showColumn={showColumn}
336
- datasource={value?.columns || []}
337
- bsTableCode={bsTableCode}
338
- />
339
- </span>
340
- </Tooltip>
341
- </>
342
- ),
343
- },
344
- },
345
- {
346
- type: 'text',
347
- props: {
348
- children: (
349
- <a>
350
- {isFullScreen ? (
351
- <Tooltip title="取消全屏">
352
- <img
353
- onClick={() => {
354
- ShowFullScreen();
355
- }}
356
- width={32}
357
- src={scanning}
358
- />
359
- </Tooltip>
360
- ) : (
361
- <Tooltip title="全屏">
362
- <img
363
- onClick={() => {
364
- ShowFullScreen();
365
- }}
366
- width={32}
367
- src={quanping}
368
- />
369
- </Tooltip>
370
- )}
371
- </a>
372
- ),
373
- },
374
- },
375
- {
376
- type: 'text',
377
- props: {
378
- children:
379
- value?.exportConfig && authFn(value?.exportConfig?.code) ? (
380
- <ExportIcon
381
- request={{
382
- url: `/oms-ops/excel/exportAsync/${value?.exportConfig?.type}`,
383
- params: value?.exportConfig?.params || queryParams,
384
- }}
385
- tableRef={props.forwardedRef || refs}
386
- />
387
- ) : (
388
- <span />
389
- ),
390
- },
391
- },
392
- ];
393
- if (value.rowSelection) {
394
- value.rowSelection.columnWidth = 50;
395
- }
396
- return {
397
- ...value,
398
- actionsRender,
399
- };
400
- };
401
-
402
- const handleResize =
403
- (index) =>
404
- (e, { size }) => {
405
- setShowColumns((columns: any) => {
406
- let newColumns = [...columns];
407
- newColumns[index] = {
408
- ...newColumns[index],
409
- width: size.width,
410
- };
411
- newColumns.forEach((d: any) => {
412
- handleBssulaColumnsSpecialParams(d);
413
- })
414
- return [...newColumns];
415
- });
416
- };
417
-
418
- const setVisibleColumn = (columnTitle: string) => {
419
- sortTableRef?.current?.handleTableHeadHidden?.(columnTitle);
420
- };
421
-
422
- const config = {
423
- visibleFieldsCount: 3,
424
- tableWrapperStyle: {
425
- padding: '10px',
426
- background: '#f3f3f3',
427
- },
428
- setVisibleColumn: setVisibleColumn,
429
- itemLayout: {
430
- span: 8, // 栅格占位格数
431
- labelCol: {
432
- // label标签布局;可设置 span、offset
433
- span: 8,
434
- },
435
- wrapperCol: {
436
- // value布局, 方式同labelCol(horizontal状态下配置)
437
- span: 16,
438
- },
439
- },
440
- rowSelection: false, // 默认无多选
441
- ...handleTimeValue(),
442
- tableProps: setTableProps(),
443
- columns: [...showColumn],
444
- ref: props.forwardedRef || refs,
445
- isFullScreen,
446
- };
447
-
448
- useEffect(() => {
449
- if (!localStorage.getItem('isTabChange')) {
450
- if (pagePath === pathname) {
451
- // @ts-ignore
452
- config.ref?.current?.tableRef?.current?.refreshTable();
453
- }
454
- } else {
455
- setTimeout(() => {
456
- // 处理页面刷新两面
457
- localStorage.removeItem('isTabChange');
458
- }, 0);
459
- }
460
- }, [pathname]);
461
-
462
- const memoConfig = useMemo(
463
- () => ({
464
- ...config,
465
- summary: props.summary,
466
- statusMapping: props.statusMapping,
467
- }),
468
- [value, checkedList, showColumn, props.statusMapping],
469
- );
470
- return <MemoQueryTable {...memoConfig} />;
471
- };
1
+ // @ts-nocheck
2
+ import React, { useState, useEffect, useRef, useMemo } from 'react';
3
+ import { useLocation } from 'umi';
4
+ import { QueryTable } from 'bssula';
5
+ import {
6
+ userColumns,
7
+ getItemDefaultWidth,
8
+ authFn,
9
+ queryParams,
10
+ } from './utils';
11
+ import { Menu, Tooltip, Dropdown } from 'antd';
12
+ import SortableTable from './setting';
13
+ import SearchItemTable from "./SearchItemSetting";
14
+ import { Resizable } from 'react-resizable';
15
+ import quanping from '../../../assets/icon-quanping.svg';
16
+ import scanning from '../../../assets/scanning.svg';
17
+ import shezhi from '../../../assets/icon-shezhi.svg';
18
+ import { debounce } from 'lodash';
19
+ import ExportIcon from '@/components/Functional/ExportFunctions/ExportIcon';
20
+ import ENUM from '@/utils/enumConfig';
21
+ import { handleBssulaColumnsSpecialParams } from '@/utils/utils';
22
+
23
+ const MemoQueryTable = React.memo(QueryTable);
24
+
25
+ const ResizeableTitle = (props) => {
26
+ const { onResize, width, ...restProps } = props;
27
+
28
+ if (!width) {
29
+ return <th {...restProps} />;
30
+ }
31
+ return (
32
+ <Resizable
33
+ width={width}
34
+ height={0}
35
+ onResize={onResize}
36
+ draggableOpts={{ enableUserSelectHack: false }}
37
+ >
38
+ <th {...restProps} />
39
+ </Resizable>
40
+ );
41
+ };
42
+
43
+ export default (props: any) => {
44
+ const refs = useRef(null);
45
+ const [pagePath, setPagePath] = useState('');
46
+ // 获取 table columns中所有的 key 防止有的地方是 dataindex
47
+ const [checkedList, setCheckedList] = useState(
48
+ props.columns.filter((col: any) => !col.hidden).map((d: any) => Array.isArray(d.key || d.dataIndex) ? JSON.stringify(d.key || d.dataIndex) : (d.key || d.dataIndex)),
49
+ );
50
+ const { pathname } = useLocation();
51
+ const [id]: any = useState(
52
+ Number(Math.random().toString().substr(2, 0) + Date.now()).toString(36),
53
+ );
54
+ const [isFullScreen, setIsFnllScreen]: any = useState(false);
55
+ // @ts-nocheck
56
+ const [value, setValue]: any = useState(props);
57
+ const [showColumn, setShowColumns] = useState([]); // 列字段
58
+ const [showSearchFields, setShowSearchFields] = useState(props.fields || []); //搜索项字段
59
+ const { isPage = true, pagination, tableCode } = props;
60
+
61
+ const [height, setHeight]: any = useState('100vh');
62
+ const sortTableRef = useRef(null);
63
+
64
+ const bsTableCode = tableCode || window.location.hash; //设置列字段的唯一标识
65
+ // 获取table高度
66
+ const getTableHeight = () => {
67
+ setTimeout(() => {
68
+ const cancelHeight = window.top == window ? 303 : 223;
69
+ const isFullScreen: any =
70
+ window.top.document.fullScreen ||
71
+ window.top.document.webkitIsFullScreen ||
72
+ window.top.document.mozFullScreen;
73
+
74
+ // wujie子应用iframe首次加载获取不到client以及dom元素高度兼容处理
75
+ let realIframeClientHeight = document.body.clientHeight ? document.body.clientHeight : window.top?.document.body.clientHeight - 76;
76
+ let summaryHeight = document.querySelector(`.ant-tabs-tabpane-active .table-bssula-summary`) ?
77
+ (document.querySelector(`.ant-tabs-tabpane-active .table-bssula-summary`)?.clientHeight || 22) : 0;
78
+ let listTabHeight = document.querySelector(`.ant-tabs-tabpane-active .list_top_tab .ant-tabs-nav`) ?
79
+ (document.querySelector(`.ant-tabs-tabpane-active .list_top_tab .ant-tabs-nav`)?.clientHeight || 48) : 0;
80
+
81
+
82
+ const h =
83
+ realIframeClientHeight - summaryHeight - listTabHeight -
84
+ (document.querySelector(`.ant-tabs-tabpane-active .ant-form ant-form-horizontal`)?.clientHeight ||
85
+ 0) -
86
+ (isFullScreen
87
+ ? 0
88
+ : document.querySelector(`.ant-tabs-tabpane-active .ant-pro-page-container-warp`)
89
+ ?.clientHeight || 0) -
90
+ cancelHeight +
91
+ 'px';
92
+ setHeight(h);
93
+ setValue({ ...value });
94
+ }, 0)
95
+ };
96
+
97
+ //监测是否按下esc键
98
+ function checkFull() {
99
+ let globalDocument = window?.parent?.document || document;
100
+ var isFull =
101
+ globalDocument.fullscreenElement ||
102
+ globalDocument.mozFullScreenElement ||
103
+ globalDocument.webkitFullscreenElement;
104
+ if (isFull == undefined) isFull = false;
105
+ return isFull;
106
+ }
107
+
108
+ const getConfigFromlocalstorage = (type: string) => {
109
+ let config = localStorage.getItem(type) || '[]';
110
+ let configArray = JSON.parse(config);
111
+ let configSetting = configArray.filter(
112
+ (item) => item.code === bsTableCode,
113
+ );
114
+
115
+ if (configSetting.length && configSetting[0].detail) {
116
+ return JSON.parse(configSetting[0].detail);
117
+ }
118
+ return [];
119
+ };
120
+
121
+ const setInitialTableInfo = () => {
122
+ const resourceCodeArray = {};
123
+ if (props.actionsRender && props.actionsRender.length) {
124
+ props.actionsRender.forEach((item: any) => {
125
+ if (item.code) {
126
+ if (resourceCodeArray[item.code]) {
127
+ resourceCodeArray[item.code + 1] = item;
128
+ } else {
129
+ resourceCodeArray[item.code] = item;
130
+ }
131
+ }
132
+ });
133
+ }
134
+ if (props.columns && props.columns.length) {
135
+ props.columns.forEach((d: any) => {
136
+ if (d.isPermissionColumn && d.render && d.render.length) {
137
+ d.render.forEach((inneritem: any) => {
138
+ if (inneritem.code) {
139
+ if (resourceCodeArray[inneritem.code]) {
140
+ resourceCodeArray[inneritem.code + 1] = inneritem;
141
+ } else {
142
+ resourceCodeArray[inneritem.code] = inneritem;
143
+ }
144
+ }
145
+ });
146
+ }
147
+ handleBssulaColumnsSpecialParams(d);
148
+ });
149
+ setCommonRenderFn(props.columns);
150
+ const authButton = localStorage.getItem(ENUM.BROWSER_CACHE.MAIN_AUTH_CODES)
151
+ ? JSON.parse(localStorage.getItem(ENUM.BROWSER_CACHE.MAIN_AUTH_CODES) as string)
152
+ : [];
153
+ Object.keys(resourceCodeArray).forEach((item: any) => {
154
+ let Item = item;
155
+ if (Number(item.slice(-1)) >= 1) {
156
+ Item = item.substr(0, item.length - 1);
157
+ }
158
+ if (!authButton.filter((itemInner: any) => Item === itemInner).length) {
159
+ resourceCodeArray[item].visible = false;
160
+ }
161
+ });
162
+
163
+ }
164
+ setValue({
165
+ ...value,
166
+ columns: [...props.columns],
167
+ });
168
+ const { columns } = props;
169
+ let columnConfig = getConfigFromlocalstorage(ENUM.BROWSER_CACHE.COLUMN_CONDITION);
170
+ let showColumns = columnConfig.length ? columnConfig.map((item) => {
171
+ let inner = columns.filter(
172
+ (inneritem) => {
173
+ let innerKey = Array.isArray(inneritem.key || inneritem.dataIndex) ? JSON.stringify(inneritem.key || inneritem.dataIndex) : (inneritem.key || inneritem.dataIndex);
174
+ let itemKey = Array.isArray(item.key || item.dataIndex) ? JSON.stringify(item.key || item.dataIndex) : (item.key || item.dataIndex);
175
+ return innerKey && innerKey === itemKey;
176
+ }
177
+ )[0];
178
+
179
+ return {
180
+ ...inner,
181
+ ...item,
182
+ };
183
+ }) : columns.filter(
184
+ (column) => {
185
+ let columnKey = Array.isArray(column.key || column.dataIndex) ? JSON.stringify(column.key || column.dataIndex) : (column.key || column.dataIndex);
186
+ return column.notRegularCheckList || checkedList.indexOf(columnKey) > -1;
187
+ }
188
+ )
189
+
190
+ showColumns.forEach((item, index) => {
191
+ item.width = item.width || getItemDefaultWidth(item);
192
+ handleBssulaColumnsSpecialParams(item);
193
+ item.onHeaderCell = (column) => ({
194
+ ...item,
195
+ width:
196
+ typeof column.width === 'number'
197
+ ? column.width
198
+ : parseInt(column.width.replace('px', '')),
199
+ onResize: handleResize(index),
200
+ });
201
+ });
202
+ setShowColumns([...showColumns]);
203
+
204
+ }
205
+
206
+ const setInitialSearchFieldsInfo = () =>{
207
+ //获取搜索字段的缓存配置
208
+ const { fields = [] } = props;
209
+ let searchFieldsConfig = getConfigFromlocalstorage(ENUM.BROWSER_CACHE.SEARCH_FIELDS_CONDITION);
210
+ let showSearchFields = searchFieldsConfig.length ? searchFieldsConfig.map((item) => {
211
+ let inner = fields.filter(
212
+ (inneritem) => {
213
+ let innerKey = Array.isArray(inneritem.name) ? JSON.stringify(inneritem.name) : inneritem.name;
214
+ let itemKey = Array.isArray(item.name) ? JSON.stringify(item.name) : item.name;
215
+ return innerKey && innerKey === itemKey;
216
+ }
217
+ )[0];
218
+
219
+ return {
220
+ ...inner,
221
+ ...item,
222
+ };
223
+ }) : fields;
224
+ setShowSearchFields([...showSearchFields])
225
+ }
226
+
227
+ //组件初始挂载
228
+ useEffect(() => {
229
+ getTableHeight();
230
+ setInitialTableInfo();
231
+ setInitialSearchFieldsInfo();
232
+ window.addEventListener('resize', (e) => {
233
+ watchWinResize();
234
+ });
235
+
236
+ setPagePath(pathname); // 做处理,记录当前页面渲染的初始pathname,用于进行判断当前列表页面数据是否需要重新渲染
237
+ }, []);
238
+
239
+ useEffect(() => {
240
+ if (props?.columns && value?.columns) {
241
+ let newKeys = props.columns.map((d: any) => Array.isArray(d.key || d.dataIndex) ? JSON.stringify(d.key || d.dataIndex) : (d.key || d.dataIndex));
242
+ let oldKeys = value.columns.map((d: any) => Array.isArray(d.key || d.dataIndex) ? JSON.stringify(d.key || d.dataIndex) : (d.key || d.dataIndex));
243
+ JSON.stringify(newKeys) !== JSON.stringify(oldKeys) && setInitialTableInfo();
244
+ }
245
+ }, [props?.columns])
246
+
247
+ useEffect(() => {
248
+ if (props?.fields && value?.fields) {
249
+ let newKeys = props.fields.map((d: any) => Array.isArray(d.name) ? JSON.stringify(d.name) : (d.name));
250
+ let oldKeys = value.fields.map((d: any) => Array.isArray(d.name) ? JSON.stringify(d.name) : (d.name));
251
+ JSON.stringify(newKeys) !== JSON.stringify(oldKeys) && setInitialSearchFieldsInfo();
252
+ }
253
+ },[props?.fields])
254
+
255
+ useEffect(() => {
256
+ setInitialTableInfo();
257
+ }, [props?.refreshColumns]);
258
+
259
+
260
+ const watchWinResize = debounce(() => {
261
+ getTableHeight();
262
+ if (!checkFull()) {
263
+ // addTabsNavStyle(true);
264
+ // 全屏下按键esc后要执行的动作
265
+ // isFullScreen 为true 此时为全屏状态 false 为非全屏状态
266
+ if (!isFullScreen) {
267
+ // 按下esc键退出全屏
268
+ setIsFnllScreen(false);
269
+ } else {
270
+ setIsFnllScreen(false);
271
+ }
272
+ }
273
+ }, 10);
274
+
275
+ const setCommonRenderFn = (columns: any[]) => {
276
+ columns.forEach((column) => {
277
+ if (column.showDetailUserInfo) {
278
+ column.render = ({ text }: any) => userColumns({ name: text });
279
+ }
280
+ });
281
+ };
282
+
283
+ // 处理 table 基本参数
284
+ const setTableProps = () => {
285
+ let tableProps = value.tableProps || {};
286
+ tableProps = {
287
+ ...tableProps,
288
+ size: value.size || 'middle',
289
+ defaultPageSize: 20,
290
+ pageSize: 20,
291
+ initialPaging: {
292
+ pagination: pagination
293
+ ? false
294
+ : {
295
+ defaultPageSize: 20,
296
+ pageSize: 20,
297
+ showTotal: (total: any) => `共 ${total} 条`,
298
+ showQuickJumper: true,
299
+ hideOnSinglePage: value.hideOnSinglePage || false,
300
+ },
301
+ },
302
+ initialSelectedRowKeys: value.initialSelectedRowKeys || [],
303
+ expandable: value.expandable,
304
+ scroll: { x: props.overScrollX || 'max-content', y: height },
305
+ bordered: value.bordered || false,
306
+ sticky: true,
307
+ rowClassName: (record: object | null | undefined, index: number) =>
308
+ index % 2 === 0 ? 'table_base' : 'table_odd',
309
+ ...value.tableProps,
310
+ components: {
311
+ header: {
312
+ cell: ResizeableTitle,
313
+ },
314
+ },
315
+ };
316
+
317
+ // @ts-ignore
318
+ if (tableProps?.initialPaging?.pagination) {
319
+ // @ts-ignore
320
+ tableProps.initialPaging.pagination.showSizeChanger = true;
321
+ }
322
+ return tableProps;
323
+ };
324
+
325
+
326
+ const ShowFullScreen = () => {
327
+ const isFullScreen: any =
328
+ window.top.document.fullScreen ||
329
+ window.top.document.webkitIsFullScreen ||
330
+ window.top.document.mozFullScreen;
331
+ let contentEle: any = window.top.document.querySelector(`body`);
332
+ // addTabsNavStyle(isFullScreen);
333
+ if (contentEle && !isFullScreen) {
334
+ let fullScreenEle =
335
+ contentEle.requestFullscreen ||
336
+ contentEle.mozRequestFullScreen ||
337
+ contentEle.webkitRequestFullScreen ||
338
+ contentEle.msRequestFullscreen;
339
+ if (fullScreenEle) {
340
+ fullScreenEle.call(contentEle);
341
+ setIsFnllScreen(true);
342
+ // getTableHeight(true);
343
+ return;
344
+ }
345
+ }
346
+ if (window.top.document && isFullScreen) {
347
+ let exitFullScreen =
348
+ window.top.document.exitFullscreen ||
349
+ window.top.document.mozCancelFullScreen ||
350
+ window.top.document.webkitCancelFullScreen ||
351
+ window.top.document.msExitFullscreen;
352
+ if (exitFullScreen) {
353
+ exitFullScreen.call(window.top.document);
354
+ setIsFnllScreen(false);
355
+ // getTableHeight();
356
+ return;
357
+ }
358
+ }
359
+ };
360
+
361
+ const handleTimeValue = () => {
362
+ let actionsRender = value.actionsRender || [];
363
+ actionsRender = [
364
+ ...actionsRender,
365
+ {
366
+ type: 'text',
367
+ props: {
368
+ children: (
369
+ <span className="ant-dropdown-link">
370
+ <Dropdown overlay={
371
+ <Menu >
372
+ <Menu.Item>
373
+ <SortableTable
374
+ ref={sortTableRef}
375
+ setShowColumns={setShowColumns}
376
+ showColumn={showColumn}
377
+ datasource={value?.columns || []}
378
+ bsTableCode={bsTableCode}
379
+ />
380
+ </Menu.Item>
381
+ <Menu.Item>
382
+ <SearchItemTable
383
+ ref={sortTableRef}
384
+ setShowSearchFields={setShowSearchFields}
385
+ showSearchFields={showSearchFields}
386
+ datasource={value?.fields || []}
387
+ bsTableCode={bsTableCode}
388
+ />
389
+ </Menu.Item>
390
+ </Menu>
391
+ } placement="bottom" >
392
+ <span className="ant-dropdown-link">
393
+ <img width={32} src={shezhi} />
394
+ </span>
395
+ </Dropdown>
396
+ </span>
397
+ ),
398
+ },
399
+ },
400
+ {
401
+ type: 'text',
402
+ props: {
403
+ children: (
404
+ <a>
405
+ {isFullScreen ? (
406
+ <Tooltip title="取消全屏">
407
+ <img
408
+ onClick={() => {
409
+ ShowFullScreen();
410
+ }}
411
+ width={32}
412
+ src={scanning}
413
+ />
414
+ </Tooltip>
415
+ ) : (
416
+ <Tooltip title="全屏">
417
+ <img
418
+ onClick={() => {
419
+ ShowFullScreen();
420
+ }}
421
+ width={32}
422
+ src={quanping}
423
+ />
424
+ </Tooltip>
425
+ )}
426
+ </a>
427
+ ),
428
+ },
429
+ },
430
+ {
431
+ type: 'text',
432
+ props: {
433
+ children:
434
+ value?.exportConfig && authFn(value?.exportConfig?.code) ? (
435
+ <ExportIcon
436
+ request={{
437
+ url: `/oms-ops/excel/exportAsync/${value?.exportConfig?.type}`,
438
+ params: value?.exportConfig?.params || queryParams,
439
+ }}
440
+ tableRef={props.forwardedRef || refs}
441
+ />
442
+ ) : (
443
+ <span />
444
+ ),
445
+ },
446
+ },
447
+ ];
448
+ if (value.rowSelection) {
449
+ value.rowSelection.columnWidth = 50;
450
+ }
451
+ return {
452
+ ...value,
453
+ actionsRender,
454
+ };
455
+ };
456
+
457
+ const handleResize =
458
+ (index) =>
459
+ (e, { size }) => {
460
+ setShowColumns((columns: any) => {
461
+ let newColumns = [...columns];
462
+ newColumns[index] = {
463
+ ...newColumns[index],
464
+ width: size.width,
465
+ };
466
+ newColumns.forEach((d: any) => {
467
+ handleBssulaColumnsSpecialParams(d);
468
+ })
469
+ return [...newColumns];
470
+ });
471
+ };
472
+
473
+ const setVisibleColumn = (columnTitle: string) => {
474
+ sortTableRef?.current?.handleTableHeadHidden?.(columnTitle);
475
+ };
476
+
477
+ const config = {
478
+ visibleFieldsCount: 3,
479
+ tableWrapperStyle: {
480
+ padding: '10px',
481
+ background: '#f3f3f3',
482
+ },
483
+ setVisibleColumn: setVisibleColumn,
484
+ itemLayout: {
485
+ span: 8, // 栅格占位格数
486
+ labelCol: {
487
+ // label标签布局;可设置 span、offset
488
+ span: 8,
489
+ },
490
+ wrapperCol: {
491
+ // value布局, 方式同labelCol(horizontal状态下配置)
492
+ span: 16,
493
+ },
494
+ },
495
+ rowSelection: false, // 默认无多选
496
+ ...handleTimeValue(),
497
+ tableProps: setTableProps(),
498
+ columns: [...showColumn],
499
+ fields: [...showSearchFields],
500
+ ref: props.forwardedRef || refs,
501
+ isFullScreen,
502
+ };
503
+
504
+ useEffect(() => {
505
+ if (!localStorage.getItem('isTabChange')) {
506
+ if (pagePath === pathname) {
507
+ // @ts-ignore
508
+ config.ref?.current?.tableRef?.current?.refreshTable();
509
+ }
510
+ } else {
511
+ setTimeout(() => {
512
+ // 处理页面刷新两面
513
+ localStorage.removeItem('isTabChange');
514
+ }, 0);
515
+ }
516
+ }, [pathname]);
517
+
518
+ const memoConfig = useMemo(
519
+ () => ({
520
+ ...config,
521
+ summary: props.summary,
522
+ statusMapping: props.statusMapping,
523
+ }),
524
+ [value, checkedList, showColumn, props.statusMapping, showSearchFields],
525
+ );
526
+ return <MemoQueryTable {...memoConfig} />;
527
+ };