@jiangood/open-admin 1.1.0 → 1.1.2
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 +1 -1
- package/src/.umi-production/appData.json +52 -82
- package/src/.umi-production/core/route.tsx +1 -4
- package/src/framework/fields/FieldDictSelect/index.jsx +2 -1
- package/src/framework/utils/system/DictUtils.ts +7 -8
- package/src/layouts/index.jsx +1 -2
- package/src/pages/system/api/index.jsx +1 -1
- package/src/pages/system/dict/index.jsx +188 -12
- package/src/pages/system/file/index.jsx +1 -1
- package/src/pages/system/job/index.jsx +1 -1
- package/src/pages/system/org/index.jsx +2 -3
- package/src/pages/system/role/index.jsx +1 -1
- package/src/pages/system/sysManual/index.jsx +1 -1
- package/src/pages/system/user/index.jsx +1 -1
- package/src/pages/system/dict/Dict.jsx +0 -67
- package/src/pages/system/dict/DictItem.jsx +0 -175
- package/src/pages/ureport/index.jsx +0 -16
|
@@ -19,14 +19,13 @@ if (process.env.NODE_ENV === 'development') {
|
|
|
19
19
|
import React from 'react';
|
|
20
20
|
|
|
21
21
|
export async function getRoutes() {
|
|
22
|
-
const routes = {"404":{"path":"*","id":"404","parentId":"@@/global-layout"},"userCenter/ChangePassword":{"path":"userCenter/ChangePassword","id":"userCenter/ChangePassword","parentId":"@@/global-layout"},"system/sysManual/index":{"path":"system/sysManual","id":"system/sysManual/index","parentId":"@@/global-layout"},"system/
|
|
22
|
+
const routes = {"404":{"path":"*","id":"404","parentId":"@@/global-layout"},"userCenter/ChangePassword":{"path":"userCenter/ChangePassword","id":"userCenter/ChangePassword","parentId":"@@/global-layout"},"system/sysManual/index":{"path":"system/sysManual","id":"system/sysManual/index","parentId":"@@/global-layout"},"system/user/UserPerm":{"path":"system/user/UserPerm","id":"system/user/UserPerm","parentId":"@@/global-layout"},"userCenter/message":{"path":"userCenter/message","id":"userCenter/message","parentId":"@@/global-layout"},"system/api/ApiDoc":{"path":"system/api/ApiDoc","id":"system/api/ApiDoc","parentId":"@@/global-layout"},"system/dict/index":{"path":"system/dict","id":"system/dict/index","parentId":"@@/global-layout"},"system/file/index":{"path":"system/file","id":"system/file/index","parentId":"@@/global-layout"},"system/role/index":{"path":"system/role","id":"system/role/index","parentId":"@@/global-layout"},"system/user/index":{"path":"system/user","id":"system/user/index","parentId":"@@/global-layout"},"userCenter/manual":{"path":"userCenter/manual","id":"userCenter/manual","parentId":"@@/global-layout"},"system/api/index":{"path":"system/api","id":"system/api/index","parentId":"@@/global-layout"},"system/job/index":{"path":"system/job","id":"system/job/index","parentId":"@@/global-layout"},"system/log/index":{"path":"system/log","id":"system/log/index","parentId":"@@/global-layout"},"system/org/index":{"path":"system/org","id":"system/org/index","parentId":"@@/global-layout"},"system/role/perm":{"path":"system/role/perm","id":"system/role/perm","parentId":"@@/global-layout"},"userCenter/index":{"path":"userCenter","id":"userCenter/index","parentId":"@@/global-layout"},"system/api/perm":{"path":"system/api/perm","id":"system/api/perm","parentId":"@@/global-layout"},"test/views":{"path":"test/views","id":"test/views","parentId":"@@/global-layout"},"about":{"path":"about","id":"about","parentId":"@@/global-layout"},"index":{"path":"/","id":"index","parentId":"@@/global-layout"},"login":{"path":"login","id":"login","parentId":"@@/global-layout"},"@@/global-layout":{"id":"@@/global-layout","path":"/","isLayout":true}} as const;
|
|
23
23
|
return {
|
|
24
24
|
routes,
|
|
25
25
|
routeComponents: {
|
|
26
26
|
'404': React.lazy(() => import(/* webpackChunkName: "src__pages__404" */'../../../src/pages/404.jsx')),
|
|
27
27
|
'userCenter/ChangePassword': React.lazy(() => import(/* webpackChunkName: "src__pages__userCenter__ChangePassword" */'../../../src/pages/userCenter/ChangePassword.jsx')),
|
|
28
28
|
'system/sysManual/index': React.lazy(() => import(/* webpackChunkName: "src__pages__system__sysManual__index" */'../../../src/pages/system/sysManual/index.jsx')),
|
|
29
|
-
'system/dict/DictItem': React.lazy(() => import(/* webpackChunkName: "src__pages__system__dict__DictItem" */'../../../src/pages/system/dict/DictItem.jsx')),
|
|
30
29
|
'system/user/UserPerm': React.lazy(() => import(/* webpackChunkName: "src__pages__system__user__UserPerm" */'../../../src/pages/system/user/UserPerm.jsx')),
|
|
31
30
|
'userCenter/message': React.lazy(() => import(/* webpackChunkName: "src__pages__userCenter__message" */'../../../src/pages/userCenter/message.jsx')),
|
|
32
31
|
'system/api/ApiDoc': React.lazy(() => import(/* webpackChunkName: "src__pages__system__api__ApiDoc" */'../../../src/pages/system/api/ApiDoc.jsx')),
|
|
@@ -36,14 +35,12 @@ export async function getRoutes() {
|
|
|
36
35
|
'system/user/index': React.lazy(() => import(/* webpackChunkName: "src__pages__system__user__index" */'../../../src/pages/system/user/index.jsx')),
|
|
37
36
|
'userCenter/manual': React.lazy(() => import(/* webpackChunkName: "src__pages__userCenter__manual" */'../../../src/pages/userCenter/manual.jsx')),
|
|
38
37
|
'system/api/index': React.lazy(() => import(/* webpackChunkName: "src__pages__system__api__index" */'../../../src/pages/system/api/index.jsx')),
|
|
39
|
-
'system/dict/Dict': React.lazy(() => import(/* webpackChunkName: "src__pages__system__dict__Dict" */'../../../src/pages/system/dict/Dict.jsx')),
|
|
40
38
|
'system/job/index': React.lazy(() => import(/* webpackChunkName: "src__pages__system__job__index" */'../../../src/pages/system/job/index.jsx')),
|
|
41
39
|
'system/log/index': React.lazy(() => import(/* webpackChunkName: "src__pages__system__log__index" */'../../../src/pages/system/log/index.jsx')),
|
|
42
40
|
'system/org/index': React.lazy(() => import(/* webpackChunkName: "src__pages__system__org__index" */'../../../src/pages/system/org/index.jsx')),
|
|
43
41
|
'system/role/perm': React.lazy(() => import(/* webpackChunkName: "src__pages__system__role__perm" */'../../../src/pages/system/role/perm.jsx')),
|
|
44
42
|
'userCenter/index': React.lazy(() => import(/* webpackChunkName: "src__pages__userCenter__index" */'../../../src/pages/userCenter/index.jsx')),
|
|
45
43
|
'system/api/perm': React.lazy(() => import(/* webpackChunkName: "src__pages__system__api__perm" */'../../../src/pages/system/api/perm.jsx')),
|
|
46
|
-
'ureport/index': React.lazy(() => import(/* webpackChunkName: "src__pages__ureport__index" */'../../../src/pages/ureport/index.jsx')),
|
|
47
44
|
'test/views': React.lazy(() => import(/* webpackChunkName: "src__pages__test__views" */'../../../src/pages/test/views.jsx')),
|
|
48
45
|
'about': React.lazy(() => import(/* webpackChunkName: "src__pages__about" */'../../../src/pages/about.jsx')),
|
|
49
46
|
'index': React.lazy(() => import(/* webpackChunkName: "src__pages__index" */'../../../src/pages/index.jsx')),
|
|
@@ -6,7 +6,8 @@ export function FieldDictSelect(props) {
|
|
|
6
6
|
const {value, onChange, typeCode, ...rest} = props;
|
|
7
7
|
const options = DictUtils.dictOptions(typeCode);
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
return <Select value={String(value)}
|
|
10
11
|
onChange={onChange}
|
|
11
12
|
style={{width: '100%', minWidth: 200}}
|
|
12
13
|
options={options}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
// 假设的类型定义,你需要确保与你的实际数据结构匹配
|
|
2
2
|
import {SysUtils} from "./SysUtils";
|
|
3
|
+
// 假设 SysUtil 和 StrUtil 的引入和类型
|
|
4
|
+
// 实际使用时需要确保路径和模块存在
|
|
5
|
+
import {Tag} from 'antd';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import {StringUtils} from "../StringUtils";
|
|
3
8
|
|
|
4
9
|
export interface DictItem {
|
|
5
10
|
value: string | number;
|
|
@@ -8,15 +13,9 @@ export interface DictItem {
|
|
|
8
13
|
}
|
|
9
14
|
|
|
10
15
|
|
|
11
|
-
// 假设 SysUtil 和 StrUtil 的引入和类型
|
|
12
|
-
// 实际使用时需要确保路径和模块存在
|
|
13
|
-
import {Tag} from 'antd';
|
|
14
|
-
import React from 'react';
|
|
15
|
-
import {StringUtils} from "../StringUtils";
|
|
16
|
-
|
|
17
16
|
// 字典选项的格式
|
|
18
17
|
export interface DictOption {
|
|
19
|
-
value: string|number;
|
|
18
|
+
value: string | number;
|
|
20
19
|
label: string;
|
|
21
20
|
}
|
|
22
21
|
|
|
@@ -76,7 +75,7 @@ export class DictUtils {
|
|
|
76
75
|
* @param code 字典项编码
|
|
77
76
|
* @returns Antd Tag 元素或纯字符串名称或空字符串
|
|
78
77
|
*/
|
|
79
|
-
public static dictTag(typeCode: string, code: string | number
|
|
78
|
+
public static dictTag(typeCode: string, code: string | number): React.ReactElement | string {
|
|
80
79
|
if (typeCode == null || code == null) {
|
|
81
80
|
return null;
|
|
82
81
|
}
|
package/src/layouts/index.jsx
CHANGED
|
@@ -33,8 +33,7 @@ function checkIsSimplePage(pathname) {
|
|
|
33
33
|
if(pathname.startsWith("/test/")){
|
|
34
34
|
return true
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
return ArrUtils.contains(SIMPLE_URLS, pathname) || count === 1;
|
|
36
|
+
return ArrUtils.contains(SIMPLE_URLS, pathname) ;
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
function checkIsPurePage(pathname){
|
|
@@ -41,7 +41,7 @@ export default class extends React.Component {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
handleDelete = record => {
|
|
44
|
-
HttpUtils.
|
|
44
|
+
HttpUtils.post('admin/apiAccount/delete', {id: record.id}).then(rs => {
|
|
45
45
|
this.tableRef.current.reload()
|
|
46
46
|
})
|
|
47
47
|
}
|
|
@@ -1,25 +1,201 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
2
|
+
import {Button, Form, Input, InputNumber, Modal, Popconfirm, Splitter, Tag, Tree, Typography} from "antd";
|
|
3
|
+
import {
|
|
4
|
+
ButtonList,
|
|
5
|
+
FieldBoolean, FieldDictSelect,
|
|
6
|
+
HttpUtils,
|
|
7
|
+
Page,
|
|
8
|
+
PageLoading,
|
|
9
|
+
ProTable,
|
|
10
|
+
ViewBooleanEnableDisable
|
|
11
|
+
} from "../../../framework";
|
|
12
|
+
import {PlusOutlined} from "@ant-design/icons";
|
|
5
13
|
|
|
6
14
|
export default class extends React.Component {
|
|
7
15
|
|
|
8
16
|
state = {
|
|
9
|
-
|
|
17
|
+
treeData: [],
|
|
18
|
+
treeLoading: true,
|
|
19
|
+
typeCode: null,
|
|
20
|
+
formValues: {},
|
|
21
|
+
formOpen: false
|
|
10
22
|
}
|
|
11
23
|
|
|
24
|
+
formRef = React.createRef()
|
|
25
|
+
tableRef = React.createRef()
|
|
26
|
+
|
|
27
|
+
async componentDidMount() {
|
|
28
|
+
const treeData = await HttpUtils.get('admin/dict/tree');
|
|
29
|
+
this.setState({treeData, treeLoading: false});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
onSelect = (selectedKeys) => {
|
|
33
|
+
const key = selectedKeys.length === 1 ? selectedKeys[0] : null;
|
|
34
|
+
this.setState({typeCode: key}, () => {
|
|
35
|
+
this.tableRef.current.reload()
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
handleAdd = () => {
|
|
39
|
+
this.setState({formOpen: true, formValues: {}})
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
handleEdit = record => {
|
|
43
|
+
this.setState({formOpen: true, formValues: record})
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
onFinish = values => {
|
|
47
|
+
values.sysDict = {id: this.props.sysDictId}
|
|
48
|
+
HttpUtils.post('admin/dict/save', values).then(rs => {
|
|
49
|
+
this.setState({formOpen: false})
|
|
50
|
+
this.tableRef.current.reload()
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
handleDelete = row => {
|
|
55
|
+
HttpUtils.post('admin/dict/delete', row).then(rs => {
|
|
56
|
+
this.tableRef.current.reload()
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
columns = [
|
|
61
|
+
{
|
|
62
|
+
title: '文本',
|
|
63
|
+
dataIndex: 'name',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
title: '编码',
|
|
67
|
+
dataIndex: 'code',
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
{
|
|
71
|
+
title: '启用',
|
|
72
|
+
dataIndex: 'enabled',
|
|
73
|
+
render(v) {
|
|
74
|
+
return <ViewBooleanEnableDisable value={v}/>
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
title: '显示颜色',
|
|
80
|
+
dataIndex: 'color',
|
|
81
|
+
render(v) {
|
|
82
|
+
if (v) {
|
|
83
|
+
return <Tag color={v.toLowerCase()}>{v}</Tag>
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
{
|
|
90
|
+
title: '序号',
|
|
91
|
+
dataIndex: 'seq',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
title: '操作',
|
|
95
|
+
dataIndex: 'option',
|
|
96
|
+
render: (_, record) => {
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<ButtonList>
|
|
100
|
+
<Button size='small' perm='sysDict:save'
|
|
101
|
+
onClick={() => this.handleEdit(record)}> 编辑 </Button>
|
|
102
|
+
<Popconfirm perm='sysDict:delete' title='是否确定删除字典项'
|
|
103
|
+
onConfirm={() => this.handleDelete(record)}>
|
|
104
|
+
<Button size='small'>删除</Button>
|
|
105
|
+
</Popconfirm>
|
|
106
|
+
</ButtonList>
|
|
107
|
+
);
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
]
|
|
12
111
|
|
|
13
112
|
render() {
|
|
14
|
-
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
113
|
+
if (this.state.treeLoading) {
|
|
114
|
+
return <PageLoading/>
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return <Page>
|
|
118
|
+
<Splitter>
|
|
119
|
+
<Splitter.Panel defaultSize={600} style={{paddingRight: 16}}>
|
|
120
|
+
<Tree
|
|
121
|
+
treeData={this.state.treeData}
|
|
122
|
+
onSelect={this.onSelect}
|
|
22
123
|
|
|
124
|
+
showIcon
|
|
125
|
+
blockNode
|
|
126
|
+
showLine
|
|
127
|
+
defaultExpandAll
|
|
128
|
+
>
|
|
129
|
+
</Tree>
|
|
130
|
+
</Splitter.Panel>
|
|
131
|
+
<Splitter.Panel style={{paddingLeft: 16}}>
|
|
132
|
+
{this.renderTypeInfo()}
|
|
133
|
+
<ProTable
|
|
134
|
+
rowKey='code'
|
|
135
|
+
actionRef={this.tableRef}
|
|
136
|
+
toolBarRender={() => {
|
|
137
|
+
return <ButtonList>
|
|
138
|
+
<Button perm='sysDict:save' type='primary' onClick={this.handleAdd} disabled={!this.state.typeCode}>
|
|
139
|
+
<PlusOutlined/> 新增
|
|
140
|
+
</Button>
|
|
141
|
+
</ButtonList>
|
|
142
|
+
}}
|
|
143
|
+
request={(params) => {
|
|
144
|
+
params.typeCode = this.state.typeCode
|
|
145
|
+
return HttpUtils.get('admin/dict/page', params);
|
|
146
|
+
}}
|
|
147
|
+
columns={this.columns}
|
|
148
|
+
search={false}
|
|
149
|
+
/>
|
|
150
|
+
</Splitter.Panel>
|
|
151
|
+
</Splitter>
|
|
152
|
+
<Modal
|
|
153
|
+
title='编辑数据字典项'
|
|
154
|
+
open={this.state.formOpen}
|
|
155
|
+
onOk={() => this.formRef.current.submit()}
|
|
156
|
+
onCancel={() => this.setState({formOpen: false})}
|
|
157
|
+
destroyOnHidden
|
|
158
|
+
>
|
|
159
|
+
|
|
160
|
+
<Form ref={this.formRef} labelCol={{flex: '100px'}}
|
|
161
|
+
initialValues={this.state.formValues}
|
|
162
|
+
onFinish={this.onFinish}>
|
|
163
|
+
<Form.Item name='id' noStyle></Form.Item>
|
|
164
|
+
<Form.Item label='类型编码' name='typeCode' rules={[{required: true}]} initialValue={this.state.typeCode}>
|
|
165
|
+
<Input/>
|
|
166
|
+
</Form.Item>
|
|
167
|
+
<Form.Item label='编码' name='code' rules={[{required: true}]}>
|
|
168
|
+
<Input/>
|
|
169
|
+
</Form.Item>
|
|
170
|
+
<Form.Item label='文本' name='name' rules={[{required: true}]} >
|
|
171
|
+
<Input/>
|
|
172
|
+
</Form.Item>
|
|
173
|
+
<Form.Item label='颜色' name='color' rules={[{required: true}]}>
|
|
174
|
+
<FieldDictSelect typeCode='statusColor' />
|
|
175
|
+
</Form.Item>
|
|
176
|
+
<Form.Item label='序号' name='seq' rules={[{required: true}]}>
|
|
177
|
+
<InputNumber/>
|
|
178
|
+
</Form.Item>
|
|
179
|
+
|
|
180
|
+
<Form.Item label='启用' name='enabled' rules={[{required: true}]}>
|
|
181
|
+
<FieldBoolean/>
|
|
182
|
+
</Form.Item>
|
|
183
|
+
|
|
184
|
+
</Form>
|
|
185
|
+
</Modal>
|
|
186
|
+
</Page>
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
}
|
|
23
190
|
|
|
191
|
+
renderTypeInfo() {
|
|
192
|
+
if(this.state.typeCode){
|
|
193
|
+
return <>
|
|
194
|
+
<Typography.Text italic> 类型:</Typography.Text>
|
|
195
|
+
<Typography.Text copyable>
|
|
196
|
+
{this.state.typeCode}
|
|
197
|
+
</Typography.Text>
|
|
198
|
+
</>;
|
|
199
|
+
}
|
|
24
200
|
}
|
|
25
201
|
}
|
|
@@ -14,7 +14,7 @@ export default class extends React.Component {
|
|
|
14
14
|
formRef = React.createRef()
|
|
15
15
|
|
|
16
16
|
handleDelete = row => {
|
|
17
|
-
HttpUtils.
|
|
17
|
+
HttpUtils.post('admin/sysFile/delete', row).then(rs => {
|
|
18
18
|
this.tableRef.current.reload()
|
|
19
19
|
})
|
|
20
20
|
}
|
|
@@ -92,7 +92,7 @@ export default class extends React.Component {
|
|
|
92
92
|
|
|
93
93
|
handleDelete = row => {
|
|
94
94
|
const hide = message.loading("删除作业中...")
|
|
95
|
-
HttpUtils.
|
|
95
|
+
HttpUtils.post('admin/job/delete', {id: row.id}).then(rs => {
|
|
96
96
|
this.tableRef.current.reload();
|
|
97
97
|
}).catch(hide)
|
|
98
98
|
}
|
|
@@ -52,7 +52,7 @@ export default class extends React.Component {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
handleDelete = record => {
|
|
55
|
-
HttpUtils.
|
|
55
|
+
HttpUtils.post('admin/sysOrg/delete', {id: record.id})
|
|
56
56
|
.then(rs => {
|
|
57
57
|
this.setState({formValues: null})
|
|
58
58
|
this.loadTree()
|
|
@@ -146,8 +146,7 @@ export default class extends React.Component {
|
|
|
146
146
|
onDrop={this.onDrop}
|
|
147
147
|
showLine
|
|
148
148
|
defaultExpandAll
|
|
149
|
-
|
|
150
|
-
</Tree>
|
|
149
|
+
/>
|
|
151
150
|
{this.state.treeData.length === 0 && <Empty/>}
|
|
152
151
|
</Card>
|
|
153
152
|
</Splitter.Panel>
|
|
@@ -52,7 +52,7 @@ export default class extends React.Component {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
handleDelete = record => {
|
|
55
|
-
HttpUtils.
|
|
55
|
+
HttpUtils.post('admin/sysRole/delete', {id: record.id}).then(rs => {
|
|
56
56
|
this.tableRef.current.reload()
|
|
57
57
|
})
|
|
58
58
|
}
|
|
@@ -30,7 +30,7 @@ export default class extends React.Component {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
handleDelete = record => {
|
|
33
|
-
HttpUtils.
|
|
33
|
+
HttpUtils.post('admin/sysManual/delete', {id: record.id}).then(rs => {
|
|
34
34
|
this.tableRef.current.reload()
|
|
35
35
|
})
|
|
36
36
|
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import {HttpUtils, ProTable} from "../../../framework";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export default class extends React.Component {
|
|
6
|
-
|
|
7
|
-
state = {
|
|
8
|
-
formValues: {},
|
|
9
|
-
formOpen: false,
|
|
10
|
-
selectedRowKeys: []
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
formRef = React.createRef()
|
|
14
|
-
tableRef = React.createRef()
|
|
15
|
-
|
|
16
|
-
columns = [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
{
|
|
20
|
-
title: '编码',
|
|
21
|
-
dataIndex: 'code',
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
title: '文本',
|
|
27
|
-
dataIndex: 'text',
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
]
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
render() {
|
|
35
|
-
return <>
|
|
36
|
-
<ProTable
|
|
37
|
-
actionRef={this.tableRef}
|
|
38
|
-
|
|
39
|
-
request={(params) => HttpUtils.get('admin/sysDict/page', params)}
|
|
40
|
-
columns={this.columns}
|
|
41
|
-
rowKey='id'
|
|
42
|
-
|
|
43
|
-
rowSelection={{
|
|
44
|
-
type: 'radio',
|
|
45
|
-
selectedRowKeys: this.state.selectedRowKeys,
|
|
46
|
-
onChange: (selectedRowKeys, selectedRows) => {
|
|
47
|
-
this.setState({selectedRowKeys: selectedRowKeys})
|
|
48
|
-
this.props.onChange(selectedRowKeys[0])
|
|
49
|
-
}
|
|
50
|
-
}}
|
|
51
|
-
onRow={(record) => ({
|
|
52
|
-
onClick: () => {
|
|
53
|
-
this.setState({selectedRowKeys: [record.id]})
|
|
54
|
-
this.props.onChange(record.id)
|
|
55
|
-
}
|
|
56
|
-
})}
|
|
57
|
-
/>
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
</>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import {PlusOutlined} from '@ant-design/icons'
|
|
2
|
-
import {Button, Col, Form, Input, InputNumber, Modal, Popconfirm, Row, Tag} from 'antd'
|
|
3
|
-
import React from 'react'
|
|
4
|
-
|
|
5
|
-
import {ButtonList, FieldBoolean, HttpUtils, ProTable} from '../../../framework'
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export default class extends React.Component {
|
|
9
|
-
|
|
10
|
-
state = {
|
|
11
|
-
formValues: {},
|
|
12
|
-
formOpen: false
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
formRef = React.createRef()
|
|
16
|
-
tableRef = React.createRef()
|
|
17
|
-
|
|
18
|
-
componentDidUpdate(prevProps, prevState, snapshot) {
|
|
19
|
-
if (prevProps.sysDictId !== this.props.sysDictId) {
|
|
20
|
-
this.tableRef.current.reload()
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
handleAdd = () => {
|
|
25
|
-
this.setState({formOpen: true, formValues: {}})
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
handleEdit = record => {
|
|
29
|
-
this.setState({formOpen: true, formValues: record})
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
onFinish = values => {
|
|
33
|
-
values.sysDict = {id: this.props.sysDictId}
|
|
34
|
-
HttpUtils.post('admin/sysDictItem/save', values).then(rs => {
|
|
35
|
-
this.setState({formOpen: false})
|
|
36
|
-
this.tableRef.current.reload()
|
|
37
|
-
})
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
handleDelete = row => {
|
|
41
|
-
HttpUtils.get('admin/sysDictItem/delete', row).then(rs => {
|
|
42
|
-
this.tableRef.current.reload()
|
|
43
|
-
})
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
columns = [
|
|
47
|
-
{
|
|
48
|
-
title: '文本',
|
|
49
|
-
dataIndex: 'text',
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
title: '编码',
|
|
53
|
-
dataIndex: 'code',
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
{
|
|
57
|
-
title: '启用',
|
|
58
|
-
dataIndex: 'enabled',
|
|
59
|
-
render(v) {
|
|
60
|
-
return v ? '是' : '否'
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
title: '显示颜色',
|
|
66
|
-
dataIndex: 'color',
|
|
67
|
-
render(v) {
|
|
68
|
-
return <Tag color={v}>COLOR</Tag>
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
title: '系统内置',
|
|
73
|
-
dataIndex: 'builtin',
|
|
74
|
-
render(v) {
|
|
75
|
-
return v ? '是' : '否'
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
title: '序号',
|
|
81
|
-
dataIndex: 'seq',
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
title: '操作',
|
|
85
|
-
dataIndex: 'option',
|
|
86
|
-
render: (_, record) => {
|
|
87
|
-
|
|
88
|
-
return (
|
|
89
|
-
<ButtonList>
|
|
90
|
-
<Button size='small' perm='sysDict:save'
|
|
91
|
-
onClick={() => this.handleEdit(record)}> 编辑 </Button>
|
|
92
|
-
<Popconfirm perm='sysDict:delete' title='是否确定删除字典项'
|
|
93
|
-
onConfirm={() => this.handleDelete(record)}>
|
|
94
|
-
<Button size='small'>删除</Button>
|
|
95
|
-
</Popconfirm>
|
|
96
|
-
</ButtonList>
|
|
97
|
-
);
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
]
|
|
101
|
-
|
|
102
|
-
render() {
|
|
103
|
-
return <>
|
|
104
|
-
<ProTable
|
|
105
|
-
headerTitle='字典项列表'
|
|
106
|
-
actionRef={this.tableRef}
|
|
107
|
-
toolBarRender={() => {
|
|
108
|
-
return <ButtonList>
|
|
109
|
-
<Button perm='sysDictItem:save' type='primary' onClick={this.handleAdd}>
|
|
110
|
-
<PlusOutlined/> 新增
|
|
111
|
-
</Button>
|
|
112
|
-
</ButtonList>
|
|
113
|
-
}}
|
|
114
|
-
request={(params) => {
|
|
115
|
-
params.sysDictId = this.props.sysDictId
|
|
116
|
-
return HttpUtils.get('admin/sysDictItem/page', params);
|
|
117
|
-
}}
|
|
118
|
-
columns={this.columns}
|
|
119
|
-
rowKey='id'
|
|
120
|
-
search={false}
|
|
121
|
-
/>
|
|
122
|
-
|
|
123
|
-
<Modal
|
|
124
|
-
title='编辑数据字典项'
|
|
125
|
-
open={this.state.formOpen}
|
|
126
|
-
onOk={() => this.formRef.current.submit()}
|
|
127
|
-
onCancel={() => this.setState({formOpen: false})}
|
|
128
|
-
destroyOnHidden
|
|
129
|
-
>
|
|
130
|
-
|
|
131
|
-
<Form ref={this.formRef} labelCol={{flex: '100px'}}
|
|
132
|
-
initialValues={this.state.formValues}
|
|
133
|
-
onFinish={this.onFinish}>
|
|
134
|
-
<Form.Item name='id' noStyle></Form.Item>
|
|
135
|
-
|
|
136
|
-
<Row>
|
|
137
|
-
<Col span={12}>
|
|
138
|
-
<Form.Item label='编码' name='code' rules={[{required: true}]}>
|
|
139
|
-
<Input/>
|
|
140
|
-
</Form.Item>
|
|
141
|
-
</Col>
|
|
142
|
-
<Col span={12}>
|
|
143
|
-
<Form.Item label='文本' name='text' rules={[{required: true}]}>
|
|
144
|
-
<Input/>
|
|
145
|
-
</Form.Item>
|
|
146
|
-
</Col>
|
|
147
|
-
</Row>
|
|
148
|
-
|
|
149
|
-
<Row>
|
|
150
|
-
<Col span={12}>
|
|
151
|
-
<Form.Item label='颜色' name='color' rules={[{required: true}]}>
|
|
152
|
-
<Input/>
|
|
153
|
-
</Form.Item>
|
|
154
|
-
</Col>
|
|
155
|
-
<Col span={12}>
|
|
156
|
-
<Form.Item label='序号' name='seq' rules={[{required: true}]}>
|
|
157
|
-
<InputNumber/>
|
|
158
|
-
</Form.Item>
|
|
159
|
-
</Col>
|
|
160
|
-
</Row>
|
|
161
|
-
|
|
162
|
-
<Form.Item label='启用' name='enabled' rules={[{required: true}]}>
|
|
163
|
-
<FieldBoolean/>
|
|
164
|
-
</Form.Item>
|
|
165
|
-
|
|
166
|
-
</Form>
|
|
167
|
-
</Modal>
|
|
168
|
-
</>
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import {Button} from "antd";
|
|
3
|
-
|
|
4
|
-
export default class extends React.Component {
|
|
5
|
-
|
|
6
|
-
render() {
|
|
7
|
-
return <div style={{display: 'flex', alignItems: 'center', justifyContent: 'center'}}>
|
|
8
|
-
<Button type='primary' href='/ureport/designer'>打开设计器</Button>
|
|
9
|
-
</div>
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|