@jiangood/open-admin 2.5.9 → 3.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/package.json +20 -8
- package/src/framework/GlobalData.ts +85 -0
- package/src/framework/biz/OrgTree.tsx +2 -7
- package/src/framework/biz/Perm.tsx +11 -0
- package/src/framework/biz/PermActions.tsx +18 -15
- package/src/framework/biz/index.tsx +34 -19
- package/src/framework/components/ContextMenu/index.tsx +105 -78
- package/src/framework/components/DownloadModal/index.tsx +15 -17
- package/src/framework/components/ErrorBoundary/index.tsx +2 -2
- package/src/framework/components/FormModal/index.tsx +76 -0
- package/src/framework/components/Gap/index.tsx +1 -1
- package/src/framework/components/NamedIcon/index.tsx +55 -9
- package/src/framework/components/Page/index.less +0 -1
- package/src/framework/components/Page/index.tsx +34 -27
- package/src/framework/components/PageLoading/index.less +15 -0
- package/src/framework/components/PageLoading/index.tsx +32 -16
- package/src/framework/components/ProTable/index.tsx +86 -15
- package/src/framework/components/index.ts +1 -0
- package/src/framework/config/index.ts +1 -0
- package/src/framework/config/themeConfig.ts +39 -0
- package/src/framework/fields/FieldBoolean/index.tsx +11 -2
- package/src/framework/fields/FieldDate/index.tsx +22 -7
- package/src/framework/fields/FieldDateRange/index.tsx +24 -6
- package/src/framework/fields/FieldDictSelect/index.tsx +1 -0
- package/src/framework/fields/FieldEditor/index.tsx +7 -1
- package/src/framework/fields/FieldNumberRange/index.tsx +14 -5
- package/src/framework/fields/FieldPercent/index.tsx +16 -5
- package/src/framework/fields/FieldRemoteSelect/index.tsx +4 -2
- package/src/framework/fields/FieldRemoteTreeSelect/index.tsx +2 -1
- package/src/framework/fields/FieldSysOrgTree/index.tsx +6 -1
- package/src/framework/fields/FieldSysOrgTreeSelect/index.tsx +6 -1
- package/src/framework/fields/FieldTable/index.tsx +35 -6
- package/src/framework/fields/FieldTableSelect/index.tsx +18 -2
- package/src/framework/fields/FieldUploadFile/index.tsx +69 -28
- package/src/framework/fields/index.ts +0 -1
- package/src/framework/index.ts +2 -0
- package/src/framework/router/Link.tsx +26 -0
- package/src/framework/router/PageFrame.tsx +31 -0
- package/src/framework/router/history.ts +50 -0
- package/src/framework/router/index.ts +4 -0
- package/src/framework/router/matcher.ts +58 -0
- package/src/framework/utils/{ArrayUtils.js → ArrayUtils.ts} +5 -5
- package/src/framework/utils/{DateUtils.js → DateUtils.ts} +19 -19
- package/src/framework/utils/{DeviceUtils.js → DeviceUtils.ts} +8 -1
- package/src/framework/utils/{EventBus.js → EventBus.ts} +13 -6
- package/src/framework/utils/MessageApi.ts +5 -0
- package/src/framework/utils/ModalApi.ts +5 -0
- package/src/framework/utils/ObjectUtils.ts +15 -0
- package/src/framework/utils/{StorageUtils.js → StorageUtils.ts} +7 -7
- package/src/framework/utils/{StringUtils.js → StringUtils.ts} +15 -15
- package/src/framework/utils/{TreeUtils.js → TreeUtils.ts} +19 -12
- package/src/framework/utils/{UrlUtils.js → UrlUtils.ts} +10 -10
- package/src/framework/utils/index.ts +2 -1
- package/src/framework/utils/system/{DictUtils.js → DictUtils.ts} +16 -4
- package/src/framework/utils/system/{HttpUtils.js → HttpUtils.ts} +25 -21
- package/src/framework/utils/system/PageUtils.ts +49 -0
- package/src/framework/utils/system/{PermUtils.js → PermUtils.ts} +5 -6
- package/src/framework/utils/system/index.ts +0 -2
- package/src/framework/views/ViewBoolean/index.tsx +6 -3
- package/src/framework/views/ViewFileButton/index.tsx +13 -8
- package/src/framework/views/ViewImage/index.tsx +19 -14
- package/src/framework/views/ViewRange/index.tsx +10 -7
- package/src/framework/views/ViewText/index.tsx +9 -11
- package/src/layouts/admin/AdminTabs.jsx +79 -0
- package/src/layouts/admin/AdminTabs.less +63 -0
- package/src/layouts/admin/HeaderRight.jsx +27 -13
- package/src/layouts/admin/TabLayout.jsx +124 -0
- package/src/layouts/admin/index.jsx +5 -6
- package/src/layouts/admin/index.less +1 -82
- package/src/layouts/index.tsx +148 -0
- package/src/main.jsx +8 -0
- package/src/pages/account/changePassword.jsx +14 -10
- package/src/pages/article/$code.jsx +2 -2
- package/src/pages/index.jsx +6 -4
- package/src/pages/{login.jsx → public/login.jsx} +7 -10
- package/src/pages/public/test.jsx +30 -0
- package/src/pages/{forceUpdatePwd.jsx → standalone/forceUpdatePwd.jsx} +3 -24
- package/src/pages/system/article/index.jsx +51 -56
- package/src/pages/system/dict/index.jsx +60 -91
- package/src/pages/system/file/index.jsx +23 -17
- package/src/pages/system/job/index.jsx +63 -72
- package/src/pages/system/log/index.jsx +11 -8
- package/src/pages/system/org/index.jsx +60 -80
- package/src/pages/system/role/index.jsx +50 -86
- package/src/pages/system/role/rolePerm.jsx +2 -2
- package/src/pages/system/user/index.jsx +120 -73
- package/src/pages/system/user/userPerm.jsx +2 -2
- package/vite-plugin/index.js +107 -0
- package/config/common-plugin.js +0 -145
- package/config/config.js +0 -5
- package/config/utils.js +0 -73
- package/src/.umi-production/appData.json +0 -2257
- package/src/.umi-production/core/EmptyRoute.tsx +0 -9
- package/src/.umi-production/core/defineApp.ts +0 -16
- package/src/.umi-production/core/helmet.ts +0 -10
- package/src/.umi-production/core/helmetContext.ts +0 -4
- package/src/.umi-production/core/history.ts +0 -72
- package/src/.umi-production/core/historyIntelli.ts +0 -132
- package/src/.umi-production/core/plugin.ts +0 -40
- package/src/.umi-production/core/pluginConfig.ts +0 -330
- package/src/.umi-production/core/pluginConfigJoi.d.ts +0 -7
- package/src/.umi-production/core/polyfill.ts +0 -220
- package/src/.umi-production/core/route.tsx +0 -47
- package/src/.umi-production/core/routeProps.js +0 -5
- package/src/.umi-production/core/routeProps.ts +0 -6
- package/src/.umi-production/core/terminal.ts +0 -37
- package/src/.umi-production/exports.ts +0 -17
- package/src/.umi-production/testBrowser.tsx +0 -90
- package/src/.umi-production/tsconfig.json +0 -43
- package/src/.umi-production/typings.d.ts +0 -136
- package/src/.umi-production/umi.ts +0 -83
- package/src/framework/GlobalData.d.ts +0 -10
- package/src/framework/GlobalData.js +0 -42
- package/src/framework/biz/HasPerm.tsx +0 -14
- package/src/framework/fields/FieldRemoteSelectMultiple/index.tsx +0 -29
- package/src/framework/utils/ArrayUtils.d.ts +0 -6
- package/src/framework/utils/DateUtils.d.ts +0 -20
- package/src/framework/utils/DeviceUtils.d.ts +0 -3
- package/src/framework/utils/EventBus.d.ts +0 -6
- package/src/framework/utils/MessageUtils.d.ts +0 -10
- package/src/framework/utils/MessageUtils.js +0 -43
- package/src/framework/utils/ObjectUtils.d.ts +0 -14
- package/src/framework/utils/ObjectUtils.js +0 -12
- package/src/framework/utils/StorageUtils.d.ts +0 -4
- package/src/framework/utils/StringUtils.d.ts +0 -17
- package/src/framework/utils/TreeUtils.d.ts +0 -13
- package/src/framework/utils/UrlUtils.d.ts +0 -6
- package/src/framework/utils/system/DictUtils.d.ts +0 -20
- package/src/framework/utils/system/FormRegistry.d.ts +0 -8
- package/src/framework/utils/system/FormRegistry.js +0 -31
- package/src/framework/utils/system/HttpUtils.d.ts +0 -14
- package/src/framework/utils/system/PageUtils.d.ts +0 -14
- package/src/framework/utils/system/PageUtils.js +0 -59
- package/src/framework/utils/system/PermUtils.d.ts +0 -5
- package/src/framework/utils/system/ThemeUtils.d.ts +0 -6
- package/src/framework/utils/system/ThemeUtils.js +0 -52
- package/src/layouts/PageRender.tsx +0 -29
- package/src/layouts/admin/TabPageRender.jsx +0 -210
- package/src/layouts/index.jsx +0 -120
- package/src/loading.jsx +0 -19
- package/src/pages/about.jsx +0 -16
- /package/src/pages/{login.less → public/login.less} +0 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {DeleteOutlined, EditOutlined, PlusOutlined, SettingOutlined, SyncOutlined} from '@ant-design/icons';
|
|
2
|
-
import {Button, Card, Checkbox, Descriptions, Form, Input, InputNumber,
|
|
2
|
+
import {Button, Card, Checkbox, Descriptions, Form, Input, InputNumber, Popconfirm, Popover, Space, Spin, Splitter, Switch, Tree, Typography} from 'antd';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import {
|
|
5
5
|
FieldBoolean,
|
|
6
6
|
FieldDictSelect,
|
|
7
7
|
FieldRemoteTreeSelect,
|
|
8
8
|
FieldUserSelect,
|
|
9
|
+
FormModal, Gap,
|
|
9
10
|
HttpUtils,
|
|
10
11
|
NamedIcon,
|
|
11
12
|
Page,
|
|
@@ -24,12 +25,8 @@ export default class extends React.Component {
|
|
|
24
25
|
treeData: [],
|
|
25
26
|
treeLoading: false,
|
|
26
27
|
draggable: false,
|
|
27
|
-
|
|
28
|
-
modalOpen: false,
|
|
29
|
-
modalValues: {},
|
|
30
|
-
modalLoading: false,
|
|
31
28
|
}
|
|
32
|
-
|
|
29
|
+
modalRef = React.createRef();
|
|
33
30
|
treeRef = React.createRef();
|
|
34
31
|
|
|
35
32
|
componentDidMount() {
|
|
@@ -66,29 +63,18 @@ export default class extends React.Component {
|
|
|
66
63
|
|
|
67
64
|
handleAdd = () => {
|
|
68
65
|
const {selectedOrg} = this.state
|
|
69
|
-
this.
|
|
70
|
-
modalOpen: true,
|
|
71
|
-
modalValues: {pid: selectedOrg?.id, enabled: true},
|
|
72
|
-
})
|
|
66
|
+
this.modalRef.current.open({pid: selectedOrg?.id, enabled: true})
|
|
73
67
|
}
|
|
74
68
|
|
|
75
69
|
handleEdit = () => {
|
|
76
|
-
this.
|
|
77
|
-
modalOpen: true,
|
|
78
|
-
modalValues: {...this.state.selectedOrg},
|
|
79
|
-
})
|
|
70
|
+
this.modalRef.current.open({...this.state.selectedOrg})
|
|
80
71
|
}
|
|
81
72
|
|
|
82
|
-
handleModalFinish =
|
|
83
|
-
this.setState({modalLoading: true})
|
|
73
|
+
handleModalFinish = async values => {
|
|
84
74
|
const isNew = !values.id
|
|
85
75
|
const url = isNew ? 'admin/sysOrg/create' : 'admin/sysOrg/update'
|
|
86
|
-
HttpUtils.post(url, values)
|
|
87
|
-
|
|
88
|
-
this.loadTree()
|
|
89
|
-
}).finally(() => {
|
|
90
|
-
this.setState({modalLoading: false})
|
|
91
|
-
})
|
|
76
|
+
await HttpUtils.post(url, values)
|
|
77
|
+
this.loadTree()
|
|
92
78
|
}
|
|
93
79
|
|
|
94
80
|
onDraggableChange = e => {
|
|
@@ -99,14 +85,14 @@ export default class extends React.Component {
|
|
|
99
85
|
const {selectedOrg} = this.state
|
|
100
86
|
const params = this.state.params
|
|
101
87
|
|
|
102
|
-
return <Page title="组织机构" description="管理组织机构树"
|
|
103
|
-
|
|
88
|
+
return <Page title="组织机构" description="管理组织机构树" actions={
|
|
89
|
+
<Button type='primary' perm='sys-org:create' icon={<PlusOutlined/>} onClick={this.handleAdd}>新增</Button>
|
|
90
|
+
}>
|
|
104
91
|
<Splitter>
|
|
105
92
|
<Splitter.Panel defaultSize={400} style={{paddingRight: 8}}>
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
<div style={{display: 'flex', alignItems: 'center', gap: 4, marginBottom: 8}}>
|
|
93
|
+
|
|
94
|
+
<Card size='small' >
|
|
95
|
+
<div style={{display: 'flex', alignItems: 'center', gap: 4}}>
|
|
110
96
|
<Input.Search placeholder='搜索' value={params.searchText} onChange={e => {
|
|
111
97
|
params.searchText = e.target.value
|
|
112
98
|
this.setState({params}, this.loadTree)
|
|
@@ -115,7 +101,7 @@ export default class extends React.Component {
|
|
|
115
101
|
trigger='click'
|
|
116
102
|
placement='bottomRight'
|
|
117
103
|
title='设置'
|
|
118
|
-
content={<Space
|
|
104
|
+
content={<Space orientation='vertical'>
|
|
119
105
|
<Checkbox checked={params.onlyShowEnabled}
|
|
120
106
|
onChange={e => {
|
|
121
107
|
params.onlyShowEnabled = e.target.checked;
|
|
@@ -137,17 +123,20 @@ export default class extends React.Component {
|
|
|
137
123
|
<Button type='text' size='small' icon={<SettingOutlined/>}/>
|
|
138
124
|
</Popover>
|
|
139
125
|
</div>
|
|
140
|
-
<
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
126
|
+
<Gap />
|
|
127
|
+
<Spin spinning={this.state.treeLoading}>
|
|
128
|
+
<Tree ref={this.treeRef}
|
|
129
|
+
treeData={this.state.treeData}
|
|
130
|
+
onSelect={this.onSelect}
|
|
131
|
+
showIcon
|
|
132
|
+
blockNode
|
|
133
|
+
icon={item => <NamedIcon name={item.data.iconName}/>}
|
|
134
|
+
draggable={this.state.draggable}
|
|
135
|
+
onDrop={this.onDrop}
|
|
136
|
+
showLine
|
|
137
|
+
defaultExpandAll
|
|
138
|
+
/>
|
|
139
|
+
</Spin>
|
|
151
140
|
</Card>
|
|
152
141
|
</Splitter.Panel>
|
|
153
142
|
|
|
@@ -183,46 +172,37 @@ export default class extends React.Component {
|
|
|
183
172
|
</Splitter.Panel>
|
|
184
173
|
</Splitter>
|
|
185
174
|
|
|
186
|
-
<
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
<Form
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
>
|
|
196
|
-
<
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
</Form.Item>
|
|
218
|
-
<Form.Item label='扩展字段2' name='extra2'>
|
|
219
|
-
<Input/>
|
|
220
|
-
</Form.Item>
|
|
221
|
-
<Form.Item label='扩展字段3' name='extra3'>
|
|
222
|
-
<Input/>
|
|
223
|
-
</Form.Item>
|
|
224
|
-
</Form>
|
|
225
|
-
</Modal>
|
|
175
|
+
<FormModal ref={this.modalRef} title='编辑组织机构'
|
|
176
|
+
onFinish={this.handleModalFinish}
|
|
177
|
+
labelCol={{flex: '120px'}}>
|
|
178
|
+
<Form.Item label='父节点' name='pid'>
|
|
179
|
+
<FieldRemoteTreeSelect url='admin/sysOrg/tree'/>
|
|
180
|
+
</Form.Item>
|
|
181
|
+
<Form.Item label='名称' name='name' rules={[{required: true}]}>
|
|
182
|
+
<Input/>
|
|
183
|
+
</Form.Item>
|
|
184
|
+
<Form.Item label='序号' name='seq'>
|
|
185
|
+
<InputNumber/>
|
|
186
|
+
</Form.Item>
|
|
187
|
+
<Form.Item label='类型' name='type' rules={[{required: true}]}>
|
|
188
|
+
<FieldDictSelect typeCode='orgType'/>
|
|
189
|
+
</Form.Item>
|
|
190
|
+
<Form.Item label='部门领导' name={['leader', 'id']}>
|
|
191
|
+
<FieldUserSelect/>
|
|
192
|
+
</Form.Item>
|
|
193
|
+
<Form.Item label='启用' name='enabled' rules={[{required: true}]}>
|
|
194
|
+
<FieldBoolean/>
|
|
195
|
+
</Form.Item>
|
|
196
|
+
<Form.Item label='扩展字段1' name='extra1'>
|
|
197
|
+
<Input/>
|
|
198
|
+
</Form.Item>
|
|
199
|
+
<Form.Item label='扩展字段2' name='extra2'>
|
|
200
|
+
<Input/>
|
|
201
|
+
</Form.Item>
|
|
202
|
+
<Form.Item label='扩展字段3' name='extra3'>
|
|
203
|
+
<Input/>
|
|
204
|
+
</Form.Item>
|
|
205
|
+
</FormModal>
|
|
226
206
|
</Page>
|
|
227
207
|
}
|
|
228
208
|
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import {PlusOutlined} from '@ant-design/icons'
|
|
2
2
|
import {Button, Form, Input, InputNumber, Modal, Popconfirm, Select, Transfer, Tree} from 'antd'
|
|
3
3
|
import React from 'react'
|
|
4
|
-
import {
|
|
4
|
+
import {FieldBoolean, FormModal, HttpUtils, Page, PageUtils, PermActions, ProTable, ViewText} from "../../../framework";
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
export default class extends React.Component {
|
|
8
8
|
|
|
9
9
|
state = {
|
|
10
|
-
formValues: {},
|
|
11
|
-
formOpen: false,
|
|
12
|
-
|
|
13
10
|
usersModalOpen: false,
|
|
14
|
-
|
|
11
|
+
selectedRecord: null,
|
|
15
12
|
|
|
16
13
|
userList: [],
|
|
17
14
|
targetKeys: [],
|
|
@@ -24,33 +21,29 @@ export default class extends React.Component {
|
|
|
24
21
|
menuHalfChecked: []
|
|
25
22
|
}
|
|
26
23
|
|
|
27
|
-
|
|
24
|
+
modalRef = React.createRef()
|
|
28
25
|
tableRef = React.createRef()
|
|
29
26
|
|
|
30
27
|
handleAdd = () => {
|
|
31
|
-
this.
|
|
28
|
+
this.modalRef.current.open({})
|
|
32
29
|
}
|
|
33
30
|
|
|
34
31
|
handleEdit = record => {
|
|
35
|
-
this.
|
|
36
|
-
|
|
37
|
-
})
|
|
32
|
+
this.modalRef.current.open(record)
|
|
38
33
|
}
|
|
39
34
|
|
|
40
35
|
handleEditUser = record => {
|
|
41
|
-
this.setState({usersModalOpen: true,
|
|
36
|
+
this.setState({usersModalOpen: true, selectedRecord: record})
|
|
42
37
|
HttpUtils.get('admin/sysRole/user-list', {id: record.id}).then(rs => {
|
|
43
38
|
this.setState({userList: rs.list, targetKeys: rs.selectedKeys})
|
|
44
39
|
})
|
|
45
40
|
}
|
|
46
41
|
|
|
47
|
-
onFinish = values => {
|
|
42
|
+
onFinish = async values => {
|
|
48
43
|
const isNew = !values.id;
|
|
49
44
|
const url = isNew ? 'admin/sysRole/create' : 'admin/sysRole/update';
|
|
50
|
-
HttpUtils.post(url, values)
|
|
51
|
-
|
|
52
|
-
this.tableRef.current.reload()
|
|
53
|
-
})
|
|
45
|
+
await HttpUtils.post(url, values)
|
|
46
|
+
this.tableRef.current.reload()
|
|
54
47
|
}
|
|
55
48
|
|
|
56
49
|
handleDelete = record => {
|
|
@@ -100,18 +93,6 @@ export default class extends React.Component {
|
|
|
100
93
|
|
|
101
94
|
|
|
102
95
|
},
|
|
103
|
-
{
|
|
104
|
-
title: '是否内置',
|
|
105
|
-
dataIndex: 'builtin',
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
render(v) {
|
|
109
|
-
return v == null ? null : (v ? '是' : '否')
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
},
|
|
114
|
-
|
|
115
96
|
{
|
|
116
97
|
title: '权限码',
|
|
117
98
|
dataIndex: 'perms',
|
|
@@ -135,14 +116,14 @@ export default class extends React.Component {
|
|
|
135
116
|
<Button size='small' perm='sys-role:grant-permission'
|
|
136
117
|
onClick={() => this.handleEditUser(record)}>用户设置</Button>
|
|
137
118
|
|
|
138
|
-
<Button size='small' perm='sys-role:grant-permission'
|
|
119
|
+
<Button size='small' perm='sys-role:grant-permission'
|
|
139
120
|
onClick={() => PageUtils.open('/system/role/rolePerm?id=' + record.id, '角色权限设置')}>权限设置</Button>
|
|
140
121
|
|
|
141
|
-
<Button size='small' perm='sys-role:update'
|
|
122
|
+
<Button size='small' perm='sys-role:update'
|
|
142
123
|
onClick={() => this.handleEdit(record)}>编辑</Button>
|
|
143
|
-
<Popconfirm perm='sys-role:delete'
|
|
124
|
+
<Popconfirm perm='sys-role:delete' title='是否确定删除系统角色'
|
|
144
125
|
onConfirm={() => this.handleDelete(record)}>
|
|
145
|
-
<Button size='small'
|
|
126
|
+
<Button size='small'>删除</Button>
|
|
146
127
|
</Popconfirm>
|
|
147
128
|
</PermActions>
|
|
148
129
|
);
|
|
@@ -152,7 +133,7 @@ export default class extends React.Component {
|
|
|
152
133
|
|
|
153
134
|
handleSaveUsers = () => {
|
|
154
135
|
const params = {
|
|
155
|
-
id: this.state.
|
|
136
|
+
id: this.state.selectedRecord.id,
|
|
156
137
|
userIdList: this.state.targetKeys
|
|
157
138
|
}
|
|
158
139
|
HttpUtils.post('admin/sysRole/grant-users', params).then(rs => {
|
|
@@ -161,7 +142,7 @@ export default class extends React.Component {
|
|
|
161
142
|
}
|
|
162
143
|
|
|
163
144
|
handleEditMenu = (record) => {
|
|
164
|
-
this.setState({menuOpen: true,
|
|
145
|
+
this.setState({menuOpen: true, selectedRecord: record, menuTreeLoading: true})
|
|
165
146
|
HttpUtils.get('admin/sysRole/ownMenu', {id: record.id}).then(rs => {
|
|
166
147
|
this.setState({menuChecked: rs.checked, menuHalfChecked: rs.halfChecked})
|
|
167
148
|
})
|
|
@@ -171,7 +152,7 @@ export default class extends React.Component {
|
|
|
171
152
|
}
|
|
172
153
|
handleGrantMenu = () => {
|
|
173
154
|
const params = {
|
|
174
|
-
id: this.state.
|
|
155
|
+
id: this.state.selectedRecord.id,
|
|
175
156
|
menuIds: [...this.state.menuChecked, ...this.state.menuHalfChecked]
|
|
176
157
|
}
|
|
177
158
|
HttpUtils.post('admin/sysRole/grantMenu', params).then(rs => {
|
|
@@ -183,71 +164,54 @@ export default class extends React.Component {
|
|
|
183
164
|
return <Page
|
|
184
165
|
title="角色管理"
|
|
185
166
|
description="管理系统角色,包括角色权限分配、用户设置等"
|
|
186
|
-
actions={<Button perm='sys-role:create' type='primary' icon={<PlusOutlined/>} onClick={this.handleAdd}>新增</Button>}
|
|
187
167
|
>
|
|
188
168
|
<ProTable
|
|
189
169
|
actionRef={this.tableRef}
|
|
170
|
+
toolBarRender={() => (
|
|
171
|
+
<PermActions>
|
|
172
|
+
<Button perm='sys-role:create' type='primary' icon={<PlusOutlined/>} onClick={this.handleAdd}>新增</Button>
|
|
173
|
+
</PermActions>
|
|
174
|
+
)}
|
|
190
175
|
request={(params) => HttpUtils.get('admin/sysRole/page', params)}
|
|
191
176
|
columns={this.columns}
|
|
192
|
-
|
|
193
|
-
|
|
177
|
+
searchFormRender={() => (
|
|
178
|
+
<>
|
|
179
|
+
<Form.Item label='角色名称' name='name'>
|
|
180
|
+
<Input/>
|
|
181
|
+
</Form.Item>
|
|
182
|
+
<Form.Item label='角色编码' name='code'>
|
|
183
|
+
<Input/>
|
|
184
|
+
</Form.Item>
|
|
185
|
+
</>
|
|
186
|
+
)}
|
|
187
|
+
/>
|
|
188
|
+
|
|
189
|
+
<FormModal ref={this.modalRef} title='系统角色' onFinish={this.onFinish}>
|
|
190
|
+
|
|
191
|
+
<Form.Item label='名称' name='name' rules={[{required: true}]}>
|
|
194
192
|
<Input/>
|
|
195
193
|
</Form.Item>
|
|
196
|
-
|
|
194
|
+
|
|
195
|
+
<Form.Item label='编码' name='code' rules={[{required: true}]}>
|
|
197
196
|
<Input/>
|
|
198
197
|
</Form.Item>
|
|
199
|
-
<Form.Item label='是否内置' name='builtin'>
|
|
200
|
-
<Select allowClear placeholder='全部'>
|
|
201
|
-
<Select.Option value={true}>是</Select.Option>
|
|
202
|
-
<Select.Option value={false}>否</Select.Option>
|
|
203
|
-
</Select>
|
|
204
|
-
</Form.Item>
|
|
205
|
-
</ProTable>
|
|
206
|
-
|
|
207
|
-
<Modal title='系统角色'
|
|
208
|
-
open={this.state.formOpen}
|
|
209
|
-
onOk={() => this.formRef.current.submit()}
|
|
210
|
-
onCancel={() => this.setState({formOpen: false})}
|
|
211
|
-
destroyOnHidden
|
|
212
|
-
mask={{ closable: false }}
|
|
213
|
-
width={600}
|
|
214
|
-
>
|
|
215
|
-
|
|
216
|
-
<Form ref={this.formRef} labelCol={{flex: '100px'}}
|
|
217
|
-
initialValues={this.state.formValues}
|
|
218
|
-
onFinish={this.onFinish}
|
|
219
|
-
>
|
|
220
|
-
<Form.Item name='id' noStyle></Form.Item>
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
<Form.Item label='名称' name='name' rules={[{required: true}]}>
|
|
224
|
-
<Input/>
|
|
225
|
-
</Form.Item>
|
|
226
198
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
<Form.Item label='排序' name='seq'>
|
|
233
|
-
<InputNumber/>
|
|
234
|
-
</Form.Item>
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
<Form.Item label='备注' name='remark'>
|
|
238
|
-
<Input/>
|
|
239
|
-
</Form.Item>
|
|
199
|
+
<Form.Item label='排序' name='seq'>
|
|
200
|
+
<InputNumber/>
|
|
201
|
+
</Form.Item>
|
|
240
202
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
203
|
+
<Form.Item label='备注' name='remark'>
|
|
204
|
+
<Input/>
|
|
205
|
+
</Form.Item>
|
|
244
206
|
|
|
207
|
+
<Form.Item label='启用' name='enabled' rules={[{required: true}]}>
|
|
208
|
+
<FieldBoolean/>
|
|
209
|
+
</Form.Item>
|
|
245
210
|
|
|
246
|
-
|
|
247
|
-
</Modal>
|
|
211
|
+
</FormModal>
|
|
248
212
|
|
|
249
213
|
|
|
250
|
-
<Modal title={'角色用户' + "【" + this.state.
|
|
214
|
+
<Modal title={'角色用户' + "【" + this.state.selectedRecord?.name + '】'}
|
|
251
215
|
open={this.state.usersModalOpen}
|
|
252
216
|
destroyOnHidden
|
|
253
217
|
mask={{ closable: false }}
|
|
@@ -280,7 +244,7 @@ export default class extends React.Component {
|
|
|
280
244
|
|
|
281
245
|
</Modal>
|
|
282
246
|
|
|
283
|
-
<Modal title={'角色授权菜单权限' + "【" + this.state.
|
|
247
|
+
<Modal title={'角色授权菜单权限' + "【" + this.state.selectedRecord?.name + '】'}
|
|
284
248
|
open={this.state.menuOpen}
|
|
285
249
|
destroyOnHidden
|
|
286
250
|
mask={{ closable: false }}
|
|
@@ -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 {HttpUtils, Page
|
|
4
|
+
import {HttpUtils, Page} from "../../../framework";
|
|
5
5
|
export default class extends React.Component {
|
|
6
6
|
|
|
7
7
|
|
|
@@ -48,7 +48,7 @@ export default class extends React.Component {
|
|
|
48
48
|
]
|
|
49
49
|
|
|
50
50
|
componentDidMount() {
|
|
51
|
-
this.roleId =
|
|
51
|
+
this.roleId = this.props.location?.query?.id;
|
|
52
52
|
this.loadData();
|
|
53
53
|
}
|
|
54
54
|
|