@jiangood/open-admin 2.0.1 → 2.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/config/config.js +9 -14
  2. package/package.json +5 -1
  3. package/src/.umi-production/appData.json +75 -90
  4. package/src/.umi-production/umi.ts +2 -2
  5. package/src/framework/components/Page/index.less +1 -1
  6. package/src/framework/components/Page/index.tsx +19 -22
  7. package/src/framework/fields/FieldEditor/index.tsx +3 -2
  8. package/src/framework/fields/FieldUploadFile/index.tsx +8 -4
  9. package/src/framework/utils/MessageUtils.tsx +21 -99
  10. package/src/framework/utils/system/HttpUtils.ts +2 -1
  11. package/src/framework/utils/system/SysUtils.ts +8 -0
  12. package/src/layouts/PageRender.d.ts +2 -17
  13. package/src/layouts/PageRender.jsx +14 -76
  14. package/src/layouts/admin/TabPageRender.jsx +138 -158
  15. package/src/layouts/admin/index.jsx +120 -17
  16. package/src/layouts/admin/index.less +123 -5
  17. package/src/layouts/index.jsx +78 -161
  18. package/src/pages/404.jsx +7 -5
  19. package/src/pages/about.jsx +3 -3
  20. package/src/pages/index.jsx +4 -5
  21. package/src/pages/login.jsx +16 -9
  22. package/src/pages/login.less +0 -1
  23. package/src/pages/system/dict/index.jsx +7 -10
  24. package/src/pages/system/file/index.jsx +5 -5
  25. package/src/pages/system/job/index.jsx +9 -7
  26. package/src/pages/system/log/index.jsx +4 -5
  27. package/src/pages/system/manual/index.jsx +6 -4
  28. package/src/pages/system/org/index.jsx +4 -2
  29. package/src/pages/system/role/index.jsx +9 -7
  30. package/src/pages/system/role/perm.jsx +3 -4
  31. package/src/pages/system/user/index.jsx +8 -6
  32. package/src/pages/userCenter/index.jsx +1 -1
  33. package/src/pages/userCenter/message.jsx +4 -2
@@ -1,185 +1,102 @@
1
- import React from "react";
2
- import {ConfigProvider} from "antd";
1
+ import React, {useState, useEffect, useRef} from "react";
2
+ import {App, ConfigProvider} from "antd";
3
3
  import zhCN from 'antd/locale/zh_CN';
4
4
  import dayjs from 'dayjs';
5
5
  import 'dayjs/locale/zh-cn';
6
- import {Outlet, withRouter} from "umi";
6
+ import {Outlet, useLocation} from "umi";
7
7
 
8
8
  import AdminLayout from "./admin"
9
- import {
10
- ArrayUtils,
11
- HttpUtils,
12
- MessageHolder,
13
- PageLoading,
14
- PageUtils, StringUtils,
15
- SysUtils,
16
- ThemeUtils,
17
- } from "../framework";
18
- import {Logger} from "../framework/utils/Logger";
9
+ import {HttpUtils, PageLoading, PageUtils, SysUtils, ThemeUtils} from "../framework";
19
10
 
20
11
  import '../style/global.less'
21
12
  import './index.less'
22
13
 
23
14
  dayjs.locale('zh-cn');
24
15
 
25
- // 不需要登录的页面
26
- const SIMPLE_URLS = ['/login', '/test']
16
+ // 不需要登录和布局的页面
17
+ const PUBLIC_PAGES = ['/login', '/test']
27
18
 
28
- function checkIsSimplePage(pathname) {
29
- if(pathname === '/' || pathname === '/index'){
30
- return false;
31
- }
32
- // 测试页面
33
- if(pathname.startsWith("/test/")){
34
- return true
35
- }
36
- return ArrayUtils.contains(SIMPLE_URLS, pathname) ;
19
+ function isPublicPage(pathname, search) {
20
+ if (pathname === '/' || pathname === '/index') return false;
21
+ if (pathname.startsWith("/test/")) return true;
22
+ if (PUBLIC_PAGES.includes(pathname)) return true;
23
+ if (search && new URLSearchParams(search).has('_noLayout')) return true;
24
+ return false;
37
25
  }
38
26
 
39
- function checkIsPurePage(pathname){
40
- if(pathname.startsWith("/test/")){
41
- return true
42
- }
43
- return false
27
+ const configProps = {
28
+ input: {autoComplete: 'off'},
29
+ form: {validateMessages: {required: '必填项'}, colon: false},
30
+ button: {autoInsertSpace: false},
31
+ locale: zhCN,
32
+ theme: {
33
+ token: {
34
+ colorPrimary: ThemeUtils.getColor("primary-color"),
35
+ colorSuccess: ThemeUtils.getColor("success-color"),
36
+ colorWarning: ThemeUtils.getColor("warning-color"),
37
+ colorError: ThemeUtils.getColor("error-color"),
38
+ borderRadius: 4,
39
+ },
40
+ components: {
41
+ Menu: {
42
+ darkItemBg: ThemeUtils.getColor("primary-color"),
43
+ darkPopupBg: ThemeUtils.getColor("primary-color"),
44
+ darkItemSelectedBg: ThemeUtils.getColor("primary-color-click"),
45
+ darkItemHoverBg: ThemeUtils.getColor("primary-color-hover"),
46
+ darkSubMenuItemBg: ThemeUtils.getColor("primary-color"),
47
+ },
48
+ Layout: {
49
+ siderBg: ThemeUtils.getColor("primary-color"),
50
+ triggerBg: ThemeUtils.getColor("primary-color-click"),
51
+ headerBg: 'white',
52
+ triggerHeight: 32,
53
+ },
54
+ },
55
+ },
56
+ };
57
+
58
+ function initApp() {
59
+ return Promise.all([
60
+ HttpUtils.get("/admin/public/site-info"),
61
+ HttpUtils.get('/admin/public/check-login'),
62
+ ]).then(([siteInfo, loginRs]) => {
63
+ SysUtils.setSiteInfo(siteInfo);
64
+ const {needUpdatePwd, dictInfo, loginInfo} = loginRs;
65
+ SysUtils.setDictInfo(dictInfo);
66
+ SysUtils.setLoginInfo(loginInfo);
67
+ if (needUpdatePwd) {
68
+ PageUtils.open('/userCenter/ChangePassword', '修改密码');
69
+ return false;
70
+ }
71
+ return true;
72
+ }).catch(() => {
73
+ PageUtils.redirectToLogin();
74
+ return false;
75
+ });
44
76
  }
45
77
 
46
- class _Layouts extends React.Component {
78
+ export function Layouts() {
79
+ const {pathname, search} = useLocation();
80
+ const [ready, setReady] = useState(false);
81
+ const loadedRef = useRef(false);
47
82
 
48
- log = Logger.getLogger('Layouts')
83
+ useEffect(() => {
84
+ if (isPublicPage(pathname)) return;
85
+ if (loadedRef.current) return;
86
+ loadedRef.current = true;
87
+ initApp().then(ok => { if (ok) setReady(true); });
88
+ }, [pathname]);
49
89
 
50
- state = {
51
- messageHolderInit:false,
52
- siteInfoLoading: true,
53
- loginInfoFinish: false
90
+ if (isPublicPage(pathname, search)) {
91
+ return <ConfigProvider {...configProps}><App><Outlet/></App></ConfigProvider>;
54
92
  }
55
93
 
56
- onMessageHolderFinish = () => {
57
- this.loadSiteInfo()
58
- this.setState({messageHolderInit:true});
94
+ if (!ready) {
95
+ return <ConfigProvider {...configProps}><App><PageLoading message='加载中...'/></App></ConfigProvider>;
59
96
  }
60
97
 
61
-
62
- loadSiteInfo = () => {
63
- HttpUtils.get("/admin/public/site-info").then(rs => {
64
- SysUtils.setSiteInfo(rs)
65
- this.setState({siteInfoLoading: false})
66
- this.loadLoginInfo()
67
- })
68
- };
69
-
70
- componentDidUpdate(prevProps, prevState, snapshot) {
71
- const pre = prevProps.location.pathname
72
- const cur = this.props.location.pathname
73
- if (pre !== cur) {
74
- this.loadLoginInfo()
75
- }
76
- }
77
-
78
-
79
-
80
- loadLoginInfo = () => {
81
- const {pathname} = this.props.location;
82
- if (checkIsPurePage(pathname) || checkIsSimplePage(pathname) || this.state.loginInfoFinish) {
83
- return;
84
- }
85
-
86
- HttpUtils.get('/admin/public/check-login')
87
- .then(rs => {
88
- const {needUpdatePwd, dictInfo, loginInfo} = rs
89
- SysUtils.setDictInfo(dictInfo)
90
- SysUtils.setLoginInfo(loginInfo)
91
- if (!needUpdatePwd) {
92
- this.setState({loginInfoFinish: true});
93
- return;
94
- }
95
-
96
- if (needUpdatePwd) {
97
- PageUtils.open('/userCenter/ChangePassword', '修改密码')
98
- return;
99
- }
100
- })
101
- .catch(async () => {
102
- PageUtils.redirectToLogin()
103
- })
104
- }
105
-
106
- render() {
107
- return <ConfigProvider
108
- input={{autoComplete: 'off'}}
109
- form={{
110
- validateMessages: {
111
- required: '必填项'
112
- }, colon: false
113
- }}
114
- button={{
115
- autoInsertSpace: false
116
- }}
117
- locale={zhCN}
118
- theme={{
119
- token: {
120
- colorPrimary: ThemeUtils.getColor("primary-color"),
121
- colorSuccess: ThemeUtils.getColor("success-color"),
122
- colorWarning: ThemeUtils.getColor("warning-color"),
123
- colorError: ThemeUtils.getColor("error-color"),
124
- borderRadius: 4,
125
- },
126
- components: {
127
- Menu: {
128
- darkItemBg: ThemeUtils.getColor("primary-color"),
129
- darkPopupBg: ThemeUtils.getColor("primary-color"),
130
- darkItemSelectedBg: ThemeUtils.getColor("primary-color-click"),
131
- darkItemHoverBg: ThemeUtils.getColor("primary-color-hover"),
132
- darkSubMenuItemBg: ThemeUtils.getColor("primary-color")
133
- },
134
- Layout: {
135
- siderBg: ThemeUtils.getColor("primary-color"),
136
- triggerBg: ThemeUtils.getColor("primary-color-click"),
137
- headerBg: 'white',
138
- triggerHeight: 32
139
- }
140
- }
141
- }}>
142
-
143
- <MessageHolder onFinish={this.onMessageHolderFinish} />
144
- {this.renderContent()}
145
- </ConfigProvider>
146
- }
147
-
148
-
149
- renderContent = () => {
150
- const {pathname} = this.props.location;
151
-
152
- if(checkIsPurePage(pathname)){
153
- return <Outlet/>
154
- }
155
-
156
- if(!this.state.messageHolderInit) {
157
- this.log.info('加载message holder...')
158
- return <PageLoading message='加载消息组件...'/>
159
- }
160
-
161
- const {params = {}} = this.props.location;
162
- if (checkIsSimplePage(pathname) || params.hasOwnProperty('_noLayout')) {
163
- return <Outlet/>
164
- }
165
-
166
-
167
-
168
- if (this.state.siteInfoLoading) {
169
- return <PageLoading message='加载站点信息...'/>
170
- }
171
-
172
-
173
-
174
- if (!this.state.loginInfoFinish) {
175
- return <PageLoading message='加载登录信息...'/>
176
- }
177
-
178
- return <AdminLayout path={this.state.path} logo={this.props.logo}/>
179
- };
98
+ return <ConfigProvider {...configProps}><App><AdminLayout/></App></ConfigProvider>;
180
99
  }
181
100
 
182
-
183
- export const Layouts = withRouter(_Layouts);
184
- export default Layouts
185
- export * from './PageRender'
101
+ export default Layouts;
102
+ export * from './PageRender'
package/src/pages/404.jsx CHANGED
@@ -1,13 +1,15 @@
1
1
  import React from "react";
2
2
  import {Result} from "antd";
3
+ import {Page} from "../framework";
3
4
 
4
5
  export default class extends React.Component {
5
6
 
6
7
  render() {
7
- return <Result
8
- status={404}
9
- title='页面不存在'
10
- />
11
-
8
+ return <Page>
9
+ <Result
10
+ status={404}
11
+ title='页面不存在'
12
+ />
13
+ </Page>
12
14
  }
13
15
  }
@@ -1,12 +1,12 @@
1
1
  import React from "react";
2
+ import {Page} from "../framework";
2
3
 
3
4
  export default class extends React.Component {
4
5
 
5
6
 
6
7
  render() {
7
- return <>
8
+ return <Page>
8
9
  <h1>关于</h1>
9
- </>
10
-
10
+ </Page>
11
11
  }
12
12
  }
@@ -1,10 +1,9 @@
1
1
  import React from "react";
2
2
  import {Card} from "antd";
3
-
3
+ import {Page} from "../framework";
4
4
 
5
5
  export default function () {
6
-
7
- return <Card>
8
- 欢迎使用本系统
9
- </Card>
6
+ return <Page>
7
+ <Card>欢迎使用本系统</Card>
8
+ </Page>
10
9
  }
@@ -38,14 +38,19 @@ export default class extends React.Component {
38
38
  }
39
39
 
40
40
  async componentDidMount() {
41
- if (localStorage.length === 0) {
42
- MessageUtils.alert('站点数据缺失,刷新当前页面...')
43
- window.location.reload()
41
+ const siteInfo = SysUtils.getSiteInfo()
42
+ if (siteInfo && siteInfo.rsaPublicKey) {
43
+ this.setState({siteInfo})
44
44
  return
45
45
  }
46
-
47
- const siteInfo = SysUtils.getSiteInfo()
48
- this.setState({siteInfo})
46
+ // localStorage 中无站点信息,从服务端重新加载
47
+ try {
48
+ const rs = await HttpUtils.get('/admin/public/site-info')
49
+ SysUtils.setSiteInfo(rs)
50
+ this.setState({siteInfo: rs})
51
+ } catch (e) {
52
+ message.error('加载站点信息失败,请刷新页面重试')
53
+ }
49
54
  }
50
55
 
51
56
  submit = values => {
@@ -69,9 +74,11 @@ export default class extends React.Component {
69
74
  render() {
70
75
  const {siteInfo} = this.state
71
76
 
72
- const pageStyle = {}
77
+ const pageStyle = {
78
+ backgroundImage: `url("${SysUtils.contextPath('/admin/public/login_bg.jpg')}")`
79
+ }
73
80
  if (siteInfo.loginBackground) {
74
- const url = 'admin/sysFile/preview/' + siteInfo.loginBackground;
81
+ const url = SysUtils.contextPath('/admin/sysFile/preview/' + siteInfo.loginBackground);
75
82
  pageStyle.backgroundImage = 'url("' + url + '")'
76
83
  }
77
84
 
@@ -110,7 +117,7 @@ export default class extends React.Component {
110
117
  <Space style={{alignItems: 'center'}}>
111
118
  <Input size='large' placeholder='验证码' prefix={<SafetyCertificateOutlined/>}/>
112
119
  <img height={36} width={100}
113
- src={"/admin/auth/captcha-image?_random=" + this.state.random}
120
+ src={SysUtils.contextPath("/admin/auth/captcha-image?_random=" + this.state.random)}
114
121
  onClick={() => this.setState({random: Math.random()})}/>
115
122
  </Space>
116
123
  </Form.Item>
@@ -1,6 +1,5 @@
1
1
  .login-page {
2
2
  background-size: cover;
3
- background-image: url("/admin/public/login_bg.jpg");
4
3
  background-repeat: no-repeat;
5
4
  background-position: bottom;
6
5
 
@@ -33,7 +33,9 @@ export default class extends React.Component {
33
33
  }
34
34
 
35
35
  onFinish = values => {
36
- HttpUtils.post('admin/dict/save', values).then(rs => {
36
+ const isNew = !values.id;
37
+ const url = isNew ? 'admin/dict/create' : 'admin/dict/update';
38
+ HttpUtils.post(url, values).then(rs => {
37
39
  this.setState({formOpen: false})
38
40
  this.tableRef.current.reload()
39
41
  })
@@ -90,15 +92,11 @@ export default class extends React.Component {
90
92
  title: '操作',
91
93
  dataIndex: 'option',
92
94
  render: (_, record) => {
93
- if(!record.id){ // 非数据库定义的不让修改
94
- return
95
- }
96
-
97
95
  return (
98
96
  <ButtonList>
99
- <Button size='small' perm='sysDict:save'
97
+ <Button size='small' perm='sys-dict:update'
100
98
  onClick={() => this.handleEdit(record)}> 编辑 </Button>
101
- <Popconfirm perm='sysDict:delete' title='是否确定删除字典项'
99
+ <Popconfirm perm='sys-dict:delete' title='是否确定删除字典项'
102
100
  onConfirm={() => this.handleDelete(record)}>
103
101
  <Button size='small'>删除</Button>
104
102
  </Popconfirm>
@@ -109,13 +107,13 @@ export default class extends React.Component {
109
107
  ]
110
108
 
111
109
  render() {
112
- return <Page padding>
110
+ return <Page>
113
111
  <ProTable
114
112
  rowKey='uid'
115
113
  actionRef={this.tableRef}
116
114
  toolBarRender={() => {
117
115
  return <ButtonList>
118
- <Button perm='sysDict:save' type='primary' onClick={this.handleAdd} >
116
+ <Button perm='sys-dict:create' type='primary' onClick={this.handleAdd} >
119
117
  <PlusOutlined/> 新增
120
118
  </Button>
121
119
  </ButtonList>
@@ -126,7 +124,6 @@ export default class extends React.Component {
126
124
  }}
127
125
  columns={this.columns}
128
126
  showToolbarSearch={true}
129
- scrollY={500}
130
127
  />
131
128
  <Modal
132
129
  title='编辑数据字典项'
@@ -2,7 +2,7 @@ import React from 'react'
2
2
  import {Button, Form, Input, Modal, Popconfirm} from 'antd'
3
3
  import {CloudUploadOutlined} from "@ant-design/icons";
4
4
 
5
- import {ButtonList, FieldDateRange, FieldDictSelect, FieldUploadFile, HttpUtils, ProTable} from "../../../framework";
5
+ import {ButtonList, FieldDateRange, FieldDictSelect, FieldUploadFile, HttpUtils, Page, ProTable, SysUtils} from "../../../framework";
6
6
 
7
7
  export default class extends React.Component {
8
8
 
@@ -59,7 +59,7 @@ export default class extends React.Component {
59
59
  title: '预览',
60
60
  dataIndex: 'id',
61
61
  render(id, record) {
62
- const nodes = [<a href={'/admin/sysFile/preview/' + record.id} target='_blank'>预览</a>]
62
+ const nodes = [<a href={SysUtils.contextPath('/admin/sysFile/preview/' + record.id)} target='_blank'>预览</a>]
63
63
 
64
64
 
65
65
  if (record.imageUrls?.length > 0) {
@@ -79,7 +79,7 @@ export default class extends React.Component {
79
79
  dataIndex: 'option',
80
80
  render: (_, record) => (
81
81
  <ButtonList>
82
- <Popconfirm perm='sysFile:delete' title='是否确定删除文件信息'
82
+ <Popconfirm perm='sys-file:delete' title='是否确定删除文件信息'
83
83
  onConfirm={() => this.handleDelete(record)}>
84
84
  <a>删除</a>
85
85
  </Popconfirm>
@@ -89,7 +89,7 @@ export default class extends React.Component {
89
89
  ]
90
90
 
91
91
  render() {
92
- return <>
92
+ return <Page>
93
93
  <ProTable
94
94
  actionRef={this.tableRef}
95
95
  toolBarRender={() => {
@@ -140,7 +140,7 @@ export default class extends React.Component {
140
140
  </Form>
141
141
  </Modal>
142
142
 
143
- </>
143
+ </Page>
144
144
  }
145
145
  }
146
146
 
@@ -16,7 +16,7 @@ import {
16
16
  } from 'antd'
17
17
  import {PlusOutlined} from "@ant-design/icons";
18
18
 
19
- import {ButtonList, HttpUtils, Page, ProTable, StringUtils, ValueType} from "../../../framework";
19
+ import {ButtonList, HttpUtils, Page, ProTable, StringUtils, SysUtils, ValueType} from "../../../framework";
20
20
 
21
21
 
22
22
  const cronOptions = [
@@ -85,7 +85,9 @@ export default class extends React.Component {
85
85
  }
86
86
 
87
87
  onFinish = (values) => {
88
- HttpUtils.post('admin/job/save', values).then(rs => {
88
+ const isNew = !values.id;
89
+ const url = isNew ? 'admin/job/create' : 'admin/job/update';
90
+ HttpUtils.post(url, values).then(rs => {
89
91
  this.setState({formOpen: false})
90
92
  this.tableRef.current.reload();
91
93
  })
@@ -149,9 +151,9 @@ export default class extends React.Component {
149
151
  return (
150
152
  <Space>
151
153
  <Button size='small' onClick={() => this.showExecuteRecord(record)}>执行记录</Button>
152
- <Button size='small' onClick={() => this.handleTriggerJob(record)}>执行一次</Button>
153
- <Button size='small' onClick={() => this.handleEdit(record)}> 编辑 </Button>
154
- <Popconfirm title='是否确定删除?' onConfirm={() => this.handleDelete(record)}>
154
+ <Button size='small' perm='job:trigger' onClick={() => this.handleTriggerJob(record)}>执行一次</Button>
155
+ <Button size='small' perm='job:update' onClick={() => this.handleEdit(record)}> 编辑 </Button>
156
+ <Popconfirm perm='job:delete' title='是否确定删除?' onConfirm={() => this.handleDelete(record)}>
155
157
  <Button size='small'>删除</Button>
156
158
  </Popconfirm>
157
159
  </Space>
@@ -174,7 +176,7 @@ export default class extends React.Component {
174
176
 
175
177
 
176
178
  render() {
177
- return <Page padding>
179
+ return <Page>
178
180
  <ProTable
179
181
  actionRef={this.tableRef}
180
182
  toolBarRender={() => {
@@ -289,7 +291,7 @@ export default class extends React.Component {
289
291
  title: '操作',
290
292
  dataIndex: 'option',
291
293
  render: (_, record) => {
292
- const url = '/admin/sys/log/' + record.id;
294
+ const url = SysUtils.contextPath('/admin/sys/log/' + record.id);
293
295
  return <a href={url} target='_blank'>日志</a>;
294
296
  },
295
297
  }
@@ -1,6 +1,6 @@
1
- import React, {Fragment} from 'react';
1
+ import React from 'react';
2
2
  import {Form, Input, Tag} from "antd";
3
- import {ViewText, FieldDateRange, HttpUtils, ProTable} from "../../../framework";
3
+ import {ViewText, FieldDateRange, HttpUtils, Page, ProTable} from "../../../framework";
4
4
 
5
5
  export default class extends React.Component {
6
6
 
@@ -54,7 +54,7 @@ export default class extends React.Component {
54
54
 
55
55
 
56
56
  render() {
57
- return <>
57
+ return <Page>
58
58
  <ProTable
59
59
  request={(params) => HttpUtils.get('admin/sysLog/page', params)}
60
60
  columns={this.columns}
@@ -66,8 +66,7 @@ export default class extends React.Component {
66
66
  <FieldDateRange/>
67
67
  </Form.Item>
68
68
  </ProTable>
69
-
70
- </>
69
+ </Page>
71
70
  }
72
71
 
73
72
 
@@ -23,7 +23,9 @@ export default class extends React.Component {
23
23
  }
24
24
 
25
25
  onFinish = values => {
26
- HttpUtils.post('admin/sysManual/save', values).then(rs => {
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='sysManual:save' onClick={() => this.handleEdit(record)}>编辑</Button>
70
- <Popconfirm perm='sysManual:delete' title='是否确定删除操作手册'
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='sysManual:save' type='primary' onClick={this.handleAdd}>
88
+ <Button perm='sys-manual:create' type='primary' onClick={this.handleAdd}>
87
89
  <PlusOutlined/> 新增
88
90
  </Button>
89
91
  </ButtonList>
@@ -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
- HttpUtils.post('admin/sysOrg/save', values).then(rs => {
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 padding>
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
- HttpUtils.post('admin/sysRole/save', values).then(rs => {
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='sysRole:manage'
135
+ <Button size='small' perm='sys-role:grant-permission'
134
136
  onClick={() => this.handleEditUser(record)}>用户设置</Button>
135
137
 
136
- <Button size='small' perm='sysRole:manage' disabled={record.builtin}
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='sysRole:manage' disabled={record.builtin}
141
+ <Button size='small' perm='sys-role:update' disabled={record.builtin}
140
142
  onClick={() => this.handleEdit(record)}>编辑</Button>
141
- <Popconfirm perm='sysRole:manage' disabled={record.builtin} title='是否确定删除系统角色'
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 padding>
183
+ return <Page>
182
184
  <ProTable
183
185
  actionRef={this.tableRef}
184
186
  toolBarRender={() => {
185
187
  return <ButtonList>
186
- <Button perm='sysRole:manage' type='primary' onClick={this.handleAdd}>
188
+ <Button perm='sys-role:create' type='primary' onClick={this.handleAdd}>
187
189
  <PlusOutlined/> 新增
188
190
  </Button>
189
191
  </ButtonList>