@jiangood/open-admin 2.0.1 → 2.2.5
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/common-plugin.js +51 -0
- package/config/config.js +1 -56
- package/package.json +5 -2
- package/src/.umi-production/appData.json +73 -100
- package/src/.umi-production/umi.ts +2 -2
- package/src/framework/components/DownloadFileButton/index.tsx +1 -1
- package/src/framework/components/OrgTree/index.tsx +1 -1
- package/src/framework/components/Page/index.less +1 -1
- package/src/framework/components/Page/index.tsx +19 -22
- package/src/framework/components/PageLoading/index.tsx +5 -3
- package/src/framework/components/ProModal/index.tsx +2 -2
- package/src/framework/components/ProTable/components/ToolBar/index.tsx +1 -1
- package/src/framework/fields/FieldEditor/index.tsx +3 -2
- package/src/framework/fields/FieldRemoteTreeSelect/index.tsx +3 -3
- package/src/framework/fields/FieldRemoteTreeSelectMultiple/index.tsx +3 -3
- package/src/framework/fields/FieldUploadFile/index.tsx +8 -4
- package/src/framework/utils/MessageUtils.tsx +21 -99
- package/src/framework/utils/system/HttpUtils.ts +5 -1
- package/src/framework/utils/system/SysUtils.ts +8 -0
- package/src/framework/utils/system/ThemeUtils.ts +37 -12
- package/src/framework/views/ViewFile/index.tsx +1 -1
- package/src/framework/views/ViewProcessInstanceProgress/index.tsx +1 -0
- package/src/layouts/PageRender.tsx +29 -0
- package/src/layouts/admin/HeaderRight.jsx +1 -0
- package/src/layouts/admin/TabPageRender.jsx +138 -158
- package/src/layouts/admin/index.jsx +123 -19
- package/src/layouts/admin/index.less +124 -6
- package/src/layouts/index.jsx +94 -161
- package/src/pages/404.jsx +7 -5
- package/src/pages/about.jsx +3 -3
- package/src/pages/index.jsx +4 -5
- package/src/pages/login.jsx +18 -9
- package/src/pages/login.less +0 -1
- package/src/pages/system/dict/index.jsx +8 -11
- package/src/pages/system/file/index.jsx +6 -6
- package/src/pages/system/job/index.jsx +26 -11
- package/src/pages/system/log/index.jsx +4 -5
- package/src/pages/system/manual/index.jsx +8 -6
- package/src/pages/system/org/index.jsx +4 -2
- package/src/pages/system/role/index.jsx +16 -14
- package/src/pages/system/role/perm.jsx +3 -4
- package/src/pages/system/user/UserPerm.jsx +1 -1
- package/src/pages/system/user/index.jsx +9 -7
- package/src/pages/userCenter/index.jsx +2 -2
- package/src/pages/userCenter/message.jsx +4 -2
- package/src/layouts/PageRender.d.ts +0 -22
- package/src/layouts/PageRender.jsx +0 -90
|
@@ -23,7 +23,9 @@ export default class extends React.Component {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
onFinish = values => {
|
|
26
|
-
|
|
26
|
+
const isNew = !values.id;
|
|
27
|
+
const url = isNew ? 'admin/sysManual/create' : 'admin/sysManual/update';
|
|
28
|
+
HttpUtils.post(url, values).then(rs => {
|
|
27
29
|
this.setState({formOpen: false})
|
|
28
30
|
this.tableRef.current.reload()
|
|
29
31
|
})
|
|
@@ -66,8 +68,8 @@ export default class extends React.Component {
|
|
|
66
68
|
dataIndex: 'option',
|
|
67
69
|
render: (_, record) => (
|
|
68
70
|
<ButtonList>
|
|
69
|
-
<Button size='small' perm='
|
|
70
|
-
<Popconfirm perm='
|
|
71
|
+
<Button size='small' perm='sys-manual:update' onClick={() => this.handleEdit(record)}>编辑</Button>
|
|
72
|
+
<Popconfirm perm='sys-manual:delete' title='是否确定删除操作手册'
|
|
71
73
|
onConfirm={() => this.handleDelete(record)}>
|
|
72
74
|
<Button size='small'>删除</Button>
|
|
73
75
|
</Popconfirm>
|
|
@@ -83,7 +85,7 @@ export default class extends React.Component {
|
|
|
83
85
|
actionRef={this.tableRef}
|
|
84
86
|
toolBarRender={(params, {selectedRows, selectedRowKeys}) => {
|
|
85
87
|
return <ButtonList>
|
|
86
|
-
<Button perm='
|
|
88
|
+
<Button perm='sys-manual:create' type='primary' onClick={this.handleAdd}>
|
|
87
89
|
<PlusOutlined/> 新增
|
|
88
90
|
</Button>
|
|
89
91
|
</ButtonList>
|
|
@@ -97,8 +99,8 @@ export default class extends React.Component {
|
|
|
97
99
|
open={this.state.formOpen}
|
|
98
100
|
onOk={() => this.formRef.current.submit()}
|
|
99
101
|
onCancel={() => this.setState({formOpen: false})}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
+
destroyOnHidden
|
|
103
|
+
mask={{ closable: false }}
|
|
102
104
|
>
|
|
103
105
|
|
|
104
106
|
<Form ref={this.formRef} labelCol={{flex: '100px'}}
|
|
@@ -77,7 +77,9 @@ export default class extends React.Component {
|
|
|
77
77
|
|
|
78
78
|
onFinish = (values) => {
|
|
79
79
|
this.setState({submitLoading: true, formEditing: false})
|
|
80
|
-
|
|
80
|
+
const isNew = !values.id;
|
|
81
|
+
const url = isNew ? 'admin/sysOrg/create' : 'admin/sysOrg/update';
|
|
82
|
+
HttpUtils.post(url, values).then(rs => {
|
|
81
83
|
this.loadTree()
|
|
82
84
|
}).finally(() => {
|
|
83
85
|
this.setState({submitLoading: false})
|
|
@@ -94,7 +96,7 @@ export default class extends React.Component {
|
|
|
94
96
|
const {formValues} = this.state;
|
|
95
97
|
const disabled = formValues == null;
|
|
96
98
|
const params = this.state.params;
|
|
97
|
-
return <Page
|
|
99
|
+
return <Page>
|
|
98
100
|
<Card>
|
|
99
101
|
<Space>
|
|
100
102
|
|
|
@@ -45,7 +45,9 @@ export default class extends React.Component {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
onFinish = values => {
|
|
48
|
-
|
|
48
|
+
const isNew = !values.id;
|
|
49
|
+
const url = isNew ? 'admin/sysRole/create' : 'admin/sysRole/update';
|
|
50
|
+
HttpUtils.post(url, values).then(rs => {
|
|
49
51
|
this.setState({formOpen: false})
|
|
50
52
|
this.tableRef.current.reload()
|
|
51
53
|
})
|
|
@@ -130,15 +132,15 @@ export default class extends React.Component {
|
|
|
130
132
|
|
|
131
133
|
return (
|
|
132
134
|
<ButtonList>
|
|
133
|
-
<Button size='small' perm='
|
|
135
|
+
<Button size='small' perm='sys-role:grant-permission'
|
|
134
136
|
onClick={() => this.handleEditUser(record)}>用户设置</Button>
|
|
135
137
|
|
|
136
|
-
<Button size='small' perm='
|
|
138
|
+
<Button size='small' perm='sys-role:grant-permission' disabled={record.builtin}
|
|
137
139
|
onClick={() => PageUtils.open('/system/role/perm?id=' + record.id, '角色权限设置')}>权限设置</Button>
|
|
138
140
|
|
|
139
|
-
<Button size='small' perm='
|
|
141
|
+
<Button size='small' perm='sys-role:update' disabled={record.builtin}
|
|
140
142
|
onClick={() => this.handleEdit(record)}>编辑</Button>
|
|
141
|
-
<Popconfirm perm='
|
|
143
|
+
<Popconfirm perm='sys-role:delete' disabled={record.builtin} title='是否确定删除系统角色'
|
|
142
144
|
onConfirm={() => this.handleDelete(record)}>
|
|
143
145
|
<Button size='small'>删除</Button>
|
|
144
146
|
</Popconfirm>
|
|
@@ -178,12 +180,12 @@ export default class extends React.Component {
|
|
|
178
180
|
}
|
|
179
181
|
|
|
180
182
|
render() {
|
|
181
|
-
return <Page
|
|
183
|
+
return <Page>
|
|
182
184
|
<ProTable
|
|
183
185
|
actionRef={this.tableRef}
|
|
184
186
|
toolBarRender={() => {
|
|
185
187
|
return <ButtonList>
|
|
186
|
-
<Button perm='
|
|
188
|
+
<Button perm='sys-role:create' type='primary' onClick={this.handleAdd}>
|
|
187
189
|
<PlusOutlined/> 新增
|
|
188
190
|
</Button>
|
|
189
191
|
</ButtonList>
|
|
@@ -197,8 +199,8 @@ export default class extends React.Component {
|
|
|
197
199
|
open={this.state.formOpen}
|
|
198
200
|
onOk={() => this.formRef.current.submit()}
|
|
199
201
|
onCancel={() => this.setState({formOpen: false})}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
+
destroyOnHidden
|
|
203
|
+
mask={{ closable: false }}
|
|
202
204
|
width={600}
|
|
203
205
|
>
|
|
204
206
|
|
|
@@ -238,8 +240,8 @@ export default class extends React.Component {
|
|
|
238
240
|
|
|
239
241
|
<Modal title={'角色用户' + "【" + this.state.formValues?.name + '】'}
|
|
240
242
|
open={this.state.usersModalOpen}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
+
destroyOnHidden
|
|
244
|
+
mask={{ closable: false }}
|
|
243
245
|
width={800}
|
|
244
246
|
onCancel={() => this.setState({usersModalOpen: false})}
|
|
245
247
|
onOk={this.handleSaveUsers}
|
|
@@ -247,7 +249,7 @@ export default class extends React.Component {
|
|
|
247
249
|
|
|
248
250
|
|
|
249
251
|
<Transfer
|
|
250
|
-
|
|
252
|
+
styles={{ section: { height: '60vh', width: 300 } }}
|
|
251
253
|
|
|
252
254
|
dataSource={this.state.userList} titles={["未选择", "已选择"]}
|
|
253
255
|
targetKeys={this.state.targetKeys}
|
|
@@ -271,8 +273,8 @@ export default class extends React.Component {
|
|
|
271
273
|
|
|
272
274
|
<Modal title={'角色授权菜单权限' + "【" + this.state.formValues?.name + '】'}
|
|
273
275
|
open={this.state.menuOpen}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
+
destroyOnHidden
|
|
277
|
+
mask={{ closable: false }}
|
|
276
278
|
width={800}
|
|
277
279
|
onCancel={() => this.setState({menuOpen: false})}
|
|
278
280
|
onOk={this.handleGrantMenu}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import {Button, Card, Checkbox, Table, Typography} from "antd";
|
|
3
3
|
import {SaveOutlined} from "@ant-design/icons";
|
|
4
|
-
import {ArrayUtils, HttpUtils, PageUtils} from "../../../framework";
|
|
4
|
+
import {ArrayUtils, HttpUtils, Page, PageUtils} from "../../../framework";
|
|
5
5
|
export default class extends React.Component {
|
|
6
6
|
|
|
7
7
|
|
|
@@ -89,8 +89,7 @@ export default class extends React.Component {
|
|
|
89
89
|
|
|
90
90
|
|
|
91
91
|
render() {
|
|
92
|
-
return
|
|
93
|
-
|
|
92
|
+
return <Page>
|
|
94
93
|
|
|
95
94
|
<Card title='角色权限设置' loading={this.state.loading}
|
|
96
95
|
variant={"borderless"}
|
|
@@ -102,6 +101,6 @@ export default class extends React.Component {
|
|
|
102
101
|
expandable={{defaultExpandAllRows: true}}
|
|
103
102
|
></Table>
|
|
104
103
|
</Card>
|
|
105
|
-
|
|
104
|
+
</Page>
|
|
106
105
|
}
|
|
107
106
|
}
|
|
@@ -125,16 +125,16 @@ export default class extends React.Component {
|
|
|
125
125
|
fixed: 'right',
|
|
126
126
|
render: (_, record) => {
|
|
127
127
|
return <ButtonList>
|
|
128
|
-
<Button size='small' perm='
|
|
128
|
+
<Button size='small' perm='sys-user:update' onClick={() => this.handleEdit(record)}> 编辑 </Button>
|
|
129
129
|
|
|
130
|
-
<Button size='small' perm='
|
|
130
|
+
<Button size='small' perm='sys-user:grant-permission'
|
|
131
131
|
onClick={() => this.permRef.current.show(record)}> 授权 </Button>
|
|
132
132
|
|
|
133
|
-
<Popconfirm perm='
|
|
133
|
+
<Popconfirm perm='sys-user:reset-password' title='确认重置密码?' onConfirm={() => this.resetPwd(record)}>
|
|
134
134
|
<Button size='small'>重置密码</Button>
|
|
135
135
|
</Popconfirm>
|
|
136
136
|
|
|
137
|
-
<Popconfirm perm='
|
|
137
|
+
<Popconfirm perm='sys-user:delete' title={'是否确定删除用户'}
|
|
138
138
|
onConfirm={() => this.handleDelete(record)}>
|
|
139
139
|
<Button size='small'>删除</Button>
|
|
140
140
|
</Popconfirm>
|
|
@@ -144,7 +144,9 @@ export default class extends React.Component {
|
|
|
144
144
|
];
|
|
145
145
|
|
|
146
146
|
onFinish = values => {
|
|
147
|
-
|
|
147
|
+
const isNew = !values.id;
|
|
148
|
+
const url = isNew ? 'admin/sysUser/create' : 'admin/sysUser/update';
|
|
149
|
+
HttpUtils.post(url, values).then(rs => {
|
|
148
150
|
this.setState({formOpen: false})
|
|
149
151
|
this.tableRef.current.reload()
|
|
150
152
|
})
|
|
@@ -178,7 +180,7 @@ export default class extends React.Component {
|
|
|
178
180
|
toolBarRender={() => {
|
|
179
181
|
return <ButtonList>
|
|
180
182
|
<Button
|
|
181
|
-
perm='
|
|
183
|
+
perm='sys-user:create'
|
|
182
184
|
type="primary"
|
|
183
185
|
onClick={this.handleAdd}>
|
|
184
186
|
<PlusOutlined/> 新增
|
|
@@ -206,7 +208,7 @@ export default class extends React.Component {
|
|
|
206
208
|
open={this.state.formOpen}
|
|
207
209
|
onOk={() => this.formRef.current.submit()}
|
|
208
210
|
onCancel={() => this.setState({formOpen: false})}
|
|
209
|
-
|
|
211
|
+
destroyOnHidden
|
|
210
212
|
>
|
|
211
213
|
|
|
212
214
|
<Form ref={this.formRef} labelCol={{flex: '100px'}}
|
|
@@ -17,7 +17,7 @@ export default class extends React.Component {
|
|
|
17
17
|
|
|
18
18
|
render() {
|
|
19
19
|
const {info} = this.state;
|
|
20
|
-
return <Page
|
|
20
|
+
return <Page backgroundGray>
|
|
21
21
|
<Row gutter={[16, 16]}>
|
|
22
22
|
<Col md={6} sm={24}>
|
|
23
23
|
<Card title='个人信息'>
|
|
@@ -76,7 +76,7 @@ export default class extends React.Component {
|
|
|
76
76
|
</div>
|
|
77
77
|
}
|
|
78
78
|
]}
|
|
79
|
-
|
|
79
|
+
tabPlacement='left'
|
|
80
80
|
>
|
|
81
81
|
</Tabs>
|
|
82
82
|
</Card>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import {Button, Card, Tabs, Tag} from "antd";
|
|
3
|
-
import {ProTable} from "../../framework";
|
|
3
|
+
import {HttpUtils, Page, ProTable} from "../../framework";
|
|
4
4
|
|
|
5
5
|
export default class extends React.Component {
|
|
6
6
|
|
|
@@ -54,7 +54,8 @@ export default class extends React.Component {
|
|
|
54
54
|
]
|
|
55
55
|
|
|
56
56
|
render() {
|
|
57
|
-
return <
|
|
57
|
+
return <Page>
|
|
58
|
+
<Card variant={"borderless"}>
|
|
58
59
|
|
|
59
60
|
<Tabs defaultActiveKey="0" destroyOnClose
|
|
60
61
|
>
|
|
@@ -99,5 +100,6 @@ export default class extends React.Component {
|
|
|
99
100
|
</Tabs>
|
|
100
101
|
|
|
101
102
|
</Card>
|
|
103
|
+
</Page>
|
|
102
104
|
}
|
|
103
105
|
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// @ts-ignore
|
|
2
|
-
import React from "react";
|
|
3
|
-
|
|
4
|
-
declare type PageRenderProps = {
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 路径 如 /flowable/task/form
|
|
8
|
-
*/
|
|
9
|
-
pathname: string;
|
|
10
|
-
/***
|
|
11
|
-
* 搜索参数 如 /?id=1
|
|
12
|
-
*/
|
|
13
|
-
search?:string;
|
|
14
|
-
|
|
15
|
-
/***
|
|
16
|
-
* 是否把location信息透传到真正页面
|
|
17
|
-
*/
|
|
18
|
-
passLocation?: boolean
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export class PageRender extends React.Component<PageRenderProps, any> {
|
|
22
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import {matchRoutes, useAppData} from "umi";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import {Result} from "antd";
|
|
4
|
-
import {UrlUtils} from "../framework";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 通过指定 pathname 渲染页面
|
|
8
|
-
* @param props
|
|
9
|
-
* 为了规范,接收参数何router保持一致,
|
|
10
|
-
* pathname: 路径 如 /flowable/task/form
|
|
11
|
-
* search:搜索参数 如 /?id=1
|
|
12
|
-
*
|
|
13
|
-
* passLocation: 是否把location信息透传到真正页面
|
|
14
|
-
*
|
|
15
|
-
* @returns {React.JSX.Element|*}
|
|
16
|
-
* @constructor
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
let APP_DATA_CACHE = null
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* 写函数组件主要为了使用hooks
|
|
24
|
-
* @param props
|
|
25
|
-
* @returns {Element}
|
|
26
|
-
* @constructor
|
|
27
|
-
*/
|
|
28
|
-
export function PageRender(props) {
|
|
29
|
-
const {pathname, search, passLocation} = props
|
|
30
|
-
|
|
31
|
-
let appData = useAppData()
|
|
32
|
-
if(Object.keys(appData).length === 0){
|
|
33
|
-
appData = APP_DATA_CACHE
|
|
34
|
-
}else {
|
|
35
|
-
APP_DATA_CACHE = appData;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return <_PageRender appData={appData} pathname={pathname} search={search}
|
|
39
|
-
passLocation={passLocation}/>
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
class _PageRender extends React.Component {
|
|
43
|
-
|
|
44
|
-
render() {
|
|
45
|
-
if (this.props.passLocation) {
|
|
46
|
-
return this.passLocationRender()
|
|
47
|
-
}
|
|
48
|
-
return this.defaultRender()
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
passLocationRender = () => {
|
|
52
|
-
const {pathname, search, appData} = this.props
|
|
53
|
-
|
|
54
|
-
const map = appData.routeComponents
|
|
55
|
-
const key = pathname.substring(1); // 移除第一个斜杠
|
|
56
|
-
const componentType = map[key] || map[key + '/index']
|
|
57
|
-
if (componentType) {
|
|
58
|
-
const params =search ? UrlUtils.getParams(search): {}
|
|
59
|
-
const location = {pathname, search, params}
|
|
60
|
-
return React.createElement(componentType, {location});
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
defaultRender = () => {
|
|
66
|
-
const {pathname, appData} = this.props
|
|
67
|
-
const matchArr = matchRoutes(appData.clientRoutes, pathname)
|
|
68
|
-
|
|
69
|
-
if (matchArr != null) {
|
|
70
|
-
if (pathname === '/') {
|
|
71
|
-
// 匹配结果为1,表示未定义index.jsx ,导致死循环
|
|
72
|
-
if (matchArr.length === 1) { // 如果项目中没有定义index.jsx
|
|
73
|
-
return <Result icon={null} title='未定义首页'></Result>
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
// 取最匹配的那个
|
|
77
|
-
const mathResult = matchArr[matchArr.length - 1].route
|
|
78
|
-
if(mathResult){
|
|
79
|
-
return mathResult.element;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// 如果实在找不到页面组件,则404
|
|
84
|
-
return <Result
|
|
85
|
-
status={404}
|
|
86
|
-
title='页面不存在!'
|
|
87
|
-
subTitle={<div>路由地址:{pathname}</div>}
|
|
88
|
-
/>
|
|
89
|
-
};
|
|
90
|
-
}
|