@bit-sun/business-component 2.0.30 → 2.0.32
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.
- package/.editorconfig +16 -16
- package/.fatherrc.ts +4 -4
- package/.gitlab-ci.yml +174 -174
- package/.prettierignore +7 -7
- package/.prettierrc +11 -11
- package/.umirc.ts +74 -74
- package/README.md +27 -27
- package/dist/components/Business/BsSulaQueryTable/index.d.ts +2 -0
- package/dist/components/Business/BsSulaQueryTable/setting.d.ts +59 -0
- package/dist/components/Business/BsSulaQueryTable/utils.d.ts +98 -0
- package/dist/components/Business/CommonAlert/index.d.ts +3 -0
- package/dist/components/Business/DetailPageWrapper/index.d.ts +9 -0
- package/dist/components/Business/DetailPageWrapper/utils.d.ts +9 -0
- package/dist/components/Business/HomePageWrapper/index.d.ts +3 -0
- package/dist/components/Business/columnSettingTable/index.d.ts +1 -0
- package/dist/components/Business/columnSettingTable/sulaSettingTable.d.ts +1 -0
- package/dist/index.esm.js +7600 -5489
- package/dist/index.js +7597 -5486
- package/docs/index.md +21 -21
- package/lib/assets/drag.svg +17 -17
- package/lib/assets/exportFail.svg +37 -37
- package/lib/assets/exportProcessing.svg +28 -28
- package/lib/assets/exportSuccess.svg +34 -34
- package/lib/assets/label_icon_bottom.svg +25 -25
- package/lib/assets/upExport.svg +22 -22
- package/package.json +69 -63
- package/src/assets/btn-delete.svg +30 -0
- package/src/assets/btn-edit.svg +20 -0
- package/src/assets/btn-more.svg +18 -0
- package/src/assets/btn-submit.svg +20 -0
- package/src/assets/close.svg +26 -26
- package/src/assets/drag.svg +17 -17
- package/src/assets/exportFail.svg +37 -37
- package/src/assets/exportProcessing.svg +28 -28
- package/src/assets/exportSuccess.svg +34 -34
- package/src/assets/fixed-left-active.svg +12 -0
- package/src/assets/fixed-left.svg +16 -0
- package/src/assets/fixed-right-active.svg +12 -0
- package/src/assets/fixed-right.svg +16 -0
- package/src/assets/icon-quanping.svg +16 -0
- package/src/assets/icon-shezhi.svg +17 -17
- package/src/assets/label_icon_bottom.svg +25 -25
- package/src/assets/scanning.svg +25 -0
- package/src/assets/upExport.svg +22 -22
- package/src/components/Business/AddSelectBusiness/index.md +41 -41
- package/src/components/Business/AddSelectBusiness/index.tsx +290 -290
- package/src/components/Business/BsSulaQueryTable/index.less +220 -0
- package/src/components/Business/BsSulaQueryTable/index.tsx +534 -0
- package/src/components/Business/BsSulaQueryTable/setting.tsx +817 -0
- package/src/components/Business/BsSulaQueryTable/utils.less +65 -0
- package/src/components/Business/BsSulaQueryTable/utils.tsx +690 -0
- package/src/components/Business/CommodityEntry/index.md +70 -70
- package/src/components/Business/CommodityEntry/index.tsx +80 -80
- package/src/components/Business/CommonAlert/index.less +0 -0
- package/src/components/Business/CommonAlert/index.tsx +23 -0
- package/src/components/Business/CommonGuideWrapper/index.less +111 -111
- package/src/components/Business/CommonGuideWrapper/index.md +39 -39
- package/src/components/Business/CommonGuideWrapper/index.tsx +83 -83
- package/src/components/Business/DetailPageWrapper/index.less +80 -0
- package/src/components/Business/DetailPageWrapper/index.tsx +325 -0
- package/src/components/Business/DetailPageWrapper/utils.tsx +111 -0
- package/src/components/Business/HomePageWrapper/index.less +33 -0
- package/src/components/Business/HomePageWrapper/index.md +45 -0
- package/src/components/Business/HomePageWrapper/index.tsx +150 -0
- package/src/components/Business/SearchSelect/BusinessUtils.ts +1448 -1448
- package/src/components/Business/SearchSelect/common.ts +53 -53
- package/src/components/Business/SearchSelect/index.md +1137 -1137
- package/src/components/Business/SearchSelect/index.tsx +51 -51
- package/src/components/Business/SearchSelect/utils.ts +99 -99
- package/src/components/Business/StateFlow/index.less +130 -130
- package/src/components/Business/StateFlow/index.md +60 -60
- package/src/components/Business/StateFlow/index.tsx +29 -29
- package/src/components/Business/TreeSearchSelect/index.md +126 -126
- package/src/components/Business/TreeSearchSelect/index.tsx +34 -34
- package/src/components/Business/TreeSearchSelect/utils.ts +60 -60
- package/src/components/Business/columnSettingTable/columnSetting.tsx +762 -594
- package/src/components/Business/columnSettingTable/index.less +247 -247
- package/src/components/Business/columnSettingTable/index.md +357 -357
- package/src/components/Business/columnSettingTable/index.tsx +225 -216
- package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +233 -224
- package/src/components/Business/columnSettingTable/utils.tsx +68 -68
- package/src/components/Functional/AddSelect/index.less +367 -367
- package/src/components/Functional/AddSelect/index.md +122 -122
- package/src/components/Functional/AddSelect/index.tsx +962 -952
- package/src/components/Functional/BillEntry/index.less +371 -371
- package/src/components/Functional/BillEntry/index.md +37 -37
- package/src/components/Functional/BillEntry/index.tsx +547 -547
- package/src/components/Functional/DataImport/index.less +63 -63
- package/src/components/Functional/DataImport/index.md +44 -44
- package/src/components/Functional/DataImport/index.tsx +689 -689
- package/src/components/Functional/DataValidation/index.less +63 -63
- package/src/components/Functional/DataValidation/index.md +38 -38
- package/src/components/Functional/DataValidation/index.tsx +681 -681
- package/src/components/Functional/ExportFunctions/ExportIcon/index.md +37 -37
- package/src/components/Functional/ExportFunctions/ExportIcon/index.tsx +59 -59
- package/src/components/Functional/QueryMutipleInput/index.less +37 -37
- package/src/components/Functional/QueryMutipleInput/index.md +33 -33
- package/src/components/Functional/QueryMutipleInput/index.tsx +128 -128
- package/src/components/Functional/SearchSelect/index.less +115 -115
- package/src/components/Functional/SearchSelect/index.md +141 -141
- package/src/components/Functional/SearchSelect/index.tsx +812 -812
- package/src/components/Functional/TreeSearchSelect/index.md +47 -47
- package/src/components/Functional/TreeSearchSelect/index.tsx +149 -149
- package/src/index.ts +30 -27
- package/src/utils/CheckOneUser/index.md +39 -39
- package/src/utils/CheckOneUser/index.ts +51 -51
- package/src/utils/requestUtils.ts +32 -32
- package/src/utils/utils.ts +22 -22
- package/tsconfig.json +29 -29
- package/typings.d.ts +4 -4
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
import React, { Component } from "react";
|
|
2
|
-
import dragImg from '../../../assets/drag.svg';
|
|
3
|
-
import label_icon_bottom from '../../../assets/label_icon_bottom.svg';
|
|
4
|
-
import arrow_top from '../../../assets/arrow_top.png';
|
|
5
|
-
import './index.less';
|
|
6
|
-
|
|
7
|
-
const Field = ({ children, ...props }: any) => {
|
|
8
|
-
const [fieldGroupVisible, setVisible] = React.useState(true);
|
|
9
|
-
return (
|
|
10
|
-
<div
|
|
11
|
-
className={
|
|
12
|
-
`bitsun-form-card-class
|
|
13
|
-
${fieldGroupVisible ? '' : 'field-group-hidden'}
|
|
14
|
-
${props.isWhiteCard ? 'white-card' : ''}
|
|
15
|
-
`
|
|
16
|
-
}
|
|
17
|
-
id={props.id}
|
|
18
|
-
>
|
|
19
|
-
<div className="ant-card-head">
|
|
20
|
-
<div className="ant-card-head-title">
|
|
21
|
-
<span className='title-left-line'></span>
|
|
22
|
-
<span style={{ marginRight: '5px' }}>
|
|
23
|
-
{props?.title}
|
|
24
|
-
</span>
|
|
25
|
-
<img
|
|
26
|
-
width={24}
|
|
27
|
-
style={{
|
|
28
|
-
transform: fieldGroupVisible ? 'inherit' : 'rotate(180deg)',
|
|
29
|
-
cursor: 'pointer'
|
|
30
|
-
}}
|
|
31
|
-
src={arrow_top}
|
|
32
|
-
onClick={(e) => {
|
|
33
|
-
e.stopPropagation();
|
|
34
|
-
setVisible(!fieldGroupVisible);
|
|
35
|
-
}}
|
|
36
|
-
/>
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
<div className="ant-card-body">
|
|
40
|
-
{children}
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export default class GuideWrapper extends Component {
|
|
47
|
-
static Field = Field;
|
|
48
|
-
render() {
|
|
49
|
-
const { children = [], ...props }: any = this.props;
|
|
50
|
-
let cardGroups = children.filter((item:any) => item?.props?.id && item?.props?.title);
|
|
51
|
-
return (
|
|
52
|
-
<div {...props}>
|
|
53
|
-
{children}
|
|
54
|
-
<div
|
|
55
|
-
className='form-guide'
|
|
56
|
-
>
|
|
57
|
-
<div className='form-guide-top'>
|
|
58
|
-
<img width={24} src={dragImg} />
|
|
59
|
-
</div>
|
|
60
|
-
<div className='form-guide-center'>
|
|
61
|
-
{
|
|
62
|
-
cardGroups.map((item:any) => {
|
|
63
|
-
return (
|
|
64
|
-
<span
|
|
65
|
-
className='form-guide-item'
|
|
66
|
-
onClick={() => {
|
|
67
|
-
let currentDom = document.getElementById(item.props.id);
|
|
68
|
-
currentDom && currentDom.scrollIntoView({ block: 'center', behavior: 'smooth' });
|
|
69
|
-
}}
|
|
70
|
-
>
|
|
71
|
-
{item.props.title}
|
|
72
|
-
</span>
|
|
73
|
-
)
|
|
74
|
-
})
|
|
75
|
-
}
|
|
76
|
-
</div>
|
|
77
|
-
<div className='form-guide-bottom'>
|
|
78
|
-
<img width={24} src={label_icon_bottom} />
|
|
79
|
-
</div>
|
|
80
|
-
</div>
|
|
81
|
-
</div>
|
|
82
|
-
)
|
|
83
|
-
}
|
|
1
|
+
import React, { Component } from "react";
|
|
2
|
+
import dragImg from '../../../assets/drag.svg';
|
|
3
|
+
import label_icon_bottom from '../../../assets/label_icon_bottom.svg';
|
|
4
|
+
import arrow_top from '../../../assets/arrow_top.png';
|
|
5
|
+
import './index.less';
|
|
6
|
+
|
|
7
|
+
const Field = ({ children, ...props }: any) => {
|
|
8
|
+
const [fieldGroupVisible, setVisible] = React.useState(true);
|
|
9
|
+
return (
|
|
10
|
+
<div
|
|
11
|
+
className={
|
|
12
|
+
`bitsun-form-card-class
|
|
13
|
+
${fieldGroupVisible ? '' : 'field-group-hidden'}
|
|
14
|
+
${props.isWhiteCard ? 'white-card' : ''}
|
|
15
|
+
`
|
|
16
|
+
}
|
|
17
|
+
id={props.id}
|
|
18
|
+
>
|
|
19
|
+
<div className="ant-card-head">
|
|
20
|
+
<div className="ant-card-head-title">
|
|
21
|
+
<span className='title-left-line'></span>
|
|
22
|
+
<span style={{ marginRight: '5px' }}>
|
|
23
|
+
{props?.title}
|
|
24
|
+
</span>
|
|
25
|
+
<img
|
|
26
|
+
width={24}
|
|
27
|
+
style={{
|
|
28
|
+
transform: fieldGroupVisible ? 'inherit' : 'rotate(180deg)',
|
|
29
|
+
cursor: 'pointer'
|
|
30
|
+
}}
|
|
31
|
+
src={arrow_top}
|
|
32
|
+
onClick={(e) => {
|
|
33
|
+
e.stopPropagation();
|
|
34
|
+
setVisible(!fieldGroupVisible);
|
|
35
|
+
}}
|
|
36
|
+
/>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
<div className="ant-card-body">
|
|
40
|
+
{children}
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default class GuideWrapper extends Component {
|
|
47
|
+
static Field = Field;
|
|
48
|
+
render() {
|
|
49
|
+
const { children = [], ...props }: any = this.props;
|
|
50
|
+
let cardGroups = children.filter((item:any) => item?.props?.id && item?.props?.title);
|
|
51
|
+
return (
|
|
52
|
+
<div {...props}>
|
|
53
|
+
{children}
|
|
54
|
+
<div
|
|
55
|
+
className='form-guide'
|
|
56
|
+
>
|
|
57
|
+
<div className='form-guide-top'>
|
|
58
|
+
<img width={24} src={dragImg} />
|
|
59
|
+
</div>
|
|
60
|
+
<div className='form-guide-center'>
|
|
61
|
+
{
|
|
62
|
+
cardGroups.map((item:any) => {
|
|
63
|
+
return (
|
|
64
|
+
<span
|
|
65
|
+
className='form-guide-item'
|
|
66
|
+
onClick={() => {
|
|
67
|
+
let currentDom = document.getElementById(item.props.id);
|
|
68
|
+
currentDom && currentDom.scrollIntoView({ block: 'center', behavior: 'smooth' });
|
|
69
|
+
}}
|
|
70
|
+
>
|
|
71
|
+
{item.props.title}
|
|
72
|
+
</span>
|
|
73
|
+
)
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
</div>
|
|
77
|
+
<div className='form-guide-bottom'>
|
|
78
|
+
<img width={24} src={label_icon_bottom} />
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
84
|
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
.detail_page_head {
|
|
2
|
+
height: 54px;
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
background-color: #FFFFFF;
|
|
6
|
+
border-bottom: 1px solid #f0f0f0;
|
|
7
|
+
.ant-breadcrumb {
|
|
8
|
+
display: block !important;
|
|
9
|
+
.ant-breadcrumb-separator {
|
|
10
|
+
margin: 0 2px;
|
|
11
|
+
}
|
|
12
|
+
li .bread_name {
|
|
13
|
+
color: #8A8F8D;
|
|
14
|
+
font-size: 12px;
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
}
|
|
17
|
+
li .bread_name:hover {
|
|
18
|
+
color: #000000d9;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
.detail_page_wrapper {
|
|
23
|
+
// padding-top: 51px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.back_home_img_content {
|
|
27
|
+
display: inline-block;
|
|
28
|
+
height: 28px;
|
|
29
|
+
width: 28px;
|
|
30
|
+
border: 1px solid #BABABA;
|
|
31
|
+
margin: 0 12px 0 20px;
|
|
32
|
+
border-radius: 14px;
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
.anticon-arrow-left {
|
|
38
|
+
color: #BABABA;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.back_home_img_content:hover {
|
|
43
|
+
background-color: #005CFF;
|
|
44
|
+
border: 1px solid #005CFF;
|
|
45
|
+
.anticon-arrow-left {
|
|
46
|
+
color: #FFFFFF;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.detail_page_title_box {
|
|
51
|
+
flex-grow: 1;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.detail_page_title {
|
|
55
|
+
height: 20px;
|
|
56
|
+
font-family: PingFangSC;
|
|
57
|
+
font-weight: 600;
|
|
58
|
+
font-size: 16px;
|
|
59
|
+
margin-top: 2px;
|
|
60
|
+
color: #000000;
|
|
61
|
+
letter-spacing: 0;
|
|
62
|
+
line-height: 20px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.detail_page_btns {
|
|
66
|
+
display: flex;
|
|
67
|
+
gap: 8px;
|
|
68
|
+
margin-right: 20px;
|
|
69
|
+
button {
|
|
70
|
+
height: 32px !important;
|
|
71
|
+
display: flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
gap: 2px;
|
|
74
|
+
border-radius: 3px;
|
|
75
|
+
padding: 0 10px;
|
|
76
|
+
}
|
|
77
|
+
.ant-btn-dangerous {
|
|
78
|
+
background-color: #EC5246 !important;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,325 @@
|
|
|
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 { memoizeOneFormatter, getBreadcrumbNameMap, doDetailPageAction, judgeIsEmpty } from './utils';
|
|
9
|
+
import pathToRegexp from 'path-to-regexp';
|
|
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
|
+
|
|
20
|
+
interface actionItem {
|
|
21
|
+
type?: string;
|
|
22
|
+
name: string;
|
|
23
|
+
icon?: string;
|
|
24
|
+
visible?: boolean | string;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
code?: string; //权限过滤todo
|
|
27
|
+
action: object;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const iconMap = {
|
|
31
|
+
edit: <img src={editIcon} />,
|
|
32
|
+
delete: <img src={deleteIcon} />,
|
|
33
|
+
submit: <img src={submitIcon} />,
|
|
34
|
+
more: <img src={moreIcon} />,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default (props: any) => {
|
|
38
|
+
const { pathname } = useLocation();
|
|
39
|
+
const [id]: any = useState(pathname + 'id');
|
|
40
|
+
const { children, ...restProps } = props;
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div id={id} className={'detail_page_wrapper'}>
|
|
44
|
+
<DetailWrapper
|
|
45
|
+
pathname={pathname}
|
|
46
|
+
{
|
|
47
|
+
...restProps
|
|
48
|
+
}
|
|
49
|
+
/>
|
|
50
|
+
{children}
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const DetailWrapper = React.memo(
|
|
56
|
+
({
|
|
57
|
+
pathname,
|
|
58
|
+
actionList,
|
|
59
|
+
routes=[],
|
|
60
|
+
itemPath,
|
|
61
|
+
alertProps,
|
|
62
|
+
donotNeedShowScreenIcon=false,
|
|
63
|
+
}: any) => {
|
|
64
|
+
const [isFullScreen, setIsFnllScreen]: any = useState(false);
|
|
65
|
+
|
|
66
|
+
const basePath = window.top == window ? '' : `/${itemPath}`;
|
|
67
|
+
|
|
68
|
+
const menuRoutes =
|
|
69
|
+
window.top == window
|
|
70
|
+
? routes.find((item) => item.path === '/')?.routes || []
|
|
71
|
+
: JSON.parse(localStorage.getItem('limitedMenuData') || '[]');
|
|
72
|
+
|
|
73
|
+
const breadcrumbNameMap = getBreadcrumbNameMap(
|
|
74
|
+
memoizeOneFormatter(menuRoutes, ''),
|
|
75
|
+
);
|
|
76
|
+
const matchParamsPath = (pathname: string, breadcrumbNameMap: object) => {
|
|
77
|
+
const pathKey: any = Object.keys(breadcrumbNameMap).find((key) =>
|
|
78
|
+
pathToRegexp(key).test(pathname),
|
|
79
|
+
);
|
|
80
|
+
return breadcrumbNameMap[pathKey];
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const getPageTitle = (pathname: string) => {
|
|
84
|
+
const currRouterData = matchParamsPath(
|
|
85
|
+
`${basePath}${pathname}`,
|
|
86
|
+
breadcrumbNameMap,
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
if (!currRouterData) {
|
|
90
|
+
return '';
|
|
91
|
+
}
|
|
92
|
+
const pageName = formatMessage({
|
|
93
|
+
id: currRouterData.locale || currRouterData.name,
|
|
94
|
+
defaultMessage: currRouterData.name,
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
return `${pageName}`;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const pageTitle = useMemo(() => getPageTitle(pathname), [pathname]);
|
|
101
|
+
|
|
102
|
+
const breadcrumbArr = `${basePath}${pathname}`
|
|
103
|
+
.split('/')
|
|
104
|
+
.slice(1)
|
|
105
|
+
.map((_item, index, arr) =>
|
|
106
|
+
matchParamsPath(
|
|
107
|
+
`/${arr.slice(0, index + 1).join('/')}`,
|
|
108
|
+
breadcrumbNameMap,
|
|
109
|
+
),
|
|
110
|
+
)
|
|
111
|
+
.filter((item) => item);
|
|
112
|
+
|
|
113
|
+
useEffect(() => {}, []);
|
|
114
|
+
|
|
115
|
+
const ShowFullScreen = () => {
|
|
116
|
+
if (window.top != window) {
|
|
117
|
+
window.parent.postMessage(
|
|
118
|
+
{
|
|
119
|
+
type: 'screenChange',
|
|
120
|
+
id: itemPath,
|
|
121
|
+
},
|
|
122
|
+
'*',
|
|
123
|
+
);
|
|
124
|
+
setIsFnllScreen(!isFullScreen);
|
|
125
|
+
} else {
|
|
126
|
+
const isFullScreen: any =
|
|
127
|
+
document.fullScreen ||
|
|
128
|
+
document.webkitIsFullScreen ||
|
|
129
|
+
document.mozFullScreen;
|
|
130
|
+
let contentEle: any = document.querySelector(`body`);
|
|
131
|
+
// addTabsNavStyle(isFullScreen);
|
|
132
|
+
if (contentEle && !isFullScreen) {
|
|
133
|
+
let fullScreenEle =
|
|
134
|
+
contentEle.requestFullscreen ||
|
|
135
|
+
contentEle.mozRequestFullScreen ||
|
|
136
|
+
contentEle.webkitRequestFullScreen ||
|
|
137
|
+
contentEle.msRequestFullscreen;
|
|
138
|
+
if (fullScreenEle) {
|
|
139
|
+
fullScreenEle.call(contentEle);
|
|
140
|
+
setIsFnllScreen(true);
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (document && isFullScreen) {
|
|
145
|
+
let exitFullScreen =
|
|
146
|
+
document.exitFullscreen ||
|
|
147
|
+
document.mozCancelFullScreen ||
|
|
148
|
+
document.webkitCancelFullScreen ||
|
|
149
|
+
document.msExitFullscreen;
|
|
150
|
+
if (exitFullScreen) {
|
|
151
|
+
exitFullScreen.call(document);
|
|
152
|
+
setIsFnllScreen(false);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const renderPageActionList = (actionLists: Array<actionItem>) => {
|
|
160
|
+
const authButton = localStorage.getItem('menuAuth_mainProject')
|
|
161
|
+
? JSON.parse(localStorage.getItem('menuAuth_mainProject') as string)
|
|
162
|
+
: [];
|
|
163
|
+
let visibleActions = actionLists.filter(
|
|
164
|
+
(action) =>
|
|
165
|
+
((action.visible && action.visible !== 'false') || judgeIsEmpty(action.visible)) &&
|
|
166
|
+
(judgeIsEmpty(action.code) || authButton.filter(item => item === action.code)),
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
const renderButton = (item: actionItem, type?: any) => {
|
|
170
|
+
return (
|
|
171
|
+
<Button
|
|
172
|
+
type={type || 'primary'}
|
|
173
|
+
icon={item.icon ? iconMap[item.icon] : ''}
|
|
174
|
+
danger={item.name === '删除' ? true : false}
|
|
175
|
+
disabled={item.disabled}
|
|
176
|
+
onClick={() => {
|
|
177
|
+
if (typeof item.action === 'function') {
|
|
178
|
+
item.action();
|
|
179
|
+
} else {
|
|
180
|
+
doDetailPageAction(item.action);
|
|
181
|
+
}
|
|
182
|
+
}}
|
|
183
|
+
>
|
|
184
|
+
{item.name}
|
|
185
|
+
</Button>
|
|
186
|
+
);
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
if (visibleActions.length <= 3) {
|
|
190
|
+
return visibleActions.map((item) => {
|
|
191
|
+
return renderButton(item);
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
let moreOperate = visibleActions.splice(3);
|
|
196
|
+
const menu = (
|
|
197
|
+
<Menu>
|
|
198
|
+
{moreOperate.map((item: any, index: number) => (
|
|
199
|
+
<Menu.Item className="more-btn-action" key={index}>
|
|
200
|
+
{renderButton(item, 'link')}
|
|
201
|
+
</Menu.Item>
|
|
202
|
+
))}
|
|
203
|
+
</Menu>
|
|
204
|
+
);
|
|
205
|
+
//按钮操作3个显示更多
|
|
206
|
+
return (
|
|
207
|
+
<div className="detail_btn_wrapper">
|
|
208
|
+
{visibleActions.map((item: any, index: number) => {
|
|
209
|
+
return renderButton(item);
|
|
210
|
+
})}
|
|
211
|
+
<Dropdown style={{ padding: '0px' }} overlay={menu}>
|
|
212
|
+
<Button type="primary">
|
|
213
|
+
<span style={{ margin: '0px' }}>更多</span>
|
|
214
|
+
<img src={moreIcon} />
|
|
215
|
+
</Button>
|
|
216
|
+
</Dropdown>
|
|
217
|
+
</div>
|
|
218
|
+
);
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
console.log('detailActions', actionList);
|
|
222
|
+
return (
|
|
223
|
+
<Anchor
|
|
224
|
+
key={`${pathname}_anchor`}
|
|
225
|
+
offsetTop={window.top == window ? 78 : 0}
|
|
226
|
+
>
|
|
227
|
+
<div>
|
|
228
|
+
<div className={'detail_page_head'}>
|
|
229
|
+
<div
|
|
230
|
+
className={'back_home_img_content'}
|
|
231
|
+
onClick={() => {
|
|
232
|
+
history.goBack();
|
|
233
|
+
}}
|
|
234
|
+
>
|
|
235
|
+
<ArrowLeftOutlined />
|
|
236
|
+
</div>
|
|
237
|
+
<div className={'detail_page_title_box'}>
|
|
238
|
+
<div className={'detail_page_title'}>{pageTitle}</div>
|
|
239
|
+
<Breadcrumb>
|
|
240
|
+
{breadcrumbArr.map((item) => (
|
|
241
|
+
<Breadcrumb.Item
|
|
242
|
+
key={item.path}
|
|
243
|
+
onClick={() => {
|
|
244
|
+
if (
|
|
245
|
+
item.path &&
|
|
246
|
+
!item.children &&
|
|
247
|
+
!pathToRegexp(item.path).test(`${basePath}${pathname}`)
|
|
248
|
+
) {
|
|
249
|
+
history.push({
|
|
250
|
+
pathname: item.path.replace(basePath, ''),
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
}}
|
|
254
|
+
>
|
|
255
|
+
<span
|
|
256
|
+
style={{
|
|
257
|
+
color:
|
|
258
|
+
item.path &&
|
|
259
|
+
pathToRegexp(item.path).test(`${basePath}${pathname}`)
|
|
260
|
+
? '#000000d9'
|
|
261
|
+
: '',
|
|
262
|
+
}}
|
|
263
|
+
className="bread_name"
|
|
264
|
+
>
|
|
265
|
+
{item.name}
|
|
266
|
+
</span>
|
|
267
|
+
</Breadcrumb.Item>
|
|
268
|
+
))}
|
|
269
|
+
</Breadcrumb>
|
|
270
|
+
</div>
|
|
271
|
+
<div
|
|
272
|
+
className={'detail_page_btns'}
|
|
273
|
+
style={{ marginRight: '20px', display: 'flex', gap: '8px' }}
|
|
274
|
+
>
|
|
275
|
+
{renderPageActionList(actionList)}
|
|
276
|
+
{
|
|
277
|
+
!donotNeedShowScreenIcon ? ( <a>
|
|
278
|
+
{isFullScreen ? (
|
|
279
|
+
<Tooltip title="取消全屏">
|
|
280
|
+
<img
|
|
281
|
+
onClick={() => {
|
|
282
|
+
ShowFullScreen();
|
|
283
|
+
}}
|
|
284
|
+
width={32}
|
|
285
|
+
src={scanning}
|
|
286
|
+
/>
|
|
287
|
+
</Tooltip>
|
|
288
|
+
) : (
|
|
289
|
+
<Tooltip title="全屏">
|
|
290
|
+
<img
|
|
291
|
+
onClick={() => {
|
|
292
|
+
ShowFullScreen();
|
|
293
|
+
}}
|
|
294
|
+
width={32}
|
|
295
|
+
src={quanping}
|
|
296
|
+
/>
|
|
297
|
+
</Tooltip>
|
|
298
|
+
)}
|
|
299
|
+
</a>) : null
|
|
300
|
+
}
|
|
301
|
+
</div>
|
|
302
|
+
</div>
|
|
303
|
+
{
|
|
304
|
+
alertProps && (
|
|
305
|
+
<CommonAlert
|
|
306
|
+
{
|
|
307
|
+
...alertProps
|
|
308
|
+
}
|
|
309
|
+
/>
|
|
310
|
+
)
|
|
311
|
+
}
|
|
312
|
+
</div>
|
|
313
|
+
</Anchor>
|
|
314
|
+
);
|
|
315
|
+
},
|
|
316
|
+
(prevProps, nextProps) => {
|
|
317
|
+
if (
|
|
318
|
+
JSON.stringify(prevProps.actionList) !=
|
|
319
|
+
JSON.stringify(nextProps.actionList)
|
|
320
|
+
) {
|
|
321
|
+
return false;
|
|
322
|
+
}
|
|
323
|
+
return true;
|
|
324
|
+
},
|
|
325
|
+
);
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { request } from 'bssula';
|
|
3
|
+
import { Modal } from 'antd';
|
|
4
|
+
import { ExclamationCircleOutlined } from '@ant-design/icons';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { formatMessage, history } from 'umi';
|
|
7
|
+
import isEqual from 'lodash/isEqual';
|
|
8
|
+
import memoizeOne from 'memoize-one';
|
|
9
|
+
|
|
10
|
+
interface actionItem {
|
|
11
|
+
[propName: string]: any;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const doDetailPageAction = (config: actionItem) => {
|
|
15
|
+
if (config?.type == 'modal') {
|
|
16
|
+
const { confirm } = Modal;
|
|
17
|
+
let requestConfig = {
|
|
18
|
+
url: config.url,
|
|
19
|
+
method: config.method,
|
|
20
|
+
params: config.params || {},
|
|
21
|
+
successMessage: config?.successMessage,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
const onOk = () => {
|
|
26
|
+
request(requestConfig).then((res) => {
|
|
27
|
+
if (config.backPath) {
|
|
28
|
+
history.push({
|
|
29
|
+
pathname: config.backPath
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
// 是否执行成功之后的回调
|
|
33
|
+
if (typeof (config.successCb) === 'function') {
|
|
34
|
+
config.successCb();
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
if (config.noConfirm) {
|
|
40
|
+
onOk();
|
|
41
|
+
} else {
|
|
42
|
+
confirm({
|
|
43
|
+
title: config.title,
|
|
44
|
+
icon: <ExclamationCircleOutlined />,
|
|
45
|
+
content: config.content,
|
|
46
|
+
okText: '确定',
|
|
47
|
+
okType: 'danger',
|
|
48
|
+
cancelText: '取消',
|
|
49
|
+
onOk,
|
|
50
|
+
onCancel() {
|
|
51
|
+
console.log('Cancel');
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const formatter = (data, parentAuthority, parentName) => {
|
|
59
|
+
return data
|
|
60
|
+
.map((item) => {
|
|
61
|
+
if (!item.name || !item.path) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
let locale = 'menu';
|
|
66
|
+
if (parentName) {
|
|
67
|
+
locale = `${parentName}.${item.name}`;
|
|
68
|
+
} else {
|
|
69
|
+
locale = `menu.${item.name}`;
|
|
70
|
+
}
|
|
71
|
+
const result = {
|
|
72
|
+
...item,
|
|
73
|
+
name: formatMessage && formatMessage({ id: locale, defaultMessage: item.name }) || item.name,
|
|
74
|
+
locale,
|
|
75
|
+
authority: item.authority || parentAuthority,
|
|
76
|
+
};
|
|
77
|
+
if (item.routes) {
|
|
78
|
+
const children = formatter(item.routes, item.authority, locale);
|
|
79
|
+
// Reduce memory usage
|
|
80
|
+
result.children = children;
|
|
81
|
+
}
|
|
82
|
+
delete result.routes;
|
|
83
|
+
return result;
|
|
84
|
+
})
|
|
85
|
+
.filter((item) => item);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const memoizeOneFormatter = memoizeOne(formatter, isEqual);
|
|
89
|
+
|
|
90
|
+
export const getBreadcrumbNameMap = (menuData) => {
|
|
91
|
+
const routerMap = {};
|
|
92
|
+
|
|
93
|
+
const flattenMenuData = (data) => {
|
|
94
|
+
data.forEach((menuItem) => {
|
|
95
|
+
if (menuItem.children) {
|
|
96
|
+
flattenMenuData(menuItem.children);
|
|
97
|
+
}
|
|
98
|
+
// Reduce memory usage
|
|
99
|
+
routerMap[menuItem.path] = menuItem;
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
flattenMenuData(menuData);
|
|
103
|
+
return routerMap;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export const judgeIsEmpty = (value: any) => {
|
|
107
|
+
if (value == null || value == undefined || String(value).trim() == '') {
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
return false;
|
|
111
|
+
};
|