@bit-sun/business-component 2.1.19 → 2.1.21

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 (149) hide show
  1. package/.editorconfig +16 -16
  2. package/.fatherrc.ts +5 -5
  3. package/.gitlab-ci.yml +179 -179
  4. package/.prettierignore +7 -7
  5. package/.prettierrc +11 -11
  6. package/.umirc.ts +74 -74
  7. package/README.md +27 -27
  8. package/dist/components/Business/BsLayouts/Components/AllFunc/drawContent.d.ts +1 -1
  9. package/dist/components/Business/BsLayouts/Components/AllFunc/index.d.ts +1 -1
  10. package/dist/components/Business/BsLayouts/Components/RightContent/index.d.ts +2 -2
  11. package/dist/components/Business/BsLayouts/Components/SearchFunc/index.d.ts +2 -2
  12. package/dist/components/Business/BsLayouts/index.d.ts +2 -2
  13. package/dist/components/Business/BsSulaQueryTable/utils.d.ts +2 -2
  14. package/dist/index.esm.js +14728 -11306
  15. package/dist/index.js +14725 -11303
  16. package/dist/utils/TableUtils.d.ts +2 -2
  17. package/dist/utils/utils.d.ts +11 -1
  18. package/docs/index.md +21 -21
  19. package/lib/assets/drag.svg +17 -17
  20. package/lib/assets/exportFail.svg +37 -37
  21. package/lib/assets/exportProcessing.svg +28 -28
  22. package/lib/assets/exportSuccess.svg +34 -34
  23. package/lib/assets/label_icon_bottom.svg +25 -25
  24. package/lib/assets/upExport.svg +22 -22
  25. package/package.json +71 -71
  26. package/src/assets/32.svg +27 -27
  27. package/src/assets/addIcon.svg +17 -17
  28. package/src/assets/allfunc.svg +27 -27
  29. package/src/assets/arrowRight.svg +24 -24
  30. package/src/assets/btn-delete.svg +29 -29
  31. package/src/assets/btn-edit.svg +19 -19
  32. package/src/assets/btn-more.svg +17 -17
  33. package/src/assets/btn-submit.svg +19 -19
  34. package/src/assets/caidan.svg +11 -11
  35. package/src/assets/close.svg +26 -26
  36. package/src/assets/drag.svg +17 -17
  37. package/src/assets/exportFail.svg +37 -37
  38. package/src/assets/exportProcessing.svg +28 -28
  39. package/src/assets/exportSuccess.svg +34 -34
  40. package/src/assets/fixed-left-active.svg +11 -11
  41. package/src/assets/fixed-left.svg +15 -15
  42. package/src/assets/fixed-right-active.svg +11 -11
  43. package/src/assets/fixed-right.svg +15 -15
  44. package/src/assets/guanbi.svg +15 -15
  45. package/src/assets/icon-quanping.svg +15 -15
  46. package/src/assets/icon-shezhi.svg +17 -17
  47. package/src/assets/label_icon_bottom.svg +25 -25
  48. package/src/assets/list-no-img.svg +21 -21
  49. package/src/assets/morentouxiang-32.svg +23 -23
  50. package/src/assets/scanning.svg +24 -24
  51. package/src/assets/upExport.svg +22 -22
  52. package/src/components/Business/AddSelectBusiness/index.md +41 -41
  53. package/src/components/Business/AddSelectBusiness/index.tsx +341 -341
  54. package/src/components/Business/BsLayouts/Components/AllFunc/drawContent.tsx +111 -111
  55. package/src/components/Business/BsLayouts/Components/AllFunc/index.less +153 -153
  56. package/src/components/Business/BsLayouts/Components/AllFunc/index.tsx +70 -70
  57. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.less +90 -90
  58. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.tsx +37 -37
  59. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.tsx +242 -242
  60. package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.tsx +384 -384
  61. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.tsx +285 -285
  62. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.tsx +74 -74
  63. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/drawContent.less +170 -170
  64. package/src/components/Business/BsLayouts/Components/CustomerMenu/index.less +64 -64
  65. package/src/components/Business/BsLayouts/Components/CustomerMenu/index.tsx +153 -153
  66. package/src/components/Business/BsLayouts/Components/GlobalHeader/index.less +72 -72
  67. package/src/components/Business/BsLayouts/Components/GlobalHeader/index.tsx +157 -157
  68. package/src/components/Business/BsLayouts/Components/RightContent/LoginModal.tsx +85 -85
  69. package/src/components/Business/BsLayouts/Components/RightContent/home.less +218 -218
  70. package/src/components/Business/BsLayouts/Components/RightContent/index.tsx +156 -156
  71. package/src/components/Business/BsLayouts/Components/SearchFunc/index.less +160 -160
  72. package/src/components/Business/BsLayouts/Components/SearchFunc/index.tsx +75 -75
  73. package/src/components/Business/BsLayouts/index.less +79 -79
  74. package/src/components/Business/BsLayouts/index.tsx +1479 -1479
  75. package/src/components/Business/BsLayouts/service.ts +10 -10
  76. package/src/components/Business/BsLayouts/utils.tsx +230 -230
  77. package/src/components/Business/BsSulaQueryTable/index.less +219 -219
  78. package/src/components/Business/BsSulaQueryTable/index.tsx +476 -507
  79. package/src/components/Business/BsSulaQueryTable/setting.tsx +802 -802
  80. package/src/components/Business/BsSulaQueryTable/utils.less +65 -65
  81. package/src/components/Business/BsSulaQueryTable/utils.tsx +688 -688
  82. package/src/components/Business/CommodityEntry/index.md +70 -70
  83. package/src/components/Business/CommodityEntry/index.tsx +80 -80
  84. package/src/components/Business/CommonAlert/index.tsx +23 -23
  85. package/src/components/Business/CommonGuideWrapper/index.less +111 -111
  86. package/src/components/Business/CommonGuideWrapper/index.md +39 -39
  87. package/src/components/Business/CommonGuideWrapper/index.tsx +83 -83
  88. package/src/components/Business/DetailPageWrapper/index.less +79 -79
  89. package/src/components/Business/DetailPageWrapper/index.tsx +335 -335
  90. package/src/components/Business/DetailPageWrapper/utils.tsx +100 -100
  91. package/src/components/Business/HomePageWrapper/index.less +33 -33
  92. package/src/components/Business/HomePageWrapper/index.md +45 -45
  93. package/src/components/Business/HomePageWrapper/index.tsx +162 -162
  94. package/src/components/Business/SearchSelect/BusinessUtils.ts +1586 -1530
  95. package/src/components/Business/SearchSelect/common.ts +53 -53
  96. package/src/components/Business/SearchSelect/index.md +1254 -1197
  97. package/src/components/Business/SearchSelect/index.tsx +51 -51
  98. package/src/components/Business/SearchSelect/utils.ts +100 -100
  99. package/src/components/Business/StateFlow/index.less +130 -130
  100. package/src/components/Business/StateFlow/index.md +60 -60
  101. package/src/components/Business/StateFlow/index.tsx +29 -29
  102. package/src/components/Business/TreeSearchSelect/index.md +126 -126
  103. package/src/components/Business/TreeSearchSelect/index.tsx +34 -34
  104. package/src/components/Business/TreeSearchSelect/utils.ts +60 -60
  105. package/src/components/Business/columnSettingTable/columnSetting.tsx +764 -764
  106. package/src/components/Business/columnSettingTable/index.less +247 -247
  107. package/src/components/Business/columnSettingTable/index.md +357 -357
  108. package/src/components/Business/columnSettingTable/index.tsx +232 -232
  109. package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +240 -240
  110. package/src/components/Business/columnSettingTable/utils.tsx +68 -68
  111. package/src/components/Business/moreTreeTable/index.less +99 -99
  112. package/src/components/Business/moreTreeTable/index.md +508 -508
  113. package/src/components/Business/moreTreeTable/index.tsx +315 -315
  114. package/src/components/Business/moreTreeTable/utils.ts +126 -126
  115. package/src/components/Functional/AddSelect/index.less +367 -367
  116. package/src/components/Functional/AddSelect/index.md +154 -154
  117. package/src/components/Functional/AddSelect/index.tsx +992 -992
  118. package/src/components/Functional/BillEntry/index.less +371 -371
  119. package/src/components/Functional/BillEntry/index.md +39 -39
  120. package/src/components/Functional/BillEntry/index.tsx +671 -671
  121. package/src/components/Functional/DataImport/index.less +63 -63
  122. package/src/components/Functional/DataImport/index.md +44 -44
  123. package/src/components/Functional/DataImport/index.tsx +695 -695
  124. package/src/components/Functional/DataValidation/index.less +63 -63
  125. package/src/components/Functional/DataValidation/index.md +39 -39
  126. package/src/components/Functional/DataValidation/index.tsx +687 -687
  127. package/src/components/Functional/ExportFunctions/ExportIcon/index.md +37 -37
  128. package/src/components/Functional/ExportFunctions/ExportIcon/index.tsx +59 -59
  129. package/src/components/Functional/QueryMutipleInput/index.less +37 -37
  130. package/src/components/Functional/QueryMutipleInput/index.md +33 -33
  131. package/src/components/Functional/QueryMutipleInput/index.tsx +128 -128
  132. package/src/components/Functional/SearchSelect/index.less +115 -115
  133. package/src/components/Functional/SearchSelect/index.md +141 -141
  134. package/src/components/Functional/SearchSelect/index.tsx +813 -813
  135. package/src/components/Functional/SearchSelect/utils.ts +6 -6
  136. package/src/components/Functional/TreeSearchSelect/index.md +47 -47
  137. package/src/components/Functional/TreeSearchSelect/index.tsx +149 -149
  138. package/src/index.ts +32 -32
  139. package/src/styles/bsDefault.less +1906 -1906
  140. package/src/utils/CheckOneUser/index.md +39 -39
  141. package/src/utils/CheckOneUser/index.ts +51 -51
  142. package/src/utils/TableUtils.tsx +18 -18
  143. package/src/utils/checkUtils.ts +39 -39
  144. package/src/utils/enumConfig.ts +10 -10
  145. package/src/utils/index.ts +2 -2
  146. package/src/utils/requestUtils.ts +33 -33
  147. package/src/utils/utils.ts +142 -57
  148. package/tsconfig.json +29 -29
  149. package/typings.d.ts +4 -4
@@ -1,336 +1,336 @@
1
- // @ts-nocheck
2
- import {
3
- ArrowLeftOutlined,
4
- } from '@ant-design/icons';
5
- import { Anchor, Tooltip, Button, Menu, Dropdown, Breadcrumb } from 'antd';
6
- import React, { useEffect, useState, useMemo } from 'react';
7
- import { history } from 'umi';
8
- import { getMainCrumbNameMap, doDetailPageAction, judgeIsEmpty } from './utils';
9
- import { memoizeOneFormatter, go2BackAndClose } from '@/utils/utils';
10
- import './index.less';
11
- import quanping from '../../../assets/icon-quanping.svg';
12
- import scanning from '../../../assets/scanning.svg';
13
- import editIcon from '../../../assets/btn-edit.svg';
14
- import submitIcon from '../../../assets/btn-submit.svg';
15
- import deleteIcon from '../../../assets/btn-delete.svg';
16
- import moreIcon from '../../../assets/btn-more.svg';
17
- import { useLocation, formatMessage } from 'umi';
18
- import CommonAlert from '../CommonAlert';
19
- import ENUM from '@/utils/enumConfig';
20
-
21
- interface actionItem {
22
- type?: string;
23
- name: string;
24
- icon?: string;
25
- visible?: boolean | string;
26
- disabled?: boolean;
27
- code?: string; //权限过滤todo
28
- action: object;
29
- }
30
-
31
- export const iconMap = {
32
- edit: <img src={editIcon} />,
33
- delete: <img src={deleteIcon} />,
34
- submit: <img src={submitIcon} />,
35
- more: <img src={moreIcon} />,
36
- };
37
-
38
- export default (props: any) => {
39
- const { pathname } = useLocation();
40
- const [id]: any = useState(pathname + 'id');
41
- const { children, ...restProps } = props;
42
-
43
- return (
44
- <div id={id} className={'detail_page_wrapper'}>
45
- <DetailWrapper
46
- pathname={pathname}
47
- {
48
- ...restProps
49
- }
50
- />
51
- {children}
52
- </div>
53
- );
54
- };
55
-
56
- const DetailWrapper = React.memo(
57
- ({
58
- pathname,
59
- actionList=[],
60
- routes=[],
61
- itemPath,
62
- alertProps,
63
- donotNeedShowScreenIcon=false,
64
- title,
65
- pathToRegexp,
66
- }: any) => {
67
- const [isFullScreen, setIsFnllScreen]: any = useState(false);
68
- const [breadcrumbArr, setBreadCrumbArr]: any = useState([]);
69
-
70
- const basePath = window.top == window ? '' : `/${itemPath}`;
71
-
72
- const menuRoutes =
73
- window.top == window
74
- ? routes.find((item) => item.path === '/')?.routes || []
75
- : JSON.parse(localStorage.getItem(ENUM.BROWSER_CACHE.LIMIT_MENU_DATA) || '[]');
76
-
77
- const breadcrumbNameMap = getMainCrumbNameMap(
78
- memoizeOneFormatter(menuRoutes, ''),
79
- );
80
- const matchParamsPath = (pathname: string, breadcrumbNameMap: object) => {
81
- const pathKey: any = Object.keys(breadcrumbNameMap).find((key) =>
82
- pathToRegexp ? pathToRegexp(key).test(pathname) : false
83
- );
84
- return pathKey ? breadcrumbNameMap[pathKey] : undefined;
85
- };
86
-
87
- const getPageTitle = (pathname: string) => {
88
- const currRouterData = matchParamsPath(
89
- `${basePath}${pathname}`,
90
- breadcrumbNameMap,
91
- );
92
-
93
- if (!currRouterData) {
94
- return '';
95
- }
96
-
97
- let breadcrumbArrs = currRouterData.nameMap || [];
98
- if (title && breadcrumbArrs.length) {
99
- breadcrumbArrs.pop();
100
- breadcrumbArrs.push(title)
101
- }
102
- setBreadCrumbArr([...breadcrumbArrs])
103
-
104
- const pageName = formatMessage({
105
- id: currRouterData.locale || currRouterData.name,
106
- defaultMessage: currRouterData.name,
107
- });
108
-
109
- return title ? title : window.top === window ? pageName : `${currRouterData.name}`;
110
- };
111
-
112
- const pageTitle = useMemo(() => getPageTitle(pathname), [pathname, title]);
113
-
114
- // const breadcrumbArr = `${basePath}${pathname}`
115
- // .split('/')
116
- // .slice(1)
117
- // .map((_item, index, arr) =>
118
- // matchParamsPath(
119
- // `/${arr.slice(0, index + 1).join('/')}`,
120
- // breadcrumbNameMap,
121
- // ),
122
- // )
123
- // .filter((item) => item);
124
-
125
- useEffect(() => {}, []);
126
-
127
- const ShowFullScreen = () => {
128
- if (window.top != window) {
129
- window.parent.postMessage(
130
- {
131
- type: 'screenChange',
132
- id: itemPath,
133
- },
134
- '*',
135
- );
136
- setIsFnllScreen(!isFullScreen);
137
- } else {
138
- const isFullScreen: any =
139
- document.fullScreen ||
140
- document.webkitIsFullScreen ||
141
- document.mozFullScreen;
142
- let contentEle: any = document.querySelector(`body`);
143
- // addTabsNavStyle(isFullScreen);
144
- if (contentEle && !isFullScreen) {
145
- let fullScreenEle =
146
- contentEle.requestFullscreen ||
147
- contentEle.mozRequestFullScreen ||
148
- contentEle.webkitRequestFullScreen ||
149
- contentEle.msRequestFullscreen;
150
- if (fullScreenEle) {
151
- fullScreenEle.call(contentEle);
152
- setIsFnllScreen(true);
153
- return;
154
- }
155
- }
156
- if (document && isFullScreen) {
157
- let exitFullScreen =
158
- document.exitFullscreen ||
159
- document.mozCancelFullScreen ||
160
- document.webkitCancelFullScreen ||
161
- document.msExitFullscreen;
162
- if (exitFullScreen) {
163
- exitFullScreen.call(document);
164
- setIsFnllScreen(false);
165
- return;
166
- }
167
- }
168
- }
169
- };
170
-
171
- const renderPageActionList = (actionLists: Array<actionItem>) => {
172
- const authButton = localStorage.getItem(ENUM.BROWSER_CACHE.MAIN_AUTH_CODES)
173
- ? JSON.parse(localStorage.getItem(ENUM.BROWSER_CACHE.MAIN_AUTH_CODES) as string)
174
- : [];
175
- let visibleActions = actionLists.filter(
176
- (action) =>
177
- ((action.visible && action.visible !== 'false') || judgeIsEmpty(action.visible)) &&
178
- (judgeIsEmpty(action.code) || authButton.filter(item => item === action.code)),
179
- );
180
-
181
- const renderButton = (item: actionItem, type?: any) => {
182
- return (
183
- <Button
184
- type={type || 'primary'}
185
- icon={item.icon ? iconMap[item.icon] : ''}
186
- danger={item.name === '删除' ? true : false}
187
- disabled={item.disabled}
188
- onClick={() => {
189
- if (typeof item.action === 'function') {
190
- item.action();
191
- } else {
192
- doDetailPageAction(item.action);
193
- }
194
- }}
195
- >
196
- {item.name}
197
- </Button>
198
- );
199
- };
200
-
201
- if (visibleActions.length <= 3) {
202
- return visibleActions.map((item) => {
203
- return renderButton(item);
204
- });
205
- }
206
-
207
- let moreOperate = visibleActions.splice(3);
208
- const menu = (
209
- <Menu>
210
- {moreOperate.map((item: any, index: number) => (
211
- <Menu.Item className="more-btn-action" key={index}>
212
- {renderButton(item, 'link')}
213
- </Menu.Item>
214
- ))}
215
- </Menu>
216
- );
217
- //按钮操作3个显示更多
218
- return (
219
- <div className="detail_btn_wrapper">
220
- {visibleActions.map((item: any, index: number) => {
221
- return renderButton(item);
222
- })}
223
- <Dropdown style={{ padding: '0px' }} overlay={menu}>
224
- <Button type="primary">
225
- <span style={{ margin: '0px' }}>更多</span>
226
- <img src={moreIcon} />
227
- </Button>
228
- </Dropdown>
229
- </div>
230
- );
231
- };
232
-
233
- return (
234
- <Anchor
235
- key={`${pathname}_anchor`}
236
- offsetTop={window.top == window ? 78 : 0}
237
- >
238
- <div>
239
- <div className={'detail_page_head'}>
240
- <div
241
- className={'back_home_img_content'}
242
- onClick={() => {
243
- go2BackAndClose();
244
- // history.goBack();
245
- }}
246
- >
247
- <ArrowLeftOutlined />
248
- </div>
249
- <div className={'detail_page_title_box'}>
250
- <div className={'detail_page_title'}>{pageTitle}</div>
251
- <Breadcrumb>
252
- {breadcrumbArr.map((item) => (
253
- <Breadcrumb.Item
254
- key={item}
255
- onClick={() => {
256
- // if (
257
- // item.path &&
258
- // !item.children &&
259
- // !pathToRegexp(item.path).test(`${basePath}${pathname}`)
260
- // ) {
261
- // history.push({
262
- // pathname: item.path.replace(basePath, ''),
263
- // });
264
- // }
265
- }}
266
- >
267
- <span
268
- style={{
269
- // color:
270
- // item.path &&
271
- // pathToRegexp(item.path).test(`${basePath}${pathname}`)
272
- // ? '#000000d9'
273
- // : '',
274
- }}
275
- className="bread_name"
276
- >
277
- {item}
278
- </span>
279
- </Breadcrumb.Item>
280
- ))}
281
- </Breadcrumb>
282
- </div>
283
- <div
284
- className={'detail_page_btns'}
285
- style={{ marginRight: '20px', display: 'flex', gap: '8px' }}
286
- >
287
- {renderPageActionList(actionList)}
288
- {
289
- !donotNeedShowScreenIcon ? ( <a>
290
- {isFullScreen ? (
291
- <Tooltip title="取消全屏">
292
- <img
293
- onClick={() => {
294
- ShowFullScreen();
295
- }}
296
- width={32}
297
- src={scanning}
298
- />
299
- </Tooltip>
300
- ) : (
301
- <Tooltip title="全屏">
302
- <img
303
- onClick={() => {
304
- ShowFullScreen();
305
- }}
306
- width={32}
307
- src={quanping}
308
- />
309
- </Tooltip>
310
- )}
311
- </a>) : null
312
- }
313
- </div>
314
- </div>
315
- {
316
- alertProps && (
317
- <CommonAlert
318
- {
319
- ...alertProps
320
- }
321
- />
322
- )
323
- }
324
- </div>
325
- </Anchor>
326
- );
327
- },
328
- (prevProps, nextProps) => {
329
- if (
330
- (JSON.stringify(prevProps.actionList) != JSON.stringify(nextProps.actionList)) || prevProps.title !== nextProps.title
331
- ) {
332
- return false;
333
- }
334
- return true;
335
- },
1
+ // @ts-nocheck
2
+ import {
3
+ ArrowLeftOutlined,
4
+ } from '@ant-design/icons';
5
+ import { Anchor, Tooltip, Button, Menu, Dropdown, Breadcrumb } from 'antd';
6
+ import React, { useEffect, useState, useMemo } from 'react';
7
+ import { history } from 'umi';
8
+ import { getMainCrumbNameMap, doDetailPageAction, judgeIsEmpty } from './utils';
9
+ import { memoizeOneFormatter, go2BackAndClose } from '@/utils/utils';
10
+ import './index.less';
11
+ import quanping from '../../../assets/icon-quanping.svg';
12
+ import scanning from '../../../assets/scanning.svg';
13
+ import editIcon from '../../../assets/btn-edit.svg';
14
+ import submitIcon from '../../../assets/btn-submit.svg';
15
+ import deleteIcon from '../../../assets/btn-delete.svg';
16
+ import moreIcon from '../../../assets/btn-more.svg';
17
+ import { useLocation, formatMessage } from 'umi';
18
+ import CommonAlert from '../CommonAlert';
19
+ import ENUM from '@/utils/enumConfig';
20
+
21
+ interface actionItem {
22
+ type?: string;
23
+ name: string;
24
+ icon?: string;
25
+ visible?: boolean | string;
26
+ disabled?: boolean;
27
+ code?: string; //权限过滤todo
28
+ action: object;
29
+ }
30
+
31
+ export const iconMap = {
32
+ edit: <img src={editIcon} />,
33
+ delete: <img src={deleteIcon} />,
34
+ submit: <img src={submitIcon} />,
35
+ more: <img src={moreIcon} />,
36
+ };
37
+
38
+ export default (props: any) => {
39
+ const { pathname } = useLocation();
40
+ const [id]: any = useState(pathname + 'id');
41
+ const { children, ...restProps } = props;
42
+
43
+ return (
44
+ <div id={id} className={'detail_page_wrapper'}>
45
+ <DetailWrapper
46
+ pathname={pathname}
47
+ {
48
+ ...restProps
49
+ }
50
+ />
51
+ {children}
52
+ </div>
53
+ );
54
+ };
55
+
56
+ const DetailWrapper = React.memo(
57
+ ({
58
+ pathname,
59
+ actionList=[],
60
+ routes=[],
61
+ itemPath,
62
+ alertProps,
63
+ donotNeedShowScreenIcon=false,
64
+ title,
65
+ pathToRegexp,
66
+ }: any) => {
67
+ const [isFullScreen, setIsFnllScreen]: any = useState(false);
68
+ const [breadcrumbArr, setBreadCrumbArr]: any = useState([]);
69
+
70
+ const basePath = window.top == window ? '' : `/${itemPath}`;
71
+
72
+ const menuRoutes =
73
+ window.top == window
74
+ ? routes.find((item) => item.path === '/')?.routes || []
75
+ : JSON.parse(localStorage.getItem(ENUM.BROWSER_CACHE.LIMIT_MENU_DATA) || '[]');
76
+
77
+ const breadcrumbNameMap = getMainCrumbNameMap(
78
+ memoizeOneFormatter(menuRoutes, ''),
79
+ );
80
+ const matchParamsPath = (pathname: string, breadcrumbNameMap: object) => {
81
+ const pathKey: any = Object.keys(breadcrumbNameMap).find((key) =>
82
+ pathToRegexp ? pathToRegexp(key).test(pathname) : false
83
+ );
84
+ return pathKey ? breadcrumbNameMap[pathKey] : undefined;
85
+ };
86
+
87
+ const getPageTitle = (pathname: string) => {
88
+ const currRouterData = matchParamsPath(
89
+ `${basePath}${pathname}`,
90
+ breadcrumbNameMap,
91
+ );
92
+
93
+ if (!currRouterData) {
94
+ return '';
95
+ }
96
+
97
+ let breadcrumbArrs = currRouterData.nameMap || [];
98
+ if (title && breadcrumbArrs.length) {
99
+ breadcrumbArrs.pop();
100
+ breadcrumbArrs.push(title)
101
+ }
102
+ setBreadCrumbArr([...breadcrumbArrs])
103
+
104
+ const pageName = formatMessage({
105
+ id: currRouterData.locale || currRouterData.name,
106
+ defaultMessage: currRouterData.name,
107
+ });
108
+
109
+ return title ? title : window.top === window ? pageName : `${currRouterData.name}`;
110
+ };
111
+
112
+ const pageTitle = useMemo(() => getPageTitle(pathname), [pathname, title]);
113
+
114
+ // const breadcrumbArr = `${basePath}${pathname}`
115
+ // .split('/')
116
+ // .slice(1)
117
+ // .map((_item, index, arr) =>
118
+ // matchParamsPath(
119
+ // `/${arr.slice(0, index + 1).join('/')}`,
120
+ // breadcrumbNameMap,
121
+ // ),
122
+ // )
123
+ // .filter((item) => item);
124
+
125
+ useEffect(() => {}, []);
126
+
127
+ const ShowFullScreen = () => {
128
+ if (window.top != window) {
129
+ window.parent.postMessage(
130
+ {
131
+ type: 'screenChange',
132
+ id: itemPath,
133
+ },
134
+ '*',
135
+ );
136
+ setIsFnllScreen(!isFullScreen);
137
+ } else {
138
+ const isFullScreen: any =
139
+ document.fullScreen ||
140
+ document.webkitIsFullScreen ||
141
+ document.mozFullScreen;
142
+ let contentEle: any = document.querySelector(`body`);
143
+ // addTabsNavStyle(isFullScreen);
144
+ if (contentEle && !isFullScreen) {
145
+ let fullScreenEle =
146
+ contentEle.requestFullscreen ||
147
+ contentEle.mozRequestFullScreen ||
148
+ contentEle.webkitRequestFullScreen ||
149
+ contentEle.msRequestFullscreen;
150
+ if (fullScreenEle) {
151
+ fullScreenEle.call(contentEle);
152
+ setIsFnllScreen(true);
153
+ return;
154
+ }
155
+ }
156
+ if (document && isFullScreen) {
157
+ let exitFullScreen =
158
+ document.exitFullscreen ||
159
+ document.mozCancelFullScreen ||
160
+ document.webkitCancelFullScreen ||
161
+ document.msExitFullscreen;
162
+ if (exitFullScreen) {
163
+ exitFullScreen.call(document);
164
+ setIsFnllScreen(false);
165
+ return;
166
+ }
167
+ }
168
+ }
169
+ };
170
+
171
+ const renderPageActionList = (actionLists: Array<actionItem>) => {
172
+ const authButton = localStorage.getItem(ENUM.BROWSER_CACHE.MAIN_AUTH_CODES)
173
+ ? JSON.parse(localStorage.getItem(ENUM.BROWSER_CACHE.MAIN_AUTH_CODES) as string)
174
+ : [];
175
+ let visibleActions = actionLists.filter(
176
+ (action) =>
177
+ ((action.visible && action.visible !== 'false') || judgeIsEmpty(action.visible)) &&
178
+ (judgeIsEmpty(action.code) || authButton.filter(item => item === action.code)),
179
+ );
180
+
181
+ const renderButton = (item: actionItem, type?: any) => {
182
+ return (
183
+ <Button
184
+ type={type || 'primary'}
185
+ icon={item.icon ? iconMap[item.icon] : ''}
186
+ danger={item.name === '删除' ? true : false}
187
+ disabled={item.disabled}
188
+ onClick={() => {
189
+ if (typeof item.action === 'function') {
190
+ item.action();
191
+ } else {
192
+ doDetailPageAction(item.action);
193
+ }
194
+ }}
195
+ >
196
+ {item.name}
197
+ </Button>
198
+ );
199
+ };
200
+
201
+ if (visibleActions.length <= 3) {
202
+ return visibleActions.map((item) => {
203
+ return renderButton(item);
204
+ });
205
+ }
206
+
207
+ let moreOperate = visibleActions.splice(3);
208
+ const menu = (
209
+ <Menu>
210
+ {moreOperate.map((item: any, index: number) => (
211
+ <Menu.Item className="more-btn-action" key={index}>
212
+ {renderButton(item, 'link')}
213
+ </Menu.Item>
214
+ ))}
215
+ </Menu>
216
+ );
217
+ //按钮操作3个显示更多
218
+ return (
219
+ <div className="detail_btn_wrapper">
220
+ {visibleActions.map((item: any, index: number) => {
221
+ return renderButton(item);
222
+ })}
223
+ <Dropdown style={{ padding: '0px' }} overlay={menu}>
224
+ <Button type="primary">
225
+ <span style={{ margin: '0px' }}>更多</span>
226
+ <img src={moreIcon} />
227
+ </Button>
228
+ </Dropdown>
229
+ </div>
230
+ );
231
+ };
232
+
233
+ return (
234
+ <Anchor
235
+ key={`${pathname}_anchor`}
236
+ offsetTop={window.top == window ? 78 : 0}
237
+ >
238
+ <div>
239
+ <div className={'detail_page_head'}>
240
+ <div
241
+ className={'back_home_img_content'}
242
+ onClick={() => {
243
+ go2BackAndClose();
244
+ // history.goBack();
245
+ }}
246
+ >
247
+ <ArrowLeftOutlined />
248
+ </div>
249
+ <div className={'detail_page_title_box'}>
250
+ <div className={'detail_page_title'}>{pageTitle}</div>
251
+ <Breadcrumb>
252
+ {breadcrumbArr.map((item) => (
253
+ <Breadcrumb.Item
254
+ key={item}
255
+ onClick={() => {
256
+ // if (
257
+ // item.path &&
258
+ // !item.children &&
259
+ // !pathToRegexp(item.path).test(`${basePath}${pathname}`)
260
+ // ) {
261
+ // history.push({
262
+ // pathname: item.path.replace(basePath, ''),
263
+ // });
264
+ // }
265
+ }}
266
+ >
267
+ <span
268
+ style={{
269
+ // color:
270
+ // item.path &&
271
+ // pathToRegexp(item.path).test(`${basePath}${pathname}`)
272
+ // ? '#000000d9'
273
+ // : '',
274
+ }}
275
+ className="bread_name"
276
+ >
277
+ {item}
278
+ </span>
279
+ </Breadcrumb.Item>
280
+ ))}
281
+ </Breadcrumb>
282
+ </div>
283
+ <div
284
+ className={'detail_page_btns'}
285
+ style={{ marginRight: '20px', display: 'flex', gap: '8px' }}
286
+ >
287
+ {renderPageActionList(actionList)}
288
+ {
289
+ !donotNeedShowScreenIcon ? ( <a>
290
+ {isFullScreen ? (
291
+ <Tooltip title="取消全屏">
292
+ <img
293
+ onClick={() => {
294
+ ShowFullScreen();
295
+ }}
296
+ width={32}
297
+ src={scanning}
298
+ />
299
+ </Tooltip>
300
+ ) : (
301
+ <Tooltip title="全屏">
302
+ <img
303
+ onClick={() => {
304
+ ShowFullScreen();
305
+ }}
306
+ width={32}
307
+ src={quanping}
308
+ />
309
+ </Tooltip>
310
+ )}
311
+ </a>) : null
312
+ }
313
+ </div>
314
+ </div>
315
+ {
316
+ alertProps && (
317
+ <CommonAlert
318
+ {
319
+ ...alertProps
320
+ }
321
+ />
322
+ )
323
+ }
324
+ </div>
325
+ </Anchor>
326
+ );
327
+ },
328
+ (prevProps, nextProps) => {
329
+ if (
330
+ (JSON.stringify(prevProps.actionList) != JSON.stringify(nextProps.actionList)) || prevProps.title !== nextProps.title
331
+ ) {
332
+ return false;
333
+ }
334
+ return true;
335
+ },
336
336
  );