@bit-sun/business-component 2.2.49 → 2.3.0

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