@bit-sun/business-component 2.2.26 → 2.2.28

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 (184) 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/BsLayouts/Components/AllFunc/drawContent.d.ts +1 -1
  9. package/dist/components/Business/BsLayouts/Components/AllFunc/index.d.ts +1 -1
  10. package/dist/components/Business/BsLayouts/Components/RightContent/index.d.ts +2 -2
  11. package/dist/components/Business/BsLayouts/Components/SearchFunc/index.d.ts +2 -2
  12. package/dist/components/Business/BsLayouts/index.d.ts +2 -2
  13. package/dist/components/Business/BsSulaQueryTable/utils.d.ts +2 -2
  14. package/dist/index.esm.js +97 -103
  15. package/dist/index.js +104 -110
  16. package/dist/utils/TableUtils.d.ts +2 -2
  17. package/docs/index.md +21 -21
  18. package/lib/assets/drag.svg +17 -17
  19. package/lib/assets/exportFail.svg +37 -37
  20. package/lib/assets/exportProcessing.svg +28 -28
  21. package/lib/assets/exportSuccess.svg +34 -34
  22. package/lib/assets/label_icon_bottom.svg +25 -25
  23. package/lib/assets/upExport.svg +22 -22
  24. package/package.json +1 -1
  25. package/src/assets/32.svg +27 -27
  26. package/src/assets/addIcon.svg +17 -17
  27. package/src/assets/allfunc.svg +27 -27
  28. package/src/assets/arrowRight.svg +24 -24
  29. package/src/assets/btn-delete.svg +29 -29
  30. package/src/assets/btn-edit.svg +19 -19
  31. package/src/assets/btn-more.svg +17 -17
  32. package/src/assets/btn-submit.svg +19 -19
  33. package/src/assets/caidan.svg +11 -11
  34. package/src/assets/close.svg +26 -26
  35. package/src/assets/drag.svg +17 -17
  36. package/src/assets/exportFail.svg +37 -37
  37. package/src/assets/exportProcessing.svg +28 -28
  38. package/src/assets/exportSuccess.svg +34 -34
  39. package/src/assets/fixed-left-active.svg +11 -11
  40. package/src/assets/fixed-left.svg +15 -15
  41. package/src/assets/fixed-right-active.svg +11 -11
  42. package/src/assets/fixed-right.svg +15 -15
  43. package/src/assets/guanbi.svg +15 -15
  44. package/src/assets/icon-quanping.svg +15 -15
  45. package/src/assets/icon-shezhi.svg +17 -17
  46. package/src/assets/label_icon_bottom.svg +25 -25
  47. package/src/assets/list-no-img.svg +21 -21
  48. package/src/assets/morentouxiang-32.svg +23 -23
  49. package/src/assets/scanning.svg +24 -24
  50. package/src/assets/upExport.svg +22 -22
  51. package/src/components/Business/AddSelectBusiness/index.md +161 -161
  52. package/src/components/Business/AddSelectBusiness/index.tsx +859 -859
  53. package/src/components/Business/BsLayouts/Components/AllFunc/drawContent.tsx +111 -111
  54. package/src/components/Business/BsLayouts/Components/AllFunc/index.less +153 -153
  55. package/src/components/Business/BsLayouts/Components/AllFunc/index.tsx +70 -70
  56. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.less +90 -90
  57. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.tsx +37 -37
  58. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.tsx +242 -242
  59. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.tsx +384 -384
  60. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.tsx +285 -285
  61. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.tsx +74 -74
  62. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/drawContent.less +170 -170
  63. package/src/components/Business/BsLayouts/Components/CustomerMenu/index.less +64 -64
  64. package/src/components/Business/BsLayouts/Components/CustomerMenu/index.tsx +153 -153
  65. package/src/components/Business/BsLayouts/Components/GlobalHeader/index.less +72 -72
  66. package/src/components/Business/BsLayouts/Components/GlobalHeader/index.tsx +157 -157
  67. package/src/components/Business/BsLayouts/Components/RightContent/LoginModal.tsx +85 -85
  68. package/src/components/Business/BsLayouts/Components/RightContent/home.less +218 -218
  69. package/src/components/Business/BsLayouts/Components/RightContent/index.tsx +155 -155
  70. package/src/components/Business/BsLayouts/Components/SearchFunc/index.less +160 -160
  71. package/src/components/Business/BsLayouts/Components/SearchFunc/index.tsx +75 -75
  72. package/src/components/Business/BsLayouts/index.less +79 -79
  73. package/src/components/Business/BsLayouts/index.tsx +1480 -1480
  74. package/src/components/Business/BsLayouts/service.ts +10 -10
  75. package/src/components/Business/BsLayouts/utils.tsx +203 -203
  76. package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +538 -538
  77. package/src/components/Business/BsSulaQueryTable/index.less +219 -219
  78. package/src/components/Business/BsSulaQueryTable/index.tsx +527 -527
  79. package/src/components/Business/BsSulaQueryTable/setting.tsx +802 -802
  80. package/src/components/Business/BsSulaQueryTable/utils.less +65 -65
  81. package/src/components/Business/BsSulaQueryTable/utils.tsx +688 -688
  82. package/src/components/Business/CommodityEntry/index.md +70 -70
  83. package/src/components/Business/CommodityEntry/index.tsx +80 -80
  84. package/src/components/Business/CommonAlert/index.tsx +23 -23
  85. package/src/components/Business/CommonGuideWrapper/index.less +111 -111
  86. package/src/components/Business/CommonGuideWrapper/index.md +39 -39
  87. package/src/components/Business/CommonGuideWrapper/index.tsx +83 -83
  88. package/src/components/Business/DetailPageWrapper/index.less +79 -79
  89. package/src/components/Business/DetailPageWrapper/index.tsx +313 -313
  90. package/src/components/Business/DetailPageWrapper/utils.tsx +100 -100
  91. package/src/components/Business/HomePageWrapper/index.less +33 -33
  92. package/src/components/Business/HomePageWrapper/index.md +45 -45
  93. package/src/components/Business/HomePageWrapper/index.tsx +162 -162
  94. package/src/components/Business/JsonQueryTable/components/FieldsModifyModal.tsx +824 -824
  95. package/src/components/Business/JsonQueryTable/components/FieldsSettingsTable.tsx +201 -201
  96. package/src/components/Business/JsonQueryTable/components/Formula.tsx +205 -205
  97. package/src/components/Business/JsonQueryTable/components/MaintainOptions.tsx +127 -127
  98. package/src/components/Business/JsonQueryTable/configButton/index.js +20 -20
  99. package/src/components/Business/JsonQueryTable/configTree/component/compactArrayView.js +25 -25
  100. package/src/components/Business/JsonQueryTable/configTree/component/compactObjectView.js +30 -30
  101. package/src/components/Business/JsonQueryTable/configTree/index.js +82 -82
  102. package/src/components/Business/JsonQueryTable/configTree/index.less +44 -44
  103. package/src/components/Business/JsonQueryTable/configTree/parser/highlight.js +57 -57
  104. package/src/components/Business/JsonQueryTable/configTree/parser/index.js +124 -124
  105. package/src/components/Business/JsonQueryTable/configTree/render/iconRender.js +29 -29
  106. package/src/components/Business/JsonQueryTable/configTree/render/nameRender.js +22 -22
  107. package/src/components/Business/JsonQueryTable/configTree/treeNode.js +116 -116
  108. package/src/components/Business/JsonQueryTable/drawer/index.tsx +12 -12
  109. package/src/components/Business/JsonQueryTable/function.ts +62 -62
  110. package/src/components/Business/JsonQueryTable/index.less +16 -16
  111. package/src/components/Business/JsonQueryTable/index.md +328 -328
  112. package/src/components/Business/JsonQueryTable/index.tsx +320 -320
  113. package/src/components/Business/JsonQueryTable/jsonEditor/index.js +346 -346
  114. package/src/components/Business/JsonQueryTable/jsonEditor/index.less +22 -22
  115. package/src/components/Business/JsonQueryTable/jsonEditor/lint/basicType.js +147 -147
  116. package/src/components/Business/JsonQueryTable/jsonEditor/lint/index.js +389 -389
  117. package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/actions.js +118 -118
  118. package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/dependency.js +22 -22
  119. package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/index.js +21 -21
  120. package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/request.js +65 -65
  121. package/src/components/Business/JsonQueryTable/static.ts +390 -390
  122. package/src/components/Business/SearchSelect/BusinessUtils.ts +1730 -1730
  123. package/src/components/Business/SearchSelect/common.ts +53 -53
  124. package/src/components/Business/SearchSelect/index.md +1310 -1310
  125. package/src/components/Business/SearchSelect/index.tsx +51 -51
  126. package/src/components/Business/SearchSelect/utils.ts +100 -100
  127. package/src/components/Business/StateFlow/index.less +130 -130
  128. package/src/components/Business/StateFlow/index.md +60 -60
  129. package/src/components/Business/StateFlow/index.tsx +29 -29
  130. package/src/components/Business/TreeSearchSelect/index.md +154 -154
  131. package/src/components/Business/TreeSearchSelect/index.tsx +34 -34
  132. package/src/components/Business/TreeSearchSelect/utils.ts +69 -69
  133. package/src/components/Business/columnSettingTable/columnSetting.tsx +764 -764
  134. package/src/components/Business/columnSettingTable/index.less +247 -247
  135. package/src/components/Business/columnSettingTable/index.md +357 -357
  136. package/src/components/Business/columnSettingTable/index.tsx +232 -232
  137. package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +240 -240
  138. package/src/components/Business/columnSettingTable/utils.tsx +68 -68
  139. package/src/components/Business/moreTreeTable/index.less +99 -99
  140. package/src/components/Business/moreTreeTable/index.md +448 -448
  141. package/src/components/Business/moreTreeTable/index.tsx +361 -361
  142. package/src/components/Business/moreTreeTable/utils.ts +126 -126
  143. package/src/components/Functional/AddSelect/index.less +367 -367
  144. package/src/components/Functional/AddSelect/index.md +155 -155
  145. package/src/components/Functional/AddSelect/index.tsx +1263 -1249
  146. package/src/components/Functional/BillEntry/index.less +371 -371
  147. package/src/components/Functional/BillEntry/index.md +39 -39
  148. package/src/components/Functional/BillEntry/index.tsx +766 -766
  149. package/src/components/Functional/DataImport/index.less +63 -63
  150. package/src/components/Functional/DataImport/index.md +44 -44
  151. package/src/components/Functional/DataImport/index.tsx +695 -695
  152. package/src/components/Functional/DataValidation/index.less +63 -63
  153. package/src/components/Functional/DataValidation/index.md +39 -39
  154. package/src/components/Functional/DataValidation/index.tsx +687 -687
  155. package/src/components/Functional/ExportFunctions/ExportIcon/index.md +37 -37
  156. package/src/components/Functional/ExportFunctions/ExportIcon/index.tsx +59 -59
  157. package/src/components/Functional/QueryMutipleInput/index.less +37 -37
  158. package/src/components/Functional/QueryMutipleInput/index.md +33 -33
  159. package/src/components/Functional/QueryMutipleInput/index.tsx +128 -128
  160. package/src/components/Functional/SearchSelect/index.less +115 -115
  161. package/src/components/Functional/SearchSelect/index.md +141 -141
  162. package/src/components/Functional/SearchSelect/index.tsx +846 -846
  163. package/src/components/Functional/SearchSelect/utils.ts +3 -3
  164. package/src/components/Functional/TreeSearchSelect/index.md +47 -47
  165. package/src/components/Functional/TreeSearchSelect/index.tsx +162 -162
  166. package/src/index.ts +34 -34
  167. package/src/plugin/TableColumnSetting/index.less +247 -247
  168. package/src/plugin/TableColumnSetting/index.md +50 -50
  169. package/src/plugin/TableColumnSetting/index.tsx +724 -724
  170. package/src/plugin/TableColumnSetting/utils.ts +19 -19
  171. package/src/styles/bsDefault.less +1912 -1912
  172. package/src/utils/CheckOneUser/index.md +39 -39
  173. package/src/utils/CheckOneUser/index.ts +51 -51
  174. package/src/utils/LocalstorageUtils.ts +90 -90
  175. package/src/utils/TableUtils.tsx +18 -18
  176. package/src/utils/checkUtils.ts +39 -39
  177. package/src/utils/enumConfig.ts +11 -11
  178. package/src/utils/getFormMode.js +12 -12
  179. package/src/utils/index.ts +3 -3
  180. package/src/utils/requestUtils.ts +34 -34
  181. package/src/utils/serialize.js +7 -7
  182. package/src/utils/utils.ts +183 -183
  183. package/tsconfig.json +29 -29
  184. package/typings.d.ts +4 -4
@@ -1,527 +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, 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
- };
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
+ };