@bit-sun/business-component 1.2.4-alpha.1 → 1.2.4

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 (167) hide show
  1. package/.fatherrc.ts +0 -1
  2. package/.umirc.ts +16 -31
  3. package/dist/components/Business/SearchSelect/BusinessUtils.d.ts +1 -1
  4. package/dist/components/Business/SearchSelect/common.d.ts +1 -5
  5. package/dist/components/Business/SearchSelect/index.d.ts +1 -1
  6. package/dist/components/Business/SearchSelect/utils.d.ts +1 -2
  7. package/dist/components/Functional/SearchSelect/index.d.ts +1 -2
  8. package/dist/index.d.ts +0 -15
  9. package/dist/index.esm.js +4456 -19407
  10. package/dist/index.js +4443 -19411
  11. package/package.json +5 -26
  12. package/src/components/Business/CommodityEntry/index.md +3 -4
  13. package/src/components/Business/CommodityEntry/index.tsx +2 -7
  14. package/src/components/Business/SearchSelect/BusinessUtils.ts +14 -107
  15. package/src/components/Business/SearchSelect/common.ts +1 -20
  16. package/src/components/Business/SearchSelect/index.md +30 -60
  17. package/src/components/Business/SearchSelect/index.tsx +12 -21
  18. package/src/components/Business/SearchSelect/utils.ts +4 -30
  19. package/src/components/Functional/DataImport/index.tsx +2 -1
  20. package/src/components/Functional/DataValidation/index.tsx +1 -1
  21. package/src/components/Functional/SearchSelect/index.tsx +121 -218
  22. package/src/index.ts +6 -15
  23. package/typings.d.ts +0 -3
  24. package/dist/components/Business/AddSelectBusiness/index.d.ts +0 -1
  25. package/dist/components/Business/BsLayouts/Components/AllFunc/drawContent.d.ts +0 -4
  26. package/dist/components/Business/BsLayouts/Components/AllFunc/index.d.ts +0 -4
  27. package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.d.ts +0 -4
  28. package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.d.ts +0 -17
  29. package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.d.ts +0 -30
  30. package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.d.ts +0 -3
  31. package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.d.ts +0 -2
  32. package/dist/components/Business/BsLayouts/Components/CustomerMenu/index.d.ts +0 -4
  33. package/dist/components/Business/BsLayouts/Components/GlobalHeader/index.d.ts +0 -4
  34. package/dist/components/Business/BsLayouts/Components/RightContent/LoginModal.d.ts +0 -2
  35. package/dist/components/Business/BsLayouts/Components/RightContent/index.d.ts +0 -8
  36. package/dist/components/Business/BsLayouts/Components/SearchFunc/index.d.ts +0 -8
  37. package/dist/components/Business/BsLayouts/index.d.ts +0 -18
  38. package/dist/components/Business/BsLayouts/service.d.ts +0 -1
  39. package/dist/components/Business/BsLayouts/utils.d.ts +0 -13
  40. package/dist/components/Business/BsSulaQueryTable/index.d.ts +0 -2
  41. package/dist/components/Business/BsSulaQueryTable/setting.d.ts +0 -58
  42. package/dist/components/Business/BsSulaQueryTable/utils.d.ts +0 -98
  43. package/dist/components/Business/CommonAlert/index.d.ts +0 -3
  44. package/dist/components/Business/CommonGuideWrapper/index.d.ts +0 -6
  45. package/dist/components/Business/DetailPageWrapper/index.d.ts +0 -9
  46. package/dist/components/Business/DetailPageWrapper/utils.d.ts +0 -8
  47. package/dist/components/Business/HomePageWrapper/index.d.ts +0 -3
  48. package/dist/components/Business/StateFlow/index.d.ts +0 -3
  49. package/dist/components/Business/TreeSearchSelect/index.d.ts +0 -3
  50. package/dist/components/Business/TreeSearchSelect/utils.d.ts +0 -2
  51. package/dist/components/Business/columnSettingTable/columnSetting.d.ts +0 -54
  52. package/dist/components/Business/columnSettingTable/index.d.ts +0 -16
  53. package/dist/components/Business/columnSettingTable/sulaSettingTable.d.ts +0 -17
  54. package/dist/components/Business/columnSettingTable/utils.d.ts +0 -8
  55. package/dist/components/Functional/AddSelect/index.d.ts +0 -3
  56. package/dist/components/Functional/BillEntry/index.d.ts +0 -4
  57. package/dist/components/Functional/ExportFunctions/ExportIcon/index.d.ts +0 -12
  58. package/dist/components/Functional/TreeSearchSelect/index.d.ts +0 -2
  59. package/dist/utils/enumConfig.d.ts +0 -10
  60. package/dist/utils/requestUtils.d.ts +0 -1
  61. package/dist/utils/utils.d.ts +0 -3
  62. package/lib/assets/arrow_top.png +0 -0
  63. package/lib/assets/drag.svg +0 -17
  64. package/lib/assets/exportFail.svg +0 -38
  65. package/lib/assets/exportProcessing.svg +0 -29
  66. package/lib/assets/exportSuccess.svg +0 -35
  67. package/lib/assets/exportlogo.png +0 -0
  68. package/lib/assets/label_icon_bottom.svg +0 -26
  69. package/lib/assets/upExport.svg +0 -23
  70. package/src/assets/32.svg +0 -28
  71. package/src/assets/addIcon.svg +0 -18
  72. package/src/assets/allfunc.svg +0 -28
  73. package/src/assets/arrowRight.svg +0 -25
  74. package/src/assets/arrow_top.png +0 -0
  75. package/src/assets/btn-delete.svg +0 -30
  76. package/src/assets/btn-edit.svg +0 -20
  77. package/src/assets/btn-more.svg +0 -18
  78. package/src/assets/btn-submit.svg +0 -20
  79. package/src/assets/caidan.svg +0 -12
  80. package/src/assets/close.svg +0 -26
  81. package/src/assets/closeicon.png +0 -0
  82. package/src/assets/drag.svg +0 -17
  83. package/src/assets/exportFail.svg +0 -38
  84. package/src/assets/exportProcessing.svg +0 -29
  85. package/src/assets/exportSuccess.svg +0 -35
  86. package/src/assets/exportlogo.png +0 -0
  87. package/src/assets/fixed-left-active.svg +0 -12
  88. package/src/assets/fixed-left.svg +0 -16
  89. package/src/assets/fixed-right-active.svg +0 -12
  90. package/src/assets/fixed-right.svg +0 -16
  91. package/src/assets/guanbi.svg +0 -16
  92. package/src/assets/icon-quanping.svg +0 -16
  93. package/src/assets/icon-shezhi.svg +0 -18
  94. package/src/assets/label_icon_bottom.svg +0 -26
  95. package/src/assets/list-no-img.svg +0 -22
  96. package/src/assets/morentouxiang-32.svg +0 -24
  97. package/src/assets/right.png +0 -0
  98. package/src/assets/scanning.svg +0 -25
  99. package/src/assets/upExport.svg +0 -23
  100. package/src/assets/xinglan-icon-out.png +0 -0
  101. package/src/components/Business/AddSelectBusiness/index.md +0 -41
  102. package/src/components/Business/AddSelectBusiness/index.tsx +0 -290
  103. package/src/components/Business/BsLayouts/Components/AllFunc/drawContent.tsx +0 -112
  104. package/src/components/Business/BsLayouts/Components/AllFunc/index.less +0 -153
  105. package/src/components/Business/BsLayouts/Components/AllFunc/index.tsx +0 -70
  106. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.less +0 -90
  107. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.tsx +0 -38
  108. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.tsx +0 -243
  109. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.tsx +0 -385
  110. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.tsx +0 -286
  111. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.tsx +0 -75
  112. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/drawContent.less +0 -171
  113. package/src/components/Business/BsLayouts/Components/CustomerMenu/index.less +0 -65
  114. package/src/components/Business/BsLayouts/Components/CustomerMenu/index.tsx +0 -154
  115. package/src/components/Business/BsLayouts/Components/GlobalHeader/index.less +0 -73
  116. package/src/components/Business/BsLayouts/Components/GlobalHeader/index.tsx +0 -158
  117. package/src/components/Business/BsLayouts/Components/RightContent/LoginModal.tsx +0 -85
  118. package/src/components/Business/BsLayouts/Components/RightContent/home.less +0 -218
  119. package/src/components/Business/BsLayouts/Components/RightContent/index.tsx +0 -156
  120. package/src/components/Business/BsLayouts/Components/SearchFunc/index.less +0 -161
  121. package/src/components/Business/BsLayouts/Components/SearchFunc/index.tsx +0 -76
  122. package/src/components/Business/BsLayouts/index.less +0 -80
  123. package/src/components/Business/BsLayouts/index.tsx +0 -1465
  124. package/src/components/Business/BsLayouts/service.ts +0 -11
  125. package/src/components/Business/BsLayouts/utils.tsx +0 -211
  126. package/src/components/Business/BsSulaQueryTable/index.less +0 -220
  127. package/src/components/Business/BsSulaQueryTable/index.tsx +0 -505
  128. package/src/components/Business/BsSulaQueryTable/setting.tsx +0 -799
  129. package/src/components/Business/BsSulaQueryTable/utils.less +0 -65
  130. package/src/components/Business/BsSulaQueryTable/utils.tsx +0 -688
  131. package/src/components/Business/CommonAlert/index.less +0 -0
  132. package/src/components/Business/CommonAlert/index.tsx +0 -23
  133. package/src/components/Business/CommonGuideWrapper/index.less +0 -112
  134. package/src/components/Business/CommonGuideWrapper/index.md +0 -39
  135. package/src/components/Business/CommonGuideWrapper/index.tsx +0 -84
  136. package/src/components/Business/DetailPageWrapper/index.less +0 -80
  137. package/src/components/Business/DetailPageWrapper/index.tsx +0 -335
  138. package/src/components/Business/DetailPageWrapper/utils.tsx +0 -101
  139. package/src/components/Business/HomePageWrapper/index.less +0 -33
  140. package/src/components/Business/HomePageWrapper/index.md +0 -45
  141. package/src/components/Business/HomePageWrapper/index.tsx +0 -162
  142. package/src/components/Business/StateFlow/index.less +0 -131
  143. package/src/components/Business/StateFlow/index.md +0 -60
  144. package/src/components/Business/StateFlow/index.tsx +0 -30
  145. package/src/components/Business/TreeSearchSelect/index.md +0 -126
  146. package/src/components/Business/TreeSearchSelect/index.tsx +0 -34
  147. package/src/components/Business/TreeSearchSelect/utils.ts +0 -60
  148. package/src/components/Business/columnSettingTable/columnSetting.tsx +0 -764
  149. package/src/components/Business/columnSettingTable/index.less +0 -247
  150. package/src/components/Business/columnSettingTable/index.md +0 -358
  151. package/src/components/Business/columnSettingTable/index.tsx +0 -233
  152. package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +0 -241
  153. package/src/components/Business/columnSettingTable/utils.tsx +0 -69
  154. package/src/components/Functional/AddSelect/index.less +0 -367
  155. package/src/components/Functional/AddSelect/index.md +0 -122
  156. package/src/components/Functional/AddSelect/index.tsx +0 -962
  157. package/src/components/Functional/BillEntry/index.less +0 -371
  158. package/src/components/Functional/BillEntry/index.md +0 -39
  159. package/src/components/Functional/BillEntry/index.tsx +0 -613
  160. package/src/components/Functional/ExportFunctions/ExportIcon/index.md +0 -37
  161. package/src/components/Functional/ExportFunctions/ExportIcon/index.tsx +0 -59
  162. package/src/components/Functional/TreeSearchSelect/index.md +0 -47
  163. package/src/components/Functional/TreeSearchSelect/index.tsx +0 -149
  164. package/src/styles/bsDefault.less +0 -1907
  165. package/src/utils/enumConfig.ts +0 -10
  166. package/src/utils/requestUtils.ts +0 -33
  167. package/src/utils/utils.ts +0 -52
@@ -1,1465 +0,0 @@
1
- // @ts-nocheck
2
- import type {
3
- MenuDataItem,
4
- BasicLayoutProps as ProLayoutProps,
5
- Settings,
6
- } from '@ant-design/pro-layout';
7
- import ProLayout from '@ant-design/pro-layout';
8
- import React, { useState, createRef, useRef } from 'react';
9
- import {
10
- Tabs,
11
- Dropdown,
12
- Menu,
13
- } from 'antd';
14
- import {
15
- Link,
16
- useIntl,
17
- history,
18
- useModel,
19
- } from 'umi';
20
- import {
21
- DashOutlined,
22
- MenuUnfoldOutlined,
23
- CaretLeftOutlined,
24
- HomeOutlined,
25
- DoubleLeftOutlined,
26
- DoubleRightOutlined,
27
- } from '@ant-design/icons';
28
- import SearchFunc from './Components/SearchFunc';
29
- import { debounce } from 'lodash';
30
-
31
- import AllFunc from './Components/AllFunc';
32
- import {
33
- getBreadcrumbNameMap,
34
- ergodicMenuRoutes,
35
- matchPath,
36
- } from './utils';
37
- import moment from 'moment';
38
- import GlobalHeaderCom from './Components/GlobalHeader';
39
- import CustomerMenu from './Components/CustomerMenu';
40
- import CustomerMenuHeader from './Components/CustomerMenu/globalMenu/customMenuHeader';
41
- import './index.less';
42
- import { DndProvider, useDrag, useDrop } from 'react-dnd';
43
- import { HTML5Backend } from 'react-dnd-html5-backend';
44
- import ENUM from '@/utils/enumConfig';
45
- import { memoizeOneFormatter } from '@/utils/utils';
46
-
47
- const { TabPane } = Tabs;
48
-
49
- export const RouterContext = React.createContext({});
50
-
51
- export type BasicLayoutProps = {
52
- breadcrumbNameMap: Record<string, MenuDataItem>;
53
- route: ProLayoutProps['route'] & {
54
- authority: string[];
55
- };
56
- settings: Settings;
57
- } & ProLayoutProps;
58
-
59
- export type BasicLayoutContext = { [K in 'location']: BasicLayoutProps[K] } & {
60
- breadcrumbNameMap: Record<string, MenuDataItem>;
61
- };
62
-
63
- const menuDataRender = (menuList: MenuDataItem[]): MenuDataItem[] =>
64
- menuList.map((item) => {
65
- return {
66
- ...item,
67
- children: item.children ? menuDataRender(item.children) : undefined,
68
- };
69
- });
70
-
71
- let UN_LISTTEN_DRP;
72
- let routerArray = [];
73
- let lastTwoRouterArray = [1, 2];
74
-
75
- let draggerTabKeys = [];
76
-
77
- const type = 'DraggableTabNode';
78
- const DraggableTabNode = ({ index, children, moveNode }) => {
79
- const ref = useRef(null);
80
- const [{ isOver, dropClassName }, drop] = useDrop({
81
- accept: type,
82
- collect: (monitor) => {
83
- const { index: dragIndex } = monitor.getItem() || {};
84
-
85
- if (dragIndex === index) {
86
- return {};
87
- }
88
-
89
- return {
90
- isOver: monitor.isOver(),
91
- dropClassName: 'dropping',
92
- };
93
- },
94
- drop: (item) => {
95
- moveNode(item.index, index);
96
- },
97
- });
98
- const [, drag] = useDrag({
99
- type,
100
- item: {
101
- index,
102
- },
103
- collect: (monitor) => ({
104
- isDragging: monitor.isDragging(),
105
- }),
106
- });
107
- drop(drag(ref));
108
- return (
109
- <div
110
- ref={ref}
111
- style={{
112
- marginRight: 24,
113
- }}
114
- className={isOver ? dropClassName : ''}
115
- >
116
- {children}
117
- </div>
118
- );
119
- };
120
-
121
- const DraggableTabs = (props) => {
122
- const { children, changeListenRouterState } = props;
123
- const [order, setOrder] = useState([]);
124
-
125
- const moveTabNode = (dragKey, hoverKey) => {
126
- const newOrder = order.slice();
127
- React.Children.forEach(children, (c) => {
128
- if (c.key && newOrder.indexOf(c.key) === -1) {
129
- newOrder.push(c.key);
130
- }
131
- });
132
- const dragIndex = newOrder.indexOf(dragKey);
133
- const hoverIndex = newOrder.indexOf(hoverKey);
134
- newOrder.splice(dragIndex, 1);
135
- newOrder.splice(hoverIndex, 0, dragKey);
136
- changeListenRouterState(dragIndex, hoverIndex);
137
- setOrder(newOrder);
138
- };
139
-
140
- const renderTabBar = (tabBarProps, DefaultTabBar) => (
141
- <DefaultTabBar {...tabBarProps}>
142
- {(node) => (
143
- <DraggableTabNode
144
- key={node.key}
145
- index={node.key}
146
- moveNode={moveTabNode}
147
- >
148
- {node}
149
- </DraggableTabNode>
150
- )}
151
- </DefaultTabBar>
152
- );
153
-
154
- const tabs = [];
155
- React.Children.forEach(children, (c) => {
156
- tabs.push(c);
157
- });
158
- const orderTabs = tabs.slice().sort((a, b) => {
159
- const orderA = order.indexOf(a.key);
160
- const orderB = order.indexOf(b.key);
161
-
162
- if (orderA !== -1 && orderB !== -1) {
163
- return orderA - orderB;
164
- }
165
-
166
- if (orderA !== -1) {
167
- return -1;
168
- }
169
-
170
- if (orderB !== -1) {
171
- return 1;
172
- }
173
-
174
- const ia = tabs.indexOf(a);
175
- const ib = tabs.indexOf(b);
176
- return ia - ib;
177
- });
178
- return (
179
- <DndProvider backend={HTML5Backend}>
180
- <Tabs renderTabBar={renderTabBar} {...props}>
181
- {orderTabs}
182
- </Tabs>
183
- </DndProvider>
184
- );
185
- };
186
-
187
- const ItemMenu = (props) => {
188
- const {
189
- info: { key },
190
- operateFun,
191
- listenRouterState,
192
- } = props;
193
- let index = listenRouterState.findIndex((item) => item.key === key);
194
-
195
- const menu = (
196
- <Menu>
197
- <Menu.Item key="0" style={{ fontSize: '12px', textAlign: 'center' }}>
198
- <a
199
- onClick={(e) => {
200
- e.stopPropagation();
201
- operateFun(key, 'self');
202
- }}
203
- >
204
- 关闭当前标签
205
- </a>
206
- </Menu.Item>
207
- <Menu.Item
208
- disabled={index === 0}
209
- key="1"
210
- style={{ fontSize: '12px', textAlign: 'center' }}
211
- >
212
- <a
213
- onClick={(e) => {
214
- e.stopPropagation();
215
- operateFun(key, 'left');
216
- }}
217
- >
218
- 关闭其左侧标签
219
- </a>
220
- </Menu.Item>
221
- <Menu.Item
222
- disabled={index === listenRouterState.length - 1}
223
- key="2"
224
- style={{ fontSize: '12px', textAlign: 'center' }}
225
- >
226
- <a
227
- onClick={(e) => {
228
- e.stopPropagation();
229
- operateFun(key, 'right');
230
- }}
231
- >
232
- 关闭其右侧标签
233
- </a>
234
- </Menu.Item>
235
- <Menu.Item
236
- disabled={index === listenRouterState.length - 1}
237
- key="3"
238
- style={{ fontSize: '12px', textAlign: 'center' }}
239
- >
240
- <a
241
- onClick={(e) => {
242
- e.stopPropagation();
243
- operateFun(key, 'other');
244
- }}
245
- >
246
- 关闭其他标签
247
- </a>
248
- </Menu.Item>
249
- <Menu.Item
250
- disabled={index === listenRouterState.length - 1}
251
- key="4"
252
- style={{ fontSize: '12px', textAlign: 'center' }}
253
- >
254
- <a
255
- onClick={(e) => {
256
- e.stopPropagation();
257
- operateFun(key, 'all');
258
- }}
259
- >
260
- 关闭全部标签
261
- </a>
262
- </Menu.Item>
263
- </Menu>
264
- );
265
- return (
266
- <Dropdown overlay={menu} trigger={['hover']}>
267
- <a
268
- className="ant-dropdown-link"
269
- onClick={(e) => {
270
- e.preventDefault();
271
- e.stopPropagation();
272
- }}
273
- >
274
- <img style={{ marginRight: '-12px' }} src="./biaoqian-icon.svg" />
275
- </a>
276
- </Dropdown>
277
- );
278
- };
279
-
280
- class BasicLayout extends React.PureComponent {
281
- allFunc: any = createRef('');
282
- customerMenuRef: any = createRef('');
283
- actionRef: any = createRef<{
284
- reload: () => void;
285
- }>();
286
- constructor(props) {
287
- super(props);
288
- routerArray = this.updateTree(props.route.routes);
289
- const homeRouter = routerArray.filter(
290
- (itemroute) => itemroute.key === '/',
291
- )[0];
292
- const breadcrumbNameMap = getBreadcrumbNameMap(
293
- memoizeOneFormatter(props.route.routes, ''),
294
- );
295
- const hideMenuArray = ergodicMenuRoutes(props.route.routes);
296
-
297
- this.state = {
298
- listenRouterState: [
299
- { ...homeRouter, key: '/', tab: '欢迎', closable: false },
300
- ],
301
- listenRouterKey: ['/'],
302
- activeKey: '/',
303
- homeRouter,
304
- customerMatchs: [],
305
- breadcrumbNameMap,
306
- hideMenuArray,
307
- keyWord: '',
308
- collapse: false,
309
- drawerLeftParams: {
310
- visible: false,
311
- width: 690,
312
- title: '搜索',
313
- onClose: () => {
314
- this.setState({
315
- drawerLeftParams: {
316
- ...this.state.drawerLeftParams,
317
- visible: false,
318
- },
319
- });
320
- },
321
- },
322
- currentSubMenuData: [],
323
- showSubMenu: false,
324
- isSlider: false,
325
- };
326
- }
327
-
328
- componentDidMount() {
329
- const {
330
- history,
331
- location,
332
- itemPath,
333
- pathToRegexp,
334
- } = this.props;
335
-
336
- let istParent = 0;
337
-
338
- var self = this;
339
-
340
- window.top != window &&
341
- window.addEventListener('message', function (e) {
342
- istParent = 1;
343
- localStorage.setItem('isTabChange', true);
344
-
345
- if (typeof e.data === 'string') {
346
- history.push(e.data.replace(/^\/\w+\//, '/'));
347
- } else {
348
- const info = e.data;
349
- if (info.type === 'remove') {
350
- self.tabActions['remove'](info.key.replace(/^\/\w+\//, '/'));
351
- }
352
- }
353
- });
354
-
355
- UN_LISTTEN_DRP = history.listen((route) => {
356
- if ((window as any).__POWERED_BY_QIANKUN__) {
357
- if (window.location.href.indexOf(`/${itemPath}`) === -1) return;
358
- }
359
- const {
360
- listenRouterState,
361
- listenRouterKey,
362
- customerMatchs,
363
- hideMenuArray,
364
- } = this.state;
365
- let newListenRouterState = [...listenRouterState];
366
- let newListenRouterKey = [...listenRouterKey];
367
-
368
- let replaceRouter = routerArray.filter((itemRoute) =>
369
- pathToRegexp(itemRoute.key || '').test(route.pathname),
370
- )[0];
371
-
372
- if (!istParent) {
373
- if (route.pathname === '/') return;
374
- window.parent.postMessage(`/parent/${itemPath}${route.pathname}`, '*');
375
- }
376
-
377
- let currentKey = '';
378
-
379
- if (replaceRouter && replaceRouter.isOnlyOnePage) {
380
- // 处理中英文和特殊字符
381
- currentKey = decodeURIComponent(route.pathname);
382
- } else {
383
- currentKey = decodeURIComponent(
384
- route.pathname + this.parseQueryString(route.search),
385
- );
386
- }
387
-
388
- // 防止出错
389
- if (listenRouterKey.length !== listenRouterState.length) {
390
- listenRouterState.forEach((item, index) => {
391
- listenRouterKey[index] = item.key;
392
- });
393
- }
394
-
395
- if (!listenRouterKey.includes(currentKey)) {
396
- if (!replaceRouter) {
397
- replaceRouter = routerArray.filter(
398
- (itemroute) => itemroute.key === '/404',
399
- )?.[0];
400
-
401
- this.setState(
402
- {
403
- listenRouterState: [
404
- ...listenRouterState,
405
- { ...replaceRouter, key: currentKey, tab: '404' },
406
- ],
407
- activeKey: currentKey,
408
- listenRouterKey: [...listenRouterKey, currentKey],
409
- },
410
- () => {
411
- this.checkisNavSlide();
412
- },
413
- );
414
- } else {
415
- const match = matchPath(route.pathname, { path: replaceRouter.key }, pathToRegexp);
416
- newListenRouterState = [
417
- ...newListenRouterState,
418
- {
419
- ...replaceRouter,
420
- query: route.query,
421
- match: match,
422
- key: currentKey,
423
- tab: this.getPageTitle(route.pathname) + '',
424
- },
425
- ];
426
- newListenRouterKey = [...listenRouterKey, currentKey];
427
- }
428
- }
429
-
430
- // 处理hideMenu页面自动关闭
431
- lastTwoRouterArray.push(route.pathname);
432
- lastTwoRouterArray.shift();
433
- if (
434
- !localStorage.getItem('isTabChange') &&
435
- !localStorage.getItem('isMenuClick')
436
- ) {
437
- if (
438
- lastTwoRouterArray[0] &&
439
- typeof lastTwoRouterArray[0] === 'string'
440
- ) {
441
- let needRemoveKeyArray = hideMenuArray.filter((itemRoute) =>
442
- pathToRegexp(itemRoute.path || '').test(lastTwoRouterArray[0]),
443
- );
444
- // lastTwoRouterArray[0] != lastTwoRouterArray[1] 该判断条件用于判断是否是tab删除操作,如果是tab页删除操作,删除的是不是最后一个打开的tab页,执行history.push会导致错误的将最后打开的那个tab页也删除掉
445
- if (
446
- needRemoveKeyArray.length &&
447
- lastTwoRouterArray[0] != lastTwoRouterArray[1]
448
- ) {
449
- if (
450
- (!(
451
- lastTwoRouterArray[0].indexOf('/order/mainOrder/supplement') >=
452
- 0
453
- ) ||
454
- !pathToRegexp(
455
- '/order/mainOrder/:parmode/separateOrder/:id',
456
- ).test(lastTwoRouterArray[1])) &&
457
- (!pathToRegexp(
458
- '/order/mainOrder/:parmode/separateOrder/:id',
459
- ).test(lastTwoRouterArray[0]) ||
460
- !(
461
- lastTwoRouterArray[1].indexOf(
462
- 'order/mainOrder/separateOrder/',
463
- ) >= 0
464
- ))
465
- ) {
466
- if (!route.state?.thisHideInMenuDoNotClose) {
467
- newListenRouterState = newListenRouterState.filter((item) => {
468
- const [pathname] = item.key ? item.key.split('?') : [];
469
- return pathname && pathname !== lastTwoRouterArray[0];
470
- });
471
- newListenRouterKey = newListenRouterKey.filter((item) => {
472
- const [pathname] = item ? item.split('?') : [];
473
- return pathname && pathname !== lastTwoRouterArray[0];
474
- });
475
- }
476
- }
477
- }
478
- }
479
- // refs?.tableRef?.current?.refreshTable();
480
- } else {
481
- setTimeout(() => {
482
- // 处理页面刷新两面
483
- localStorage.removeItem('isTabChange');
484
- localStorage.removeItem('isMenuClick');
485
- }, 0);
486
- }
487
- this.setState(
488
- {
489
- //路由监听函数最后执行setState,避免处理hideMenu类型页面自动关闭的逻辑块内获取不到最新state的listenRouterState和listenRouterKey
490
- activeKey: currentKey,
491
- listenRouterState: newListenRouterState,
492
- listenRouterKey: newListenRouterKey,
493
- },
494
- () => {
495
- this.checkisNavSlide();
496
- },
497
- );
498
-
499
- istParent = 0;
500
- });
501
-
502
- if (
503
- localStorage.getItem('firstPage') &&
504
- localStorage.getItem('firstPage')?.startsWith(`#/${itemPath}/`)
505
- ) {
506
- istParent = 1;
507
- history.push(
508
- localStorage
509
- .getItem('firstPage')
510
- ?.slice(1)
511
- .replace(/^\/\w+\//, '/'),
512
- );
513
- } else {
514
- history.push(location);
515
- }
516
- }
517
-
518
- componentWillUnmount() {
519
- // eslint-disable-next-line no-unused-expressions
520
- UN_LISTTEN_DRP && UN_LISTTEN_DRP();
521
- }
522
-
523
- parseQueryString = (queryString) => {
524
- if (!queryString) {
525
- return '';
526
- }
527
-
528
- if (queryString.indexOf('?') < 0) {
529
- return `?${queryString}`;
530
- }
531
-
532
- return queryString;
533
- };
534
-
535
- updateTree = (Tree) => {
536
- const treeData = Tree;
537
- const treeList = [];
538
- // 递归获取树列表
539
- const getTreeList = (data) => {
540
- data.forEach((node) => {
541
- if (node.routes && node.routes.length > 0) {
542
- getTreeList(node.routes);
543
- } else {
544
- treeList.push({
545
- tab: node.locale,
546
- key: node.path,
547
- locale: node.locale,
548
- closable: true,
549
- content: node.component,
550
- name: node.name,
551
- hideInMenu: node.hideInMenu,
552
- isOnlyOnePage: node.isOnlyOnePage,
553
- });
554
- }
555
- });
556
- };
557
- getTreeList(treeData);
558
- return treeList;
559
- };
560
-
561
- getDictionarySource = (dicCode: string, needConvertInterger = false) => {
562
- const { dictionaryData } = this.props;
563
-
564
- let dicData = {};
565
-
566
- if (!dictionaryData) {
567
- let storageDic = localStorage.getItem(ENUM.BROWSER_CACHE.DICT_CODES)
568
- ? JSON.parse(localStorage.getItem(ENUM.BROWSER_CACHE.DICT_CODES))
569
- : {};
570
- dicData = storageDic[dicCode];
571
- } else {
572
- dicData = dictionaryData[dicCode];
573
- }
574
- // if (!dicData || !dicData.length) {
575
- // throw new Error(`当前没有${dicCode}字典值`);
576
- // }
577
-
578
- try {
579
- if (needConvertInterger) {
580
- dicData = dicData.map((item: { text: string; value: string }) => ({
581
- ...item,
582
- value: parseFloat(item.value),
583
- }));
584
- }
585
- } catch (e) { }
586
-
587
- return dicData;
588
- };
589
-
590
- getDictionaryTextByValue = (dicCode: string, value: string) => {
591
- let dicData = [];
592
- let dictionaryData: any;
593
- if (!dictionaryData) {
594
- let storageDic = localStorage.getItem(ENUM.BROWSER_CACHE.DICT_CODES)
595
- ? JSON.parse(localStorage.getItem(ENUM.BROWSER_CACHE.DICT_CODES))
596
- : {};
597
- dicData = storageDic[dicCode];
598
- } else {
599
- dicData = dictionaryData[dicCode];
600
- }
601
-
602
- if (!dicData || !dicData.length) {
603
- // throw new Error(`当前没有${dicCode}字典值`);
604
- }
605
-
606
- if (value === undefined) return '- -';
607
-
608
- const dicItemArray = dicData?.filter(
609
- (item: { value: string }) => item.value === value.toString(),
610
- );
611
-
612
- if (!dicItemArray?.length) {
613
- // throw new Error(`当前${dicCode}字典值合没有${value}的数据`)
614
- return value;
615
- }
616
-
617
- return dicItemArray[0].text;
618
- };
619
-
620
- timeFormat = (timeStr, format, notNeedConvertTimeZone) => {
621
- if (!timeStr) return '- -';
622
-
623
- if (notNeedConvertTimeZone) {
624
- return moment(timeStr).format(format);
625
- }
626
-
627
- return moment(timeStr).add(8, 'hours').format(format) || '- -';
628
- };
629
-
630
- onChange = (key) => {
631
- // console.log('onChange');
632
- if (key !== this.state.activeKey) {
633
- this.setState({
634
- activeKey: key,
635
- });
636
- localStorage.setItem('isTabChange', '1');
637
- history.push(key);
638
- }
639
- };
640
-
641
- getPageTitle = (pathname) => {
642
- const { formatMessage } = this.props;
643
- const { breadcrumbNameMap } = this.state;
644
- const currRouterData = this.matchParamsPath(pathname, breadcrumbNameMap);
645
-
646
- if (!currRouterData) {
647
- return '';
648
- }
649
- const pageName = formatMessage({
650
- id: currRouterData.locale || currRouterData.name,
651
- defaultMessage: currRouterData.name,
652
- });
653
-
654
- return `${pageName}`;
655
- };
656
-
657
- matchParamsPath = (pathname, breadcrumbNameMap) => {
658
- const { pathToRegexp } = this.props;
659
- const pathKey = Object.keys(breadcrumbNameMap).find((key) =>
660
- pathToRegexp(key).test(pathname),
661
- );
662
- return breadcrumbNameMap[pathKey];
663
- };
664
-
665
- onEdit = (
666
- targetKey: React.MouseEvent | React.KeyboardEvent | string,
667
- action: string,
668
- ) => {
669
- this.tabActions[action](targetKey);
670
- };
671
-
672
- tabActions: any = {
673
- remove: (targetKey: string) => {
674
- const { listenRouterState, activeKey, customerMatchs, listenRouterKey } =
675
- this.state;
676
-
677
- let lastIndex: number = 0;
678
- let newActiveKey: string | undefined = activeKey;
679
- let newListenRouterState = [];
680
- let newListenRouterKey = [];
681
-
682
- if (targetKey === activeKey) {
683
- listenRouterState.forEach((pane, i) => {
684
- if (pane.key === targetKey) {
685
- lastIndex = i - 1;
686
- }
687
- });
688
-
689
- newListenRouterState = listenRouterState.filter(
690
- (item) => item.key !== targetKey,
691
- );
692
- newListenRouterKey = listenRouterKey.filter(
693
- (item) => item !== targetKey,
694
- );
695
-
696
- if (lastIndex < 0) {
697
- lastIndex = 0;
698
- }
699
-
700
- newActiveKey = newListenRouterState[lastIndex].key;
701
- } else {
702
- newListenRouterState = listenRouterState.filter(
703
- (item) => item.key !== targetKey,
704
- );
705
- newListenRouterKey = listenRouterKey.filter(
706
- (item) => item !== targetKey,
707
- );
708
- }
709
-
710
- this.setState(
711
- {
712
- activeKey: newActiveKey,
713
- listenRouterState: newListenRouterState,
714
- listenRouterKey: newListenRouterKey,
715
- },
716
- () => {
717
- history.push({
718
- pathname: newActiveKey,
719
- });
720
- this.checkisNavSlide();
721
- },
722
- );
723
- },
724
- };
725
-
726
- updateState = (newListenRouterState, newListenRouterKey, cb) => {
727
- this.setState(
728
- {
729
- listenRouterState: newListenRouterState,
730
- listenRouterKey: newListenRouterKey,
731
- },
732
- () => {
733
- this.checkisNavSlide();
734
- if (cb) cb();
735
- },
736
- );
737
- };
738
-
739
- handleClose = () => {
740
- this.setState({
741
- drawerLeftParams: {
742
- ...this.state.drawerLeftParams,
743
- visible: false,
744
- },
745
- isCollapse: true,
746
- });
747
- this.allFunc.current?.close?.();
748
- this.customerMenuRef.current?.close?.();
749
- };
750
-
751
- handleMenuClick = (item: any) => {
752
- if (item.children || !item.component) return;
753
- history.push({
754
- pathname: item.path,
755
- });
756
- this.setShowMenu(false);
757
- };
758
-
759
- getMenuDom = (menuData) => {
760
- return menuData.map((item) => (
761
- <div>
762
- <div
763
- onClick={() => {
764
- this.handleMenuClick(item);
765
- }}
766
- className={`${'menu_item'} ${item.children || !item.component ? '' : 'link_style'
767
- }`}
768
- style={{
769
- fontWeight: item.children || !item.component ? 'bolder' : '400',
770
- paddingLeft: '10px',
771
- marginTop: item.children || !item.component ? '5px' : '0px',
772
- fontSize: item.children || !item.component ? '14px' : '12px',
773
- }}
774
- >
775
- {item.name}
776
- </div>
777
- {!!item.children &&
778
- !!item.children.length &&
779
- this.getMenuDom(item.children)}
780
- </div>
781
- ));
782
- };
783
-
784
- setShowMenu = debounce((isShow) => {
785
- this.setState({
786
- showSubMenu: isShow,
787
- });
788
- }, 500);
789
-
790
- //设置tabs标签左右滚动
791
- setTabNavTransLate = (num) => {
792
- let globalTabsNav = document
793
- .getElementById('globalTabs')
794
- ?.getElementsByClassName('ant-tabs-nav-list')?.[0];
795
- let globalTabsNavWrap = document
796
- .getElementById('globalTabs')
797
- ?.getElementsByClassName('ant-tabs-nav-wrap')?.[0];
798
- let wrapWidth = globalTabsNavWrap.offsetWidth; //tabsNav父节点宽度
799
- let navListWidth = globalTabsNav.offsetWidth; //tabsNav总宽度
800
- if (navListWidth - wrapWidth <= 0) return;
801
- let maxTransX = navListWidth - wrapWidth; // 允许移动最大宽度
802
- let transXStr = document.defaultView?.getComputedStyle(
803
- globalTabsNav,
804
- null,
805
- ).transform;
806
- let transx = transXStr?.split(',')[4]; //当前translateX的值
807
-
808
- let targetTransX = Math.abs(Number(transx)) + num;
809
- if (targetTransX <= 0) targetTransX = 0;
810
- if (targetTransX >= Number(maxTransX)) targetTransX = Number(maxTransX);
811
- globalTabsNav.style.transform = 'translateX(-' + targetTransX + 'px)';
812
- };
813
-
814
- checkisNavSlide = () => {
815
- if (window.top != window) return;
816
- //监听tabs页签总长度判断是否可点击滑动
817
- let globalTabsNav = document
818
- .getElementById('globalTabs')
819
- ?.getElementsByClassName('ant-tabs-nav-list')?.[0];
820
- let globalTabsNavWrap = document
821
- .getElementById('globalTabs')
822
- ?.getElementsByClassName('ant-tabs-nav-wrap')?.[0];
823
- let wrapWidth = globalTabsNavWrap?.offsetWidth; //tabsNav父节点宽度
824
- let navListWidth = globalTabsNav?.offsetWidth; //tabsNav总宽度
825
- if (navListWidth - wrapWidth <= 0) {
826
- this.setState({
827
- isSlider: false,
828
- });
829
- return;
830
- }
831
- this.setState({
832
- isSlider: true,
833
- });
834
- };
835
-
836
- changeListenRouterState = (dragIndex: number, hoverIndex: number) => {
837
- const { listenRouterState, listenRouterKey } = this.state;
838
- let dragItem = listenRouterState[dragIndex];
839
- let dragKeyItem = listenRouterKey[dragIndex];
840
-
841
- listenRouterState.splice(dragIndex, 1);
842
- listenRouterState.splice(hoverIndex, 0, dragItem);
843
-
844
- listenRouterKey.splice(dragIndex, 1);
845
- listenRouterKey.splice(hoverIndex, 0, dragKeyItem);
846
- };
847
-
848
- operateFun = (key, type) => {
849
- const { listenRouterState, activeKey, listenRouterKey } = this.state;
850
- let deleteKey = '';
851
- let newlistenRouterState = [];
852
- let newlistenRouterKey = [];
853
- let newActiveKey = '';
854
- let deleteIndex = 0;
855
- if (type === 'self') {
856
- deleteIndex = listenRouterState.findIndex((item) => item.key === key);
857
- deleteKey = key;
858
- if (deleteIndex > 0) {
859
- newActiveKey = listenRouterState[deleteIndex - 1].key;
860
- } else {
861
- newActiveKey = listenRouterState[1].key;
862
- }
863
- newlistenRouterState = listenRouterState.filter((d) => d.key !== key);
864
- newlistenRouterKey = listenRouterKey.filter((d) => d !== key);
865
- this.updateState(newlistenRouterState, newlistenRouterKey, () => {
866
- if (deleteKey === activeKey) {
867
- history.push({
868
- pathname: newActiveKey,
869
- });
870
- }
871
- });
872
- }
873
- if (type === 'left') {
874
- const index = listenRouterState.findIndex((item) => item.key === key);
875
- newlistenRouterState = listenRouterState.filter(
876
- (d: any, i: number) => i >= index || d.key === '/',
877
- );
878
- newlistenRouterKey = listenRouterKey.filter(
879
- (d: any, i: number) => i >= index || d === '/',
880
- );
881
- this.updateState(newlistenRouterState, newlistenRouterKey, () => {
882
- if (newlistenRouterKey.find((item) => item === activeKey)) {
883
- return;
884
- } else {
885
- history.push({
886
- pathname: key,
887
- });
888
- }
889
- });
890
- }
891
- if (type === 'right') {
892
- const index = listenRouterState.findIndex((item) => item.key === key);
893
- newlistenRouterState = listenRouterState.filter(
894
- (d: any, i: number) => i <= index || d.key === '/',
895
- );
896
- newlistenRouterKey = listenRouterKey.filter(
897
- (d: any, i: number) => i <= index || d === '/',
898
- );
899
- this.updateState(
900
- listenRouterState.filter(
901
- (d: any, i: number) => i <= index || d.key === '/',
902
- ),
903
- listenRouterKey.filter((d: any, i: number) => i <= index || d === '/'),
904
- () => {
905
- if (newlistenRouterKey.find((item) => item === activeKey)) {
906
- return;
907
- } else {
908
- history.push({
909
- pathname: key,
910
- });
911
- }
912
- },
913
- );
914
- }
915
- if (type === 'all') {
916
- this.updateState(
917
- listenRouterState.filter((item) => item.key === '/'),
918
- listenRouterKey.filter((item) => item === '/'),
919
- () => {
920
- history.push({
921
- pathname: '/',
922
- });
923
- },
924
- );
925
- }
926
- if (type === 'other') {
927
- this.updateState(
928
- listenRouterState.filter(
929
- (item) => item.key === key || item.key === '/',
930
- ),
931
- listenRouterKey.filter((item) => item === key || item === '/'),
932
- () => {
933
- if (key !== activeKey) {
934
- history.push({
935
- pathname: key,
936
- });
937
- }
938
- },
939
- );
940
- }
941
- };
942
-
943
- render() {
944
- const {
945
- listenRouterState,
946
- activeKey,
947
- listenRouterKey,
948
- drawerLeftParams,
949
- collapse,
950
- currentSubMenuData,
951
- showSubMenu,
952
- currentSubPath,
953
- } = this.state;
954
- const { originRoutes, itemPath, defaultSettings, transparentProps={} } = this.props;
955
- const TabTitle: React.FC<{}> = ({ item, index, updateState }) => {
956
- return (
957
- <div className="tab_title_content">
958
- {item.tab}
959
- {item.key !== '/' && (
960
- <ItemMenu
961
- info={item}
962
- operateFun={this.operateFun}
963
- listenRouterState={listenRouterState}
964
- />
965
- )}
966
- </div>
967
- );
968
- };
969
-
970
- // 左侧菜单 route
971
- const dataShowRoute = this.props.routes.find(
972
- (route) => route.path === '/homePage/data-show',
973
- ); // 添加数据大屏
974
- const { route, ...restPrpos } = this.props;
975
- const exist = route.routes.find(
976
- (route) => route.path === '/homePage/data-show',
977
- );
978
- if (dataShowRoute && !exist) {
979
- route.routes.splice(1, 0, dataShowRoute);
980
- }
981
-
982
- const menu = (
983
- <Menu>
984
- <Menu.Item
985
- key="0"
986
- style={{
987
- background: '#FFFFFF',
988
- color: '#848484',
989
- fontSize: '12px',
990
- textAlign: 'center',
991
- }}
992
- >
993
- <div>已打开的页签数: {listenRouterState.length}</div>
994
- </Menu.Item>
995
- <Menu.Item key="1" style={{ fontSize: '12px', textAlign: 'center' }}>
996
- <a
997
- onClick={() => {
998
- // 关闭全部
999
- this.updateState(
1000
- [
1001
- {
1002
- ...this.state.homeRouter,
1003
- key: '/',
1004
- tab: '欢迎',
1005
- closable: false,
1006
- },
1007
- ],
1008
- ['/'],
1009
- () => {
1010
- history.push('/');
1011
- },
1012
- );
1013
- }}
1014
- >
1015
- 关闭全部标签
1016
- </a>
1017
- </Menu.Item>
1018
- <Menu.Item key="2" style={{ fontSize: '12px', textAlign: 'center' }}>
1019
- <a
1020
- onClick={() => {
1021
- if (activeKey === '/') return;
1022
- const index = listenRouterState.findIndex(
1023
- (item) => item.key === activeKey,
1024
- );
1025
- let newActiveKey = '';
1026
- if (index > 0) {
1027
- newActiveKey = listenRouterState[index - 1].key;
1028
- } else {
1029
- newActiveKey = listenRouterState[1].key;
1030
- }
1031
- this.updateState(
1032
- listenRouterState.filter((d) => d.key !== activeKey),
1033
- listenRouterKey.filter((d) => d !== activeKey),
1034
- () => {
1035
- history.push({
1036
- pathname: newActiveKey,
1037
- });
1038
- },
1039
- );
1040
- }}
1041
- >
1042
- 关闭当前标签
1043
- </a>
1044
- </Menu.Item>
1045
- <Menu.Item key="3" style={{ fontSize: '12px', textAlign: 'center' }}>
1046
- <a
1047
- onClick={() => {
1048
- const index = listenRouterState.findIndex(
1049
- (item) => item.key === activeKey,
1050
- );
1051
- // let deleteKey = listenRouterState[index - 1]?.key;
1052
- // if (deleteKey === '/') {
1053
- // message.warning('首页不可关闭。');
1054
- // return;
1055
- // }
1056
-
1057
- this.updateState(
1058
- listenRouterState.filter(
1059
- (d: any, i: number) => i >= index || d.key === '/',
1060
- ),
1061
- listenRouterKey.filter(
1062
- (d: any, i: number) => i >= index || d === '/',
1063
- ),
1064
- );
1065
- }}
1066
- >
1067
- 关闭其左侧标签
1068
- </a>
1069
- </Menu.Item>
1070
- <Menu.Item key="4" style={{ fontSize: '12px', textAlign: 'center' }}>
1071
- <a
1072
- onClick={() => {
1073
- let index = listenRouterState.findIndex(
1074
- (item) => item.key === activeKey,
1075
- );
1076
- this.updateState(
1077
- listenRouterState.filter(
1078
- (d: any, i: number) => i <= index || d.key === '/',
1079
- ),
1080
- listenRouterKey.filter(
1081
- (d: any, i: number) => i <= index || d === '/',
1082
- ),
1083
- );
1084
- }}
1085
- >
1086
- 关闭其右侧标签
1087
- </a>
1088
- </Menu.Item>
1089
- </Menu>
1090
- );
1091
-
1092
- const filterByMenuDate = (
1093
- data: MenuDataItem[],
1094
- keyWord: string,
1095
- ): MenuDataItem[] =>
1096
- data
1097
- .map((item) => {
1098
- if (item.name && item.name.includes(keyWord)) {
1099
- return {
1100
- ...item,
1101
- };
1102
- }
1103
- return undefined;
1104
- })
1105
- .filter((item) => item) as MenuDataItem[];
1106
-
1107
- let weiqianduanProps = {};
1108
- let isWeiqianduan = false;
1109
-
1110
- if (window.top != window) {
1111
- isWeiqianduan = true;
1112
- weiqianduanProps = {
1113
- headerRender: false,
1114
- footerRender: false,
1115
- menuRender: false,
1116
- menuHeaderRender: false,
1117
- menuExtraRender: false,
1118
- };
1119
- }
1120
-
1121
- const OperationsSlot: Record<PositionType, React.ReactNode> = {
1122
- left: (
1123
- <div className={'tab_left_operate'}>
1124
- <div
1125
- onClick={() => {
1126
- history.push({
1127
- pathname: '/',
1128
- });
1129
- }}
1130
- >
1131
- <HomeOutlined />
1132
- </div>
1133
- <div
1134
- style={{ opacity: this.state.isSlider ? 1 : 0.5 }}
1135
- onClick={() => {
1136
- this.setTabNavTransLate(-100);
1137
- }}
1138
- >
1139
- <DoubleLeftOutlined />
1140
- </div>
1141
- </div>
1142
- ),
1143
- right: (
1144
- <div
1145
- style={{ opacity: this.state.isSlider ? 1 : 0.5 }}
1146
- className={'tab_right_operate'}
1147
- onClick={() => {
1148
- this.setTabNavTransLate(100);
1149
- }}
1150
- >
1151
- <DoubleRightOutlined />
1152
- </div>
1153
- ),
1154
- };
1155
-
1156
- return (
1157
- <ProLayout
1158
- actionRef={this.actionRef}
1159
- onMenuHeaderClick={() => history.push('/')}
1160
- menuHeaderRender={({ }) => (
1161
- <CustomerMenuHeader
1162
- originRoutes={originRoutes}
1163
- itemPath={itemPath}
1164
- handleClose={this.handleClose}
1165
- collapsed={collapse}
1166
- />
1167
- )}
1168
- menuExtraRender={() => {
1169
- if (!collapse) {
1170
- return (
1171
- <div>
1172
- <CustomerMenu
1173
- originRoutes={originRoutes}
1174
- itemPath={itemPath}
1175
- ref={this.customerMenuRef}
1176
- actionRef={this.actionRef}
1177
- handleClose={this.handleClose}
1178
- isCollapse={this.state.collapse}
1179
- />
1180
- </div>
1181
- );
1182
- }
1183
- return (
1184
- <div className="collapse_icon_close">
1185
- <span
1186
- className="collapse_icon"
1187
- onClick={() => {
1188
- this.setState({
1189
- collapse: !collapse,
1190
- });
1191
- }}
1192
- >
1193
- <MenuUnfoldOutlined />
1194
- </span>
1195
- </div>
1196
- );
1197
- }}
1198
- menuProps={{
1199
- onClick: () => {
1200
- localStorage.setItem('isMenuClick', 'true');
1201
- },
1202
- }}
1203
- collapsed={collapse}
1204
- onCollapse={(boo: boolean) => {
1205
- this.setState({
1206
- collapse: boo,
1207
- });
1208
- }}
1209
- menuItemRender={(menuItemProps, defaultDom) => {
1210
- if (menuItemProps?.path === '/') {
1211
- return (
1212
- <>
1213
- <div className="one_menu_wrap">
1214
- <Link
1215
- onClick={() => {
1216
- localStorage.setItem('isMenuClick', 'true');
1217
- }}
1218
- to={menuItemProps.path}
1219
- >
1220
- {defaultDom}
1221
- </Link>
1222
- </div>
1223
- </>
1224
- );
1225
- }
1226
- return (
1227
- <Link
1228
- onClick={() => {
1229
- localStorage.setItem('isMenuClick', 'true');
1230
- }}
1231
- to={menuItemProps.path}
1232
- >
1233
- {defaultDom}
1234
- </Link>
1235
- );
1236
- }}
1237
- subMenuItemRender={(menuItemProps, defaultDom) => {
1238
- return (
1239
- <div
1240
- style={{
1241
- height: '40px',
1242
- lineHeight: '40px',
1243
- position: 'relative',
1244
- overflow: 'hidden',
1245
- textOverflow: 'ellipsis',
1246
- whiteSpace: 'nowrap',
1247
- boxSizing: 'border-box',
1248
- paddingRight: '10px',
1249
- }}
1250
- onMouseEnter={() => {
1251
- if (
1252
- menuItemProps.pro_layout_parentKeys &&
1253
- menuItemProps.pro_layout_parentKeys.length
1254
- )
1255
- return;
1256
- this.setState({
1257
- currentSubMenuData: menuItemProps.children,
1258
- currentSubPath: menuItemProps.path,
1259
- });
1260
- this.setShowMenu(true);
1261
- }}
1262
- onMouseLeave={() => {
1263
- this.setShowMenu(false);
1264
- }}
1265
- >
1266
- {defaultDom}
1267
- {showSubMenu &&
1268
- currentSubPath === menuItemProps.path &&
1269
- !collapse && (
1270
- <CaretLeftOutlined
1271
- style={{ position: 'absolute', top: '14px', right: '-4px' }}
1272
- />
1273
- )}
1274
- </div>
1275
- );
1276
- }}
1277
- collapsedButtonRender={() => {
1278
- return (
1279
- <div
1280
- onClick={(e) => {
1281
- e.stopPropagation();
1282
- }}
1283
- className="banquan"
1284
- >
1285
- {''}
1286
- </div>
1287
- );
1288
- }}
1289
- postMenuData={(menus) => {
1290
- return [...filterByMenuDate(menus || [], this.state.keyWord)];
1291
- }}
1292
- links={[
1293
- !this.state.collapse ? (
1294
- <AllFunc
1295
- ref={this.allFunc}
1296
- itemPath={itemPath}
1297
- handleClose={this.handleClose}
1298
- isCollapse={this.state.collapse}
1299
- />
1300
- ) : (
1301
- ''
1302
- ),
1303
- ]}
1304
- onPageChange={() => {
1305
- const { location } = history;
1306
- // 如果没有登录,重定向到 login
1307
- if (
1308
- !localStorage.getItem(ENUM.BROWSER_CACHE.USER_INFO) &&
1309
- location.pathname !== '/user/login'
1310
- ) {
1311
- history.push('/user/login');
1312
- }
1313
- }}
1314
- headerRender={(props) => <GlobalHeaderCom {...props} />}
1315
- menu={{
1316
- request: async () => {
1317
- return JSON.parse(
1318
- localStorage.getItem(`customerMenu_${itemPath}_front`) || '[]',
1319
- );
1320
- },
1321
- type: 'group',
1322
- }}
1323
- route={route}
1324
- {...restPrpos}
1325
- {...defaultSettings}
1326
- {...weiqianduanProps}
1327
- >
1328
- <div id="globalTabsContent" className="globalTabs">
1329
- <DraggableTabs
1330
- activeKey={activeKey}
1331
- id="globalTabs"
1332
- onChange={this.onChange}
1333
- // tabBarExtraContent={operations}
1334
- type="editable-card"
1335
- tabBarStyle={{
1336
- background: '#f3f3f3',
1337
- height: '28px',
1338
- marginRight: 0,
1339
- fontSize: '12px',
1340
- color: '#2C2F2E70',
1341
- marginBottom: '-2px',
1342
- position: 'fixed',
1343
- top: 50,
1344
- zIndex: 10,
1345
- width: collapse ? 'calc(100% - 75px)' : 'calc(100% - 167px)',
1346
- display: isWeiqianduan ? 'none' : 'flex',
1347
- }}
1348
- tabPosition="top"
1349
- tabBarGutter={8}
1350
- onEdit={this.onEdit}
1351
- tabBarExtraContent={OperationsSlot}
1352
- animated={false}
1353
- hideAdd
1354
- >
1355
- {listenRouterState.map((item, index) => (
1356
- <TabPane
1357
- tab={
1358
- <TabTitle
1359
- item={item}
1360
- index={index}
1361
- updateState={this.updateState}
1362
- />
1363
- }
1364
- style={{ marginTop: isWeiqianduan ? 0 : 30 }}
1365
- key={item.key}
1366
- closable={item.key !== '/'}
1367
- closeIcon={<img src="./biaoqian-guanbi-icon.svg" />}
1368
- >
1369
- <WrapperComponent
1370
- item={item}
1371
- routerProps={this.props}
1372
- getDictionarySource={this.getDictionarySource}
1373
- getDictionaryTextByValue={this.getDictionaryTextByValue}
1374
- timeFormat={this.timeFormat}
1375
- transparentProps={transparentProps}
1376
- />
1377
- </TabPane>
1378
- ))}
1379
- </DraggableTabs>
1380
- <div
1381
- className="globalTabsOper"
1382
- style={{
1383
- position: 'fixed',
1384
- top: '50px',
1385
- zIndex: 10,
1386
- background: '#fff',
1387
- display: isWeiqianduan ? 'none' : 'block',
1388
- borderLeft: '1px solid #E4E4E4',
1389
- }}
1390
- >
1391
- <Dropdown overlay={menu} trigger={['click']}>
1392
- <a
1393
- className="ant-dropdown-link"
1394
- onClick={(e) => e.preventDefault()}
1395
- >
1396
- <DashOutlined />
1397
- </a>
1398
- </Dropdown>
1399
- </div>
1400
- <SearchFunc itemPath={itemPath} {...drawerLeftParams}></SearchFunc>
1401
- <div
1402
- onMouseEnter={() => {
1403
- this.setShowMenu(true);
1404
- }}
1405
- onMouseLeave={() => {
1406
- this.setShowMenu(false);
1407
- }}
1408
- className={'sub_menu_content'}
1409
- style={{ display: showSubMenu && !collapse ? 'block' : 'none' }}
1410
- >
1411
- {this.getMenuDom(currentSubMenuData)}
1412
- </div>
1413
- </div>
1414
- </ProLayout>
1415
- );
1416
- }
1417
- }
1418
-
1419
- class WrapperComponent extends React.Component {
1420
- constructor(props) {
1421
- super(props);
1422
- }
1423
-
1424
- shouldComponentUpdate() {
1425
- return false;
1426
- }
1427
-
1428
- render() {
1429
- const {
1430
- item,
1431
- routerProps,
1432
- getDictionarySource,
1433
- getDictionaryTextByValue,
1434
- timeFormat,
1435
- transparentProps,
1436
- } = this.props;
1437
- return (
1438
- <>
1439
- {React.createElement(item.content, {
1440
- getDictionarySource: getDictionarySource,
1441
- getDictionaryTextByValue: getDictionaryTextByValue,
1442
- timeFormat: timeFormat,
1443
- ...routerProps,
1444
- ...transparentProps,
1445
- match: item.match,
1446
- })}
1447
- </>
1448
- );
1449
- }
1450
- }
1451
-
1452
- export default (props) => {
1453
- const { initialState = {} } = useModel('@@initialState');
1454
-
1455
- const { dictionaryData } = initialState;
1456
- const intl = useIntl();
1457
- const { formatMessage } = intl;
1458
- return (
1459
- <BasicLayout
1460
- {...props}
1461
- dictionaryData={dictionaryData}
1462
- formatMessage={formatMessage}
1463
- />
1464
- );
1465
- };