@jiangood/open-admin 1.3.4 → 2.0.1
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/config/config.js +3 -8
- package/package.json +5 -9
- package/src/.umi-production/appData.json +325 -365
- package/src/.umi-production/core/helmet.ts +1 -1
- package/src/.umi-production/core/history.ts +1 -1
- package/src/.umi-production/core/historyIntelli.ts +1 -1
- package/src/.umi-production/core/pluginConfig.ts +1 -1
- package/src/.umi-production/core/polyfill.ts +216 -216
- package/src/.umi-production/core/route.tsx +2 -4
- package/src/.umi-production/exports.ts +3 -3
- package/src/.umi-production/testBrowser.tsx +1 -1
- package/src/.umi-production/tsconfig.json +1 -1
- package/src/.umi-production/umi.ts +2 -2
- package/src/framework/components/ErrorBoundary/index.tsx +86 -0
- package/src/framework/components/Gap/index.tsx +42 -0
- package/src/framework/components/NamedIcon/index.d.ts +6 -4
- package/src/framework/components/NamedIcon/index.jsx +9 -6
- package/src/framework/components/OrgTree/{index.jsx → index.tsx} +10 -19
- package/src/framework/components/PageLoading/{index.jsx → index.tsx} +2 -5
- package/src/framework/components/ProModal/index.tsx +1 -1
- package/src/framework/components/ProTable/components/ToolBar/{index.jsx → index.tsx} +3 -3
- package/src/framework/components/ProTable/index.less +1 -1
- package/src/framework/components/ProTable/{index.jsx → index.tsx} +9 -7
- package/src/framework/components/ProTable/utils/index.ts +62 -0
- package/src/framework/components/RoleTree/{index.jsx → index.tsx} +7 -17
- package/src/framework/components/ValueType/{index.jsx → index.tsx} +2 -1
- package/src/framework/components/ViewRange/index.tsx +15 -0
- package/src/framework/components/index.ts +2 -1
- package/src/framework/components/system/ButtonList.tsx +22 -0
- package/src/framework/components/system/index.tsx +4 -4
- package/src/framework/fields/BaseRemoteSelect/index.tsx +129 -0
- package/src/framework/fields/FieldDictSelect/{index.jsx → index.tsx} +10 -4
- package/src/framework/fields/FieldRemoteSelect/index.tsx +37 -0
- package/src/framework/fields/FieldRemoteSelectMultiple/index.tsx +29 -0
- package/src/framework/fields/FieldRemoteSelectMultipleInline/index.tsx +33 -0
- package/src/framework/fields/FieldRemoteTree/index.tsx +31 -0
- package/src/framework/fields/FieldRemoteTreeCascader/index.tsx +39 -0
- package/src/framework/fields/FieldRemoteTreeSelect/index.tsx +39 -0
- package/src/framework/fields/FieldRemoteTreeSelectMultiple/index.tsx +43 -0
- package/src/framework/fields/FieldSysOrgTree/{index.jsx → index.tsx} +2 -2
- package/src/framework/fields/FieldSysOrgTreeSelect/{index.jsx → index.tsx} +2 -2
- package/src/framework/fields/FieldTable/{index.jsx → index.tsx} +5 -5
- package/src/framework/fields/FieldUploadFile/{index.jsx → index.tsx} +1 -3
- package/src/framework/index.ts +0 -1
- package/src/framework/utils/ArrayUtils.ts +186 -0
- package/src/framework/utils/EventBusUtils.ts +0 -1
- package/src/framework/utils/MessageUtils.tsx +0 -2
- package/src/framework/utils/TreeUtils.ts +2 -2
- package/src/framework/utils/index.ts +1 -1
- package/src/framework/utils/system/FormRegistryUtils.ts +0 -1
- package/src/framework/utils/system/PermUtils.ts +2 -2
- package/src/framework/views/ViewApproveStatus/index.tsx +11 -0
- package/src/framework/views/ViewBoolean/index.tsx +6 -0
- package/src/framework/views/ViewFile/{index.jsx → index.tsx} +4 -4
- package/src/framework/views/ViewImage/{index.jsx → index.tsx} +3 -3
- package/src/framework/views/ViewPassword/{index.jsx → index.tsx} +2 -2
- package/src/framework/views/ViewProcessInstanceProgressButton/{index.jsx → index.tsx} +1 -2
- package/src/layouts/PageRender.jsx +6 -6
- package/src/layouts/admin/HeaderRight.jsx +2 -2
- package/src/layouts/admin/TabPageRender.jsx +28 -13
- package/src/layouts/admin/index.jsx +15 -14
- package/src/layouts/admin/index.less +1 -1
- package/src/layouts/index.jsx +12 -13
- package/src/layouts/index.less +2 -2
- package/src/loading.jsx +17 -16
- package/src/pages/login.jsx +132 -4
- package/src/{framework/pages/LoginPage.less → pages/login.less} +3 -3
- package/src/pages/system/dict/index.jsx +4 -3
- package/src/pages/system/file/index.jsx +6 -5
- package/src/pages/system/job/index.jsx +10 -9
- package/src/pages/system/{sysManual → manual}/index.jsx +1 -1
- package/src/pages/system/org/index.jsx +4 -5
- package/src/pages/system/role/index.jsx +5 -5
- package/src/pages/system/role/perm.jsx +6 -6
- package/src/pages/system/user/UserPerm.jsx +4 -4
- package/src/pages/system/user/index.jsx +2 -2
- package/src/pages/userCenter/ChangePassword.jsx +3 -5
- package/src/pages/userCenter/manual.jsx +1 -1
- package/src/pages/userCenter/message.jsx +1 -1
- package/src/framework/components/DownloadFileButton/index.d.ts +0 -11
- package/src/framework/components/Gap/index.d.ts +0 -23
- package/src/framework/components/Gap/index.jsx +0 -46
- package/src/framework/components/LinkButton/index.d.ts +0 -14
- package/src/framework/components/OrgTree/index.d.ts +0 -4
- package/src/framework/components/Page/index.d.ts +0 -17
- package/src/framework/components/PageLoading/index.d.ts +0 -1
- package/src/framework/components/ProTable/index.d.ts +0 -42
- package/src/framework/components/ProTable/utils/index.js +0 -43
- package/src/framework/components/RoleTree/index.d.ts +0 -4
- package/src/framework/components/ViewRange/index.d.ts +0 -14
- package/src/framework/components/ViewRange/index.jsx +0 -20
- package/src/framework/components/system/ButtonList.d.ts +0 -8
- package/src/framework/components/system/ButtonList.jsx +0 -42
- package/src/framework/fields/FieldBoolean/index.d.ts +0 -9
- package/src/framework/fields/FieldDate/index.d.ts +0 -23
- package/src/framework/fields/FieldDateRange/index.d.ts +0 -22
- package/src/framework/fields/FieldDictSelect/index.d.ts +0 -12
- package/src/framework/fields/FieldEditor/index.d.ts +0 -14
- package/src/framework/fields/FieldNumberRange/index.d.ts +0 -10
- package/src/framework/fields/FieldPercent/index.d.ts +0 -8
- package/src/framework/fields/FieldRemoteSelect/index.d.ts +0 -44
- package/src/framework/fields/FieldRemoteSelect/index.jsx +0 -66
- package/src/framework/fields/FieldRemoteSelectMultiple/index.d.ts +0 -20
- package/src/framework/fields/FieldRemoteSelectMultiple/index.jsx +0 -85
- package/src/framework/fields/FieldRemoteSelectMultipleInline/index.d.ts +0 -21
- package/src/framework/fields/FieldRemoteSelectMultipleInline/index.jsx +0 -88
- package/src/framework/fields/FieldRemoteTree/index.d.ts +0 -20
- package/src/framework/fields/FieldRemoteTree/index.jsx +0 -50
- package/src/framework/fields/FieldRemoteTreeCascader/index.d.ts +0 -18
- package/src/framework/fields/FieldRemoteTreeCascader/index.jsx +0 -59
- package/src/framework/fields/FieldRemoteTreeSelect/index.d.ts +0 -19
- package/src/framework/fields/FieldRemoteTreeSelect/index.jsx +0 -57
- package/src/framework/fields/FieldRemoteTreeSelectMultiple/index.d.ts +0 -20
- package/src/framework/fields/FieldRemoteTreeSelectMultiple/index.jsx +0 -62
- package/src/framework/fields/FieldSysOrgTree/index.d.ts +0 -9
- package/src/framework/fields/FieldSysOrgTreeSelect/index.d.ts +0 -9
- package/src/framework/fields/FieldTable/index.d.ts +0 -14
- package/src/framework/fields/FieldTableSelect/index.d.ts +0 -19
- package/src/framework/fields/FieldUploadFile/index.d.ts +0 -31
- package/src/framework/pages/LoginPage.d.ts +0 -16
- package/src/framework/pages/LoginPage.jsx +0 -135
- package/src/framework/pages/LoginPageUtils.ts +0 -36
- package/src/framework/pages/index.ts +0 -2
- package/src/framework/utils/ArrUtils.ts +0 -229
- package/src/framework/views/ViewApproveStatus/index.d.ts +0 -5
- package/src/framework/views/ViewApproveStatus/index.jsx +0 -15
- package/src/framework/views/ViewBoolean/index.d.ts +0 -3
- package/src/framework/views/ViewBoolean/index.jsx +0 -4
- package/src/framework/views/ViewBooleanEnableDisable/index.d.ts +0 -5
- package/src/framework/views/ViewFile/index.d.ts +0 -10
- package/src/framework/views/ViewFileButton/index.d.ts +0 -10
- package/src/framework/views/ViewImage/index.d.ts +0 -6
- package/src/framework/views/ViewPassword/index.d.ts +0 -5
- package/src/framework/views/ViewProcessInstanceProgress/index.d.ts +0 -12
- package/src/framework/views/ViewProcessInstanceProgressButton/index.d.ts +0 -6
- package/src/framework/views/ViewText/index.d.ts +0 -16
- package/src/pages/system/api/index.jsx +0 -279
- package/src/pages/test/views.jsx +0 -95
- package/src/framework/components/DownloadFileButton/{index.jsx → index.tsx} +0 -0
- package/src/framework/components/LinkButton/{index.jsx → index.tsx} +0 -0
- package/src/framework/components/Page/{index.jsx → index.tsx} +0 -0
- package/src/framework/components/ValueType/{registry.jsx → registry.tsx} +1 -1
- /package/src/framework/fields/FieldBoolean/{index.jsx → index.tsx} +0 -0
- /package/src/framework/fields/FieldDate/{index.jsx → index.tsx} +0 -0
- /package/src/framework/fields/FieldDateRange/{index.jsx → index.tsx} +0 -0
- /package/src/framework/fields/FieldEditor/{index.jsx → index.tsx} +0 -0
- /package/src/framework/fields/FieldNumberRange/{index.jsx → index.tsx} +0 -0
- /package/src/framework/fields/FieldPercent/{index.jsx → index.tsx} +0 -0
- /package/src/framework/fields/FieldTableSelect/{index.jsx → index.tsx} +0 -0
- /package/src/framework/views/ViewBooleanEnableDisable/{index.jsx → index.tsx} +0 -0
- /package/src/framework/views/ViewFileButton/{index.jsx → index.tsx} +0 -0
- /package/src/framework/views/ViewProcessInstanceProgress/{index.jsx → index.tsx} +0 -0
- /package/src/framework/views/ViewText/{index.jsx → index.tsx} +0 -0
|
@@ -103,7 +103,6 @@ export class MessageUtils {
|
|
|
103
103
|
* 错误消息
|
|
104
104
|
*/
|
|
105
105
|
static error(content: String, duration: number = 3) {
|
|
106
|
-
console.log('调用 MessageUtils.error',content)
|
|
107
106
|
if(!this.messageApi){
|
|
108
107
|
alert(content)
|
|
109
108
|
return
|
|
@@ -144,7 +143,6 @@ export class MessageUtils {
|
|
|
144
143
|
static config(messageApi: MessageInstance, modalApi: HookAPI) {
|
|
145
144
|
this.messageApi = messageApi;
|
|
146
145
|
this.modalApi = modalApi;
|
|
147
|
-
console.log('MessageUtils.config', messageApi, modalApi)
|
|
148
146
|
}
|
|
149
147
|
|
|
150
148
|
private static modalApi:HookAPI = null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {ArrayUtils} from "./ArrayUtils";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* 🌳 通用树节点接口
|
|
@@ -169,7 +169,7 @@ export class TreeUtils {
|
|
|
169
169
|
// 优先使用 key 字段,其次使用 id 字段
|
|
170
170
|
const key = item.key || item.id;
|
|
171
171
|
|
|
172
|
-
if (
|
|
172
|
+
if (ArrayUtils.contains(keyList, key)) {
|
|
173
173
|
itemList.push(item);
|
|
174
174
|
}
|
|
175
175
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {SysUtils} from "./SysUtils";
|
|
2
|
-
import {
|
|
2
|
+
import {ArrayUtils} from "../ArrayUtils";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* 登录用户信息接口,
|
|
@@ -49,7 +49,7 @@ export class PermUtils {
|
|
|
49
49
|
|
|
50
50
|
// 检查是否拥有超级权限 '*'
|
|
51
51
|
// 假设 ArrUtils.contains(array, item) 存在且返回 boolean
|
|
52
|
-
if (
|
|
52
|
+
if (ArrayUtils.contains(permissions, "*")) {
|
|
53
53
|
return true;
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {DictUtils} from "../../utils";
|
|
2
|
+
import {Tag} from "antd";
|
|
3
|
+
import {Component} from "react";
|
|
4
|
+
import type {ViewProps} from "../types";
|
|
5
|
+
|
|
6
|
+
export class ViewApproveStatus extends Component<ViewProps<String>> {
|
|
7
|
+
render() {
|
|
8
|
+
const {value} = this.props;
|
|
9
|
+
return DictUtils.dictTag('approveStatus', value);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -6,16 +6,16 @@ export class ViewFile extends React.Component {
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
render() {
|
|
9
|
-
|
|
9
|
+
const fileId = this.props.value
|
|
10
10
|
|
|
11
11
|
if (!fileId) {
|
|
12
12
|
return <Empty/>;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
const arr = fileId.split(',');
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
const urlList = arr.map(id => 'admin/sysFile/preview/' + id);
|
|
18
|
+
const height = this.props.height;
|
|
19
19
|
|
|
20
20
|
if(urlList.length === 1){
|
|
21
21
|
const url = urlList[0]
|
|
@@ -15,10 +15,10 @@ export class ViewImage extends React.Component {
|
|
|
15
15
|
vs = vs.split(',');
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
const urlList = [];
|
|
19
19
|
for (let v of vs) {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
const isId = v.indexOf('/') === -1;
|
|
21
|
+
const isAbsUrl = v.startsWith('http');
|
|
22
22
|
if (isAbsUrl) {
|
|
23
23
|
urlList.push(v);
|
|
24
24
|
continue;
|
|
@@ -9,11 +9,11 @@ export class ViewPassword extends React.Component {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
render() {
|
|
12
|
-
|
|
12
|
+
const v = this.props.value;
|
|
13
13
|
if (v == null) {
|
|
14
14
|
return null
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
const visible = this.state.visible;
|
|
17
17
|
return <Space>
|
|
18
18
|
<span>{this.state.visible ? v : '******'}</span>
|
|
19
19
|
<a onClick={() => this.setState({visible: !visible})}>
|
|
@@ -9,8 +9,7 @@ export class ViewProcessInstanceProgressButton extends React.Component {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
onClick = () => {
|
|
12
|
-
|
|
13
|
-
let content = <ViewProcessInstanceProgress value={this.props.value} />;
|
|
12
|
+
const content = <ViewProcessInstanceProgress value={this.props.value} />;
|
|
14
13
|
MessageUtils.alert(content,{
|
|
15
14
|
title:'流程审批信息',
|
|
16
15
|
width:800
|
|
@@ -26,7 +26,7 @@ let APP_DATA_CACHE = null
|
|
|
26
26
|
* @constructor
|
|
27
27
|
*/
|
|
28
28
|
export function PageRender(props) {
|
|
29
|
-
|
|
29
|
+
const {pathname, search, passLocation} = props
|
|
30
30
|
|
|
31
31
|
let appData = useAppData()
|
|
32
32
|
if(Object.keys(appData).length === 0){
|
|
@@ -49,13 +49,13 @@ class _PageRender extends React.Component {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
passLocationRender = () => {
|
|
52
|
-
|
|
52
|
+
const {pathname, search, appData} = this.props
|
|
53
53
|
|
|
54
54
|
const map = appData.routeComponents
|
|
55
55
|
const key = pathname.substring(1); // 移除第一个斜杠
|
|
56
|
-
|
|
56
|
+
const componentType = map[key] || map[key + '/index']
|
|
57
57
|
if (componentType) {
|
|
58
|
-
|
|
58
|
+
const params =search ? UrlUtils.getParams(search): {}
|
|
59
59
|
const location = {pathname, search, params}
|
|
60
60
|
return React.createElement(componentType, {location});
|
|
61
61
|
}
|
|
@@ -63,8 +63,8 @@ class _PageRender extends React.Component {
|
|
|
63
63
|
|
|
64
64
|
|
|
65
65
|
defaultRender = () => {
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
const {pathname, appData} = this.props
|
|
67
|
+
const matchArr = matchRoutes(appData.clientRoutes, pathname)
|
|
68
68
|
|
|
69
69
|
if (matchArr != null) {
|
|
70
70
|
if (pathname === '/') {
|
|
@@ -6,7 +6,7 @@ import {DeviceUtils, HttpUtils, MessageUtils, PageUtils, SysUtils} from "../../
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
const ID = 'header-right';
|
|
9
|
-
export
|
|
9
|
+
export class HeaderRight extends React.Component {
|
|
10
10
|
|
|
11
11
|
state = {
|
|
12
12
|
isMobileDevice: false
|
|
@@ -27,7 +27,7 @@ export default class HeaderRight extends React.Component {
|
|
|
27
27
|
await MessageUtils.alert('退出登录成功');
|
|
28
28
|
history.replace('/login')
|
|
29
29
|
}).catch(async e => {
|
|
30
|
-
|
|
30
|
+
const confirm = await MessageUtils.confirm('退出登录失败,是否清空缓存');
|
|
31
31
|
if (confirm) {
|
|
32
32
|
localStorage.clear();
|
|
33
33
|
history.replace('/login')
|
|
@@ -4,7 +4,9 @@ import {Tabs} from "antd";
|
|
|
4
4
|
import {PageRender} from "../PageRender";
|
|
5
5
|
import {PageUtils} from "../../framework";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
const MAX_TABS = 20;
|
|
8
|
+
|
|
9
|
+
class TabPageRenderComponent extends React.Component {
|
|
8
10
|
|
|
9
11
|
state = {
|
|
10
12
|
active: null,
|
|
@@ -12,6 +14,8 @@ class TabPageRender extends React.Component {
|
|
|
12
14
|
tabs: [],
|
|
13
15
|
}
|
|
14
16
|
|
|
17
|
+
accessOrder = [];
|
|
18
|
+
|
|
15
19
|
componentDidMount() {
|
|
16
20
|
const url = this.getUrl(this.props)
|
|
17
21
|
this.onUrlChange(url);
|
|
@@ -31,21 +35,34 @@ class TabPageRender extends React.Component {
|
|
|
31
35
|
}
|
|
32
36
|
}
|
|
33
37
|
|
|
38
|
+
recordAccess(url) {
|
|
39
|
+
this.accessOrder = this.accessOrder.filter(k => k !== url);
|
|
40
|
+
this.accessOrder.push(url);
|
|
41
|
+
}
|
|
42
|
+
|
|
34
43
|
onUrlChange = url => {
|
|
35
44
|
const {location} = this.props
|
|
36
|
-
|
|
37
45
|
const {pathname, search} = location
|
|
38
|
-
|
|
46
|
+
const {tabs} = this.state
|
|
39
47
|
|
|
40
48
|
const old = tabs.find(t => t.key === url)
|
|
41
49
|
if (old == null) {
|
|
42
50
|
const cmp = <PageRender pathname={pathname} search={search}/>
|
|
43
|
-
|
|
51
|
+
const label = this.getLabel(pathname);
|
|
44
52
|
tabs.push({
|
|
45
53
|
key: url,
|
|
46
54
|
label: label,
|
|
47
55
|
children: cmp
|
|
48
56
|
});
|
|
57
|
+
|
|
58
|
+
if (tabs.length > MAX_TABS) {
|
|
59
|
+
const keep = new Set([url, ...this.accessOrder.slice(-3)]);
|
|
60
|
+
const removeIdx = tabs.findIndex(t => !keep.has(t.key));
|
|
61
|
+
if (removeIdx > -1) {
|
|
62
|
+
tabs.splice(removeIdx, 1);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
49
66
|
this.setState({tabs: [...tabs]})
|
|
50
67
|
}else {
|
|
51
68
|
const menu = this.props.pathMenuMap[pathname]
|
|
@@ -54,6 +71,7 @@ class TabPageRender extends React.Component {
|
|
|
54
71
|
}
|
|
55
72
|
}
|
|
56
73
|
|
|
74
|
+
this.recordAccess(url);
|
|
57
75
|
this.setState({active: url})
|
|
58
76
|
};
|
|
59
77
|
|
|
@@ -61,7 +79,7 @@ class TabPageRender extends React.Component {
|
|
|
61
79
|
if (path === '/') {
|
|
62
80
|
return '首页'
|
|
63
81
|
}
|
|
64
|
-
|
|
82
|
+
const label = PageUtils.currentLabel();
|
|
65
83
|
|
|
66
84
|
if (!label) {
|
|
67
85
|
const menu = this.props.pathMenuMap[path]
|
|
@@ -75,7 +93,7 @@ class TabPageRender extends React.Component {
|
|
|
75
93
|
|
|
76
94
|
|
|
77
95
|
render() {
|
|
78
|
-
|
|
96
|
+
const {tabs} = this.state
|
|
79
97
|
if (tabs.length === 0) {
|
|
80
98
|
return null
|
|
81
99
|
}
|
|
@@ -102,9 +120,8 @@ class TabPageRender extends React.Component {
|
|
|
102
120
|
|
|
103
121
|
lastTabClickTime = 0
|
|
104
122
|
onTabClick = (key, event) => {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
// 双击时刷新
|
|
123
|
+
const now = new Date().getTime();
|
|
124
|
+
const doubleClick = now - this.lastTabClickTime < 300;
|
|
108
125
|
if (doubleClick) {
|
|
109
126
|
this.refresh(key);
|
|
110
127
|
}
|
|
@@ -118,10 +135,8 @@ class TabPageRender extends React.Component {
|
|
|
118
135
|
if(tab != null){
|
|
119
136
|
const old = tab.children
|
|
120
137
|
if(old != null){
|
|
121
|
-
console.log('准备刷新:', key)
|
|
122
138
|
tab.children = '刷新中...'
|
|
123
139
|
this.setState({tabs}, () => {
|
|
124
|
-
console.log('刷新节点', tab)
|
|
125
140
|
tab.children = old
|
|
126
141
|
this.setState({tabs})
|
|
127
142
|
})
|
|
@@ -138,6 +153,7 @@ class TabPageRender extends React.Component {
|
|
|
138
153
|
onRemove = url => {
|
|
139
154
|
let {tabs} = this.state
|
|
140
155
|
tabs = tabs.filter(t => t.key !== url)
|
|
156
|
+
this.accessOrder = this.accessOrder.filter(k => k !== url);
|
|
141
157
|
|
|
142
158
|
this.setState({tabs})
|
|
143
159
|
if (tabs.length > 0) {
|
|
@@ -154,5 +170,4 @@ class TabPageRender extends React.Component {
|
|
|
154
170
|
}
|
|
155
171
|
|
|
156
172
|
|
|
157
|
-
|
|
158
|
-
export default withRouter(TabPageRender)
|
|
173
|
+
export const TabPageRender = withRouter(TabPageRenderComponent)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {Badge, Layout, Menu,
|
|
2
|
+
import {Badge, Layout, Menu, Skeleton, Watermark} from 'antd';
|
|
3
3
|
|
|
4
4
|
import {history, Link} from 'umi';
|
|
5
5
|
import "./index.less"
|
|
6
|
-
import {Gap, HttpUtils, NamedIcon, PageUtils, SysUtils, ThemeUtils, TreeUtils} from "../../framework";
|
|
6
|
+
import {ErrorBoundary, Gap, HttpUtils, NamedIcon, PageUtils, SysUtils, ThemeUtils, TreeUtils} from "../../framework";
|
|
7
7
|
|
|
8
|
-
import HeaderRight from "./HeaderRight";
|
|
9
|
-
import TabPageRender from "./TabPageRender";
|
|
8
|
+
import { HeaderRight } from "./HeaderRight";
|
|
9
|
+
import { TabPageRender } from "./TabPageRender";
|
|
10
10
|
|
|
11
11
|
const {Header, Sider, Content} = Layout;
|
|
12
12
|
/**
|
|
@@ -32,11 +32,10 @@ export default class extends React.Component {
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
componentDidMount() {
|
|
35
|
-
console.log('Admin Layout didMount')
|
|
36
35
|
// 判断是否手机端,自动收起菜单
|
|
37
36
|
|
|
38
37
|
|
|
39
|
-
|
|
38
|
+
const siteInfo = SysUtils.getSiteInfo();
|
|
40
39
|
const loginInfo = SysUtils.getLoginInfo()
|
|
41
40
|
this.setState({siteInfo, loginInfo})
|
|
42
41
|
|
|
@@ -46,18 +45,18 @@ export default class extends React.Component {
|
|
|
46
45
|
|
|
47
46
|
initMenu = () => {
|
|
48
47
|
this.setState({menuLoading: true})
|
|
49
|
-
HttpUtils.get('/admin/
|
|
48
|
+
HttpUtils.get('/admin/menu-info').then(info => {
|
|
50
49
|
const {menuTree, pathMenuMap, menuMap} = info
|
|
51
50
|
this.setState({menuMap})
|
|
52
51
|
|
|
53
|
-
|
|
52
|
+
const pathname = PageUtils.currentPathname();
|
|
54
53
|
|
|
55
54
|
TreeUtils.walk(menuTree, (item) => {
|
|
56
55
|
item.icon = <NamedIcon name={item.icon || 'AppstoreOutlined'} style={{fontSize: 12}}/>
|
|
57
56
|
})
|
|
58
57
|
|
|
59
58
|
if (pathname !== "" && pathname !== "/") {
|
|
60
|
-
|
|
59
|
+
const menu = pathMenuMap[pathname]
|
|
61
60
|
if (menu) {
|
|
62
61
|
this.setState({currentMenuKey: menu.key})
|
|
63
62
|
}
|
|
@@ -124,7 +123,9 @@ export default class extends React.Component {
|
|
|
124
123
|
</Sider>
|
|
125
124
|
|
|
126
125
|
<Content id='admin-layout-content'>
|
|
127
|
-
|
|
126
|
+
<ErrorBoundary>
|
|
127
|
+
{this.renderCenterContent(loginInfo)}
|
|
128
|
+
</ErrorBoundary>
|
|
128
129
|
</Content>
|
|
129
130
|
|
|
130
131
|
</Layout>
|
|
@@ -134,7 +135,7 @@ export default class extends React.Component {
|
|
|
134
135
|
|
|
135
136
|
renderLeftMenu() {
|
|
136
137
|
if(this.state.menuLoading){
|
|
137
|
-
return <
|
|
138
|
+
return <div style={{padding: 16}}><Skeleton active title={false} paragraph={{rows: 8}} /></div>;
|
|
138
139
|
}
|
|
139
140
|
return <Menu items={this.state.menuTree}
|
|
140
141
|
theme='dark'
|
|
@@ -142,7 +143,7 @@ export default class extends React.Component {
|
|
|
142
143
|
className='left-menu'
|
|
143
144
|
onClick={({key}) => {
|
|
144
145
|
const menu = this.state.menuMap[key]
|
|
145
|
-
|
|
146
|
+
const {path} = menu;
|
|
146
147
|
this.setState({currentMenuKey: key})
|
|
147
148
|
history.push(path)
|
|
148
149
|
}}
|
|
@@ -155,9 +156,9 @@ export default class extends React.Component {
|
|
|
155
156
|
renderCenterContent = () => {
|
|
156
157
|
const {siteInfo, loginInfo} = this.state
|
|
157
158
|
if (this.state.menuTree.length === 0) { // 加载菜单中
|
|
158
|
-
return
|
|
159
|
+
return <Skeleton active paragraph={{rows: 10}} style={{padding: 24}} />
|
|
159
160
|
}
|
|
160
|
-
|
|
161
|
+
const tabPageRenderNode = <TabPageRender pathMenuMap={this.state.pathMenuMap}/>;
|
|
161
162
|
if (siteInfo.waterMark === true) {
|
|
162
163
|
return <Watermark content={[loginInfo.name, loginInfo.account]}>
|
|
163
164
|
{tabPageRenderNode}
|
package/src/layouts/index.jsx
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import AdminLayout from "./admin"
|
|
2
1
|
import React from "react";
|
|
3
2
|
import {ConfigProvider} from "antd";
|
|
4
|
-
|
|
5
|
-
import {Outlet, withRouter} from "umi";
|
|
6
3
|
import zhCN from 'antd/locale/zh_CN';
|
|
4
|
+
import dayjs from 'dayjs';
|
|
5
|
+
import 'dayjs/locale/zh-cn';
|
|
6
|
+
import {Outlet, withRouter} from "umi";
|
|
7
|
+
|
|
8
|
+
import AdminLayout from "./admin"
|
|
7
9
|
import {
|
|
8
|
-
|
|
10
|
+
ArrayUtils,
|
|
9
11
|
HttpUtils,
|
|
10
12
|
MessageHolder,
|
|
11
13
|
PageLoading,
|
|
@@ -13,12 +15,10 @@ import {
|
|
|
13
15
|
SysUtils,
|
|
14
16
|
ThemeUtils,
|
|
15
17
|
} from "../framework";
|
|
16
|
-
import
|
|
17
|
-
import 'dayjs/locale/zh-cn';
|
|
18
|
+
import {Logger} from "../framework/utils/Logger";
|
|
18
19
|
|
|
19
20
|
import '../style/global.less'
|
|
20
21
|
import './index.less'
|
|
21
|
-
import {Logger} from "../framework/utils/Logger";
|
|
22
22
|
|
|
23
23
|
dayjs.locale('zh-cn');
|
|
24
24
|
|
|
@@ -33,7 +33,7 @@ function checkIsSimplePage(pathname) {
|
|
|
33
33
|
if(pathname.startsWith("/test/")){
|
|
34
34
|
return true
|
|
35
35
|
}
|
|
36
|
-
return
|
|
36
|
+
return ArrayUtils.contains(SIMPLE_URLS, pathname) ;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
function checkIsPurePage(pathname){
|
|
@@ -78,12 +78,12 @@ class _Layouts extends React.Component {
|
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
loadLoginInfo = () => {
|
|
81
|
-
|
|
81
|
+
const {pathname} = this.props.location;
|
|
82
82
|
if (checkIsPurePage(pathname) || checkIsSimplePage(pathname) || this.state.loginInfoFinish) {
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
HttpUtils.get('/admin/public/
|
|
86
|
+
HttpUtils.get('/admin/public/check-login')
|
|
87
87
|
.then(rs => {
|
|
88
88
|
const {needUpdatePwd, dictInfo, loginInfo} = rs
|
|
89
89
|
SysUtils.setDictInfo(dictInfo)
|
|
@@ -147,7 +147,7 @@ class _Layouts extends React.Component {
|
|
|
147
147
|
|
|
148
148
|
|
|
149
149
|
renderContent = () => {
|
|
150
|
-
|
|
150
|
+
const {pathname} = this.props.location;
|
|
151
151
|
|
|
152
152
|
if(checkIsPurePage(pathname)){
|
|
153
153
|
return <Outlet/>
|
|
@@ -158,8 +158,7 @@ class _Layouts extends React.Component {
|
|
|
158
158
|
return <PageLoading message='加载消息组件...'/>
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
|
|
162
|
-
console.log('layout: params', params)
|
|
161
|
+
const {params = {}} = this.props.location;
|
|
163
162
|
if (checkIsSimplePage(pathname) || params.hasOwnProperty('_noLayout')) {
|
|
164
163
|
return <Outlet/>
|
|
165
164
|
}
|
package/src/layouts/index.less
CHANGED
package/src/loading.jsx
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {Spin} from "antd";
|
|
3
|
-
import {ThemeUtils} from "./framework";
|
|
2
|
+
import { Spin } from "antd";
|
|
3
|
+
import { ThemeUtils } from "./framework";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
5
|
+
const Loading = () => (
|
|
6
|
+
<div
|
|
7
|
+
style={{
|
|
8
|
+
display: 'flex',
|
|
9
|
+
alignItems: 'center',
|
|
10
|
+
justifyContent: 'center',
|
|
11
|
+
height: '100vh',
|
|
12
|
+
background: ThemeUtils.getColor("background-color")
|
|
13
|
+
}}
|
|
14
|
+
>
|
|
15
|
+
<Spin size='large' />
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export default Loading;
|