@jiangood/open-admin 1.0.0

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 (164) hide show
  1. package/config/dist/common-plugin.js +148 -0
  2. package/config/dist/config.js +45 -0
  3. package/config/dist/index.js +18 -0
  4. package/package.json +41 -0
  5. package/src/app.js +1 -0
  6. package/src/asserts/welcome.png +0 -0
  7. package/src/forms/demoForm.jsx +16 -0
  8. package/src/framework/components/DownloadFileButton.d.ts +11 -0
  9. package/src/framework/components/DownloadFileButton.jsx +33 -0
  10. package/src/framework/components/Ellipsis.jsx +39 -0
  11. package/src/framework/components/Ellipsis.less +8 -0
  12. package/src/framework/components/Gap/index.d.ts +23 -0
  13. package/src/framework/components/Gap/index.jsx +46 -0
  14. package/src/framework/components/LinkButton.d.ts +14 -0
  15. package/src/framework/components/LinkButton.jsx +10 -0
  16. package/src/framework/components/NamedIcon.tsx +15 -0
  17. package/src/framework/components/Page/index.d.ts +17 -0
  18. package/src/framework/components/Page/index.jsx +30 -0
  19. package/src/framework/components/Page/index.less +10 -0
  20. package/src/framework/components/PageLoading.tsx +27 -0
  21. package/src/framework/components/ProModal/index.tsx +66 -0
  22. package/src/framework/components/ProTable/components/ToolBar/index.jsx +123 -0
  23. package/src/framework/components/ProTable/components/ToolBar/index.less +53 -0
  24. package/src/framework/components/ProTable/index.d.ts +42 -0
  25. package/src/framework/components/ProTable/index.jsx +260 -0
  26. package/src/framework/components/ProTable/index.less +14 -0
  27. package/src/framework/components/ProTable/utils/index.js +43 -0
  28. package/src/framework/components/ValueType/index.jsx +34 -0
  29. package/src/framework/components/ValueType/registry.jsx +27 -0
  30. package/src/framework/components/index.ts +17 -0
  31. package/src/framework/components/system/ButtonList.d.ts +8 -0
  32. package/src/framework/components/system/ButtonList.jsx +42 -0
  33. package/src/framework/components/system/HasPerm.tsx +14 -0
  34. package/src/framework/components/system/index.tsx +29 -0
  35. package/src/framework/components/view/ViewBooleanEnableDisable.tsx +20 -0
  36. package/src/framework/components/view/ViewEllipsis.d.ts +11 -0
  37. package/src/framework/components/view/ViewEllipsis.jsx +30 -0
  38. package/src/framework/components/view/ViewFile.d.ts +10 -0
  39. package/src/framework/components/view/ViewFile.jsx +49 -0
  40. package/src/framework/components/view/ViewFileButton.d.ts +10 -0
  41. package/src/framework/components/view/ViewFileButton.jsx +0 -0
  42. package/src/framework/components/view/ViewImage.d.ts +9 -0
  43. package/src/framework/components/view/ViewImage.jsx +60 -0
  44. package/src/framework/components/view/ViewRange/index.d.ts +16 -0
  45. package/src/framework/components/view/ViewRange/index.jsx +20 -0
  46. package/src/framework/components/view/ViewText.tsx +16 -0
  47. package/src/framework/components/view/index.ts +10 -0
  48. package/src/framework/field-components/FieldBoolean.d.ts +13 -0
  49. package/src/framework/field-components/FieldBoolean.jsx +76 -0
  50. package/src/framework/field-components/FieldDate.d.ts +27 -0
  51. package/src/framework/field-components/FieldDate.jsx +114 -0
  52. package/src/framework/field-components/FieldDateRange.d.ts +6 -0
  53. package/src/framework/field-components/FieldDateRange.jsx +104 -0
  54. package/src/framework/field-components/FieldDictSelect.d.ts +13 -0
  55. package/src/framework/field-components/FieldDictSelect.jsx +16 -0
  56. package/src/framework/field-components/FieldEditor.d.ts +10 -0
  57. package/src/framework/field-components/FieldEditor.jsx +58 -0
  58. package/src/framework/field-components/FieldNumberRange.d.ts +13 -0
  59. package/src/framework/field-components/FieldNumberRange.jsx +59 -0
  60. package/src/framework/field-components/FieldPercent.d.ts +12 -0
  61. package/src/framework/field-components/FieldPercent.jsx +27 -0
  62. package/src/framework/field-components/FieldRemoteSelect.d.ts +13 -0
  63. package/src/framework/field-components/FieldRemoteSelect.jsx +87 -0
  64. package/src/framework/field-components/FieldRemoteSelectMultiple.d.ts +13 -0
  65. package/src/framework/field-components/FieldRemoteSelectMultiple.jsx +86 -0
  66. package/src/framework/field-components/FieldRemoteSelectMultipleInline.d.ts +20 -0
  67. package/src/framework/field-components/FieldRemoteSelectMultipleInline.jsx +86 -0
  68. package/src/framework/field-components/FieldRemoteTree.d.ts +21 -0
  69. package/src/framework/field-components/FieldRemoteTree.jsx +45 -0
  70. package/src/framework/field-components/FieldRemoteTreeCascader.d.ts +23 -0
  71. package/src/framework/field-components/FieldRemoteTreeCascader.jsx +61 -0
  72. package/src/framework/field-components/FieldRemoteTreeSelect.d.ts +17 -0
  73. package/src/framework/field-components/FieldRemoteTreeSelect.jsx +67 -0
  74. package/src/framework/field-components/FieldRemoteTreeSelectMultiple.d.ts +17 -0
  75. package/src/framework/field-components/FieldRemoteTreeSelectMultiple.jsx +72 -0
  76. package/src/framework/field-components/FieldSysOrgTree.d.ts +12 -0
  77. package/src/framework/field-components/FieldSysOrgTree.jsx +23 -0
  78. package/src/framework/field-components/FieldSysOrgTreeSelect.d.ts +12 -0
  79. package/src/framework/field-components/FieldSysOrgTreeSelect.jsx +23 -0
  80. package/src/framework/field-components/FieldTable.d.ts +17 -0
  81. package/src/framework/field-components/FieldTable.jsx +108 -0
  82. package/src/framework/field-components/FieldTable.less +29 -0
  83. package/src/framework/field-components/FieldTableSelect.d.ts +19 -0
  84. package/src/framework/field-components/FieldTableSelect.jsx +59 -0
  85. package/src/framework/field-components/FieldUploadFile.d.ts +34 -0
  86. package/src/framework/field-components/FieldUploadFile.jsx +141 -0
  87. package/src/framework/field-components/index.ts +21 -0
  88. package/src/framework/field-components/system/OrgTree.tsx +61 -0
  89. package/src/framework/field-components/system/RoleTree.tsx +53 -0
  90. package/src/framework/field-components/system/index.ts +2 -0
  91. package/src/framework/index.ts +5 -0
  92. package/src/framework/pages/LoginPage.d.ts +16 -0
  93. package/src/framework/pages/LoginPage.jsx +135 -0
  94. package/src/framework/pages/LoginPage.less +53 -0
  95. package/src/framework/pages/LoginPageUtils.ts +36 -0
  96. package/src/framework/pages/index.ts +2 -0
  97. package/src/framework/utils/ArrUtils.ts +229 -0
  98. package/src/framework/utils/ColorsUtils.ts +378 -0
  99. package/src/framework/utils/DateUtils.ts +187 -0
  100. package/src/framework/utils/DeviceUtils.ts +46 -0
  101. package/src/framework/utils/DomUtils.ts +50 -0
  102. package/src/framework/utils/EventBusUtils.ts +144 -0
  103. package/src/framework/utils/Logger.ts +40 -0
  104. package/src/framework/utils/MessageUtils.tsx +170 -0
  105. package/src/framework/utils/ObjectUtils.ts +118 -0
  106. package/src/framework/utils/StorageUtils.ts +50 -0
  107. package/src/framework/utils/StringUtils.ts +436 -0
  108. package/src/framework/utils/TreeUtils.ts +251 -0
  109. package/src/framework/utils/UrlUtils.ts +152 -0
  110. package/src/framework/utils/UuidUtils.ts +88 -0
  111. package/src/framework/utils/ValidateUtils.ts +28 -0
  112. package/src/framework/utils/index.ts +16 -0
  113. package/src/framework/utils/system/DictUtils.ts +97 -0
  114. package/src/framework/utils/system/FormRegistryUtils.ts +77 -0
  115. package/src/framework/utils/system/HttpUtils.ts +247 -0
  116. package/src/framework/utils/system/PageUtils.ts +163 -0
  117. package/src/framework/utils/system/PermUtils.ts +79 -0
  118. package/src/framework/utils/system/SysUtils.ts +97 -0
  119. package/src/framework/utils/system/ThemeUtils.ts +27 -0
  120. package/src/framework/utils/system/index.ts +7 -0
  121. package/src/framework/view-components/ViewApproveStatus.tsx +26 -0
  122. package/src/framework/view-components/ViewBoolean.tsx +6 -0
  123. package/src/framework/view-components/ViewFlowableInstanceProgress.d.ts +12 -0
  124. package/src/framework/view-components/ViewFlowableInstanceProgress.jsx +97 -0
  125. package/src/framework/view-components/ViewFlowableInstanceProgressButton.tsx +26 -0
  126. package/src/framework/view-components/ViewPassword.tsx +25 -0
  127. package/src/framework/view-components/ViewProps.ts +11 -0
  128. package/src/framework/view-components/index.ts +6 -0
  129. package/src/index.ts +2 -0
  130. package/src/layouts/PageRender.d.ts +22 -0
  131. package/src/layouts/PageRender.jsx +90 -0
  132. package/src/layouts/admin/HeaderRight.jsx +104 -0
  133. package/src/layouts/admin/TabPageRender.jsx +158 -0
  134. package/src/layouts/admin/index.jsx +161 -0
  135. package/src/layouts/admin/index.less +65 -0
  136. package/src/layouts/index.jsx +165 -0
  137. package/src/layouts/index.less +24 -0
  138. package/src/loading.jsx +18 -0
  139. package/src/pages/404.jsx +13 -0
  140. package/src/pages/about.jsx +14 -0
  141. package/src/pages/index.jsx +25 -0
  142. package/src/pages/login.jsx +21 -0
  143. package/src/pages/system/api/ApiDoc.jsx +144 -0
  144. package/src/pages/system/api/index.jsx +268 -0
  145. package/src/pages/system/api/perm.jsx +69 -0
  146. package/src/pages/system/dict/Dict.jsx +72 -0
  147. package/src/pages/system/dict/DictItem.jsx +177 -0
  148. package/src/pages/system/dict/index.jsx +25 -0
  149. package/src/pages/system/file/index.jsx +160 -0
  150. package/src/pages/system/job/index.jsx +324 -0
  151. package/src/pages/system/log/index.jsx +78 -0
  152. package/src/pages/system/org/index.jsx +262 -0
  153. package/src/pages/system/role/index.jsx +308 -0
  154. package/src/pages/system/role/perm.jsx +108 -0
  155. package/src/pages/system/sysManual/index.jsx +127 -0
  156. package/src/pages/system/user/UserPerm.jsx +97 -0
  157. package/src/pages/system/user/index.jsx +258 -0
  158. package/src/pages/test.jsx +200 -0
  159. package/src/pages/ureport/index.jsx +16 -0
  160. package/src/pages/userCenter/ChangePassword.jsx +63 -0
  161. package/src/pages/userCenter/index.jsx +90 -0
  162. package/src/pages/userCenter/manual.jsx +59 -0
  163. package/src/pages/userCenter/message.jsx +105 -0
  164. package/src/style/global.less +51 -0
@@ -0,0 +1,268 @@
1
+ import {PlusOutlined} from '@ant-design/icons'
2
+ import {Button, Form, Input, Modal, Popconfirm, Tabs} from 'antd'
3
+ import React from 'react'
4
+ import {
5
+ ButtonList,
6
+ FieldBoolean,
7
+ FieldDate, HttpUtils,
8
+ Page,
9
+ PageUtils,
10
+ ProTable,
11
+ StringUtils,
12
+ ViewPassword
13
+ } from "../../../framework";
14
+ import {ApiDoc} from "./ApiDoc";
15
+
16
+
17
+ export default class extends React.Component {
18
+
19
+ state = {
20
+ formValues: {},
21
+ formOpen: false
22
+ }
23
+
24
+ formRef = React.createRef()
25
+ tableRef = React.createRef()
26
+
27
+ columns = [
28
+ {
29
+ title: '名称',
30
+ dataIndex: 'name',
31
+ },
32
+ {
33
+ title: 'appId',
34
+ dataIndex: 'appId',
35
+ },
36
+
37
+ {
38
+ title: 'appSecret',
39
+ dataIndex: 'appSecret',
40
+ render(v) {
41
+ return <ViewPassword value={v}></ViewPassword>;
42
+ }
43
+ },
44
+ {
45
+ title: '准入IP',
46
+ dataIndex: 'accessIp',
47
+ },
48
+ {
49
+ title: '有效期',
50
+ dataIndex: 'endTime',
51
+ },
52
+ {
53
+ title: '启用',
54
+ dataIndex: 'enable',
55
+ render(v) {
56
+ return v == null ? null : (v ? '是' : '否')
57
+ },
58
+ },
59
+ {
60
+ title: '操作',
61
+ dataIndex: 'option',
62
+ render: (_, record) => (
63
+ <ButtonList>
64
+ <Button size='small' perm='api'
65
+ onClick={() => PageUtils.open('/system/api/perm?accountId=' + record.id, '账户权限')}
66
+ type='primary'>权限</Button>
67
+ <Button size='small' perm='api' onClick={() => this.handleEdit(record)}>编辑</Button>
68
+ <Popconfirm perm='api' title='是否确定删除接口访客' onConfirm={() => this.handleDelete(record)}>
69
+ <Button size='small'>删除</Button>
70
+ </Popconfirm>
71
+ </ButtonList>
72
+ ),
73
+ },
74
+ ]
75
+
76
+ handleAdd = () => {
77
+ this.setState({formOpen: true, formValues: {}})
78
+ }
79
+
80
+ handleEdit = record => {
81
+ this.setState({formOpen: true, formValues: record})
82
+ }
83
+
84
+
85
+ onFinish = values => {
86
+ HttpUtils.post('admin/apiAccount/save', values).then(rs => {
87
+ this.setState({formOpen: false})
88
+ this.tableRef.current.reload()
89
+ })
90
+ }
91
+
92
+
93
+ handleDelete = record => {
94
+ HttpUtils.get('admin/apiAccount/delete', {id: record.id}).then(rs => {
95
+ this.tableRef.current.reload()
96
+ })
97
+ }
98
+
99
+ randomAppSecret = () => {
100
+ const appSecret = StringUtils.random(32)
101
+ this.formRef.current.setFieldsValue({appSecret})
102
+ }
103
+
104
+ render() {
105
+ return <Page padding>
106
+ <Tabs items={[
107
+
108
+ {
109
+ label: '接口列表',
110
+ key: '2',
111
+ children: <ProTable
112
+ rowKey='action'
113
+ columns={[
114
+ {dataIndex: 'name', title: '名称'},
115
+ {dataIndex: 'action', title: '动作'},
116
+ {dataIndex: 'desc', title: '描述'},
117
+
118
+ ]}
119
+ request={(params,) => HttpUtils.get('admin/api/resource/page', params)}
120
+ />
121
+ },
122
+
123
+ {
124
+ label: '账号列表',
125
+ key: '1',
126
+ children: <ProTable
127
+ actionRef={this.tableRef}
128
+ toolBarRender={() => {
129
+ return <ButtonList>
130
+ <Button perm='api' type='primary' onClick={this.handleAdd}>
131
+ <PlusOutlined/> 新增
132
+ </Button>
133
+ </ButtonList>
134
+ }}
135
+ request={(params) => HttpUtils.get('admin/apiAccount/page', params)}
136
+ columns={this.columns}
137
+ />
138
+ }, {
139
+ label: '接口文档',
140
+ key: '3',
141
+ children: <ApiDoc/>
142
+ },
143
+ {
144
+ label: '访问记录',
145
+ key: '4',
146
+ children: <ProTable
147
+ request={(params) => HttpUtils.get('admin/apiAccessLog/page', params)}
148
+ columns={[
149
+
150
+ {
151
+ title: '接口名称',
152
+ dataIndex: 'name',
153
+
154
+
155
+ },
156
+
157
+ {
158
+ title: '接口',
159
+ dataIndex: 'action',
160
+
161
+
162
+ },
163
+
164
+ {
165
+ title: 'requestId',
166
+ dataIndex: 'requestId',
167
+
168
+ },
169
+
170
+ {
171
+ title: '请求数据',
172
+ dataIndex: 'requestData',
173
+
174
+
175
+ },
176
+
177
+ {
178
+ title: '响应数据',
179
+ dataIndex: 'responseData',
180
+
181
+
182
+ },
183
+
184
+ {
185
+ title: 'ip',
186
+ dataIndex: 'ip',
187
+
188
+
189
+ },
190
+
191
+ {
192
+ title: 'ipLocation',
193
+ dataIndex: 'ipLocation',
194
+
195
+
196
+ },
197
+
198
+ {
199
+ title: '执行时间',
200
+ dataIndex: 'executionTime',
201
+
202
+
203
+ },
204
+
205
+ {
206
+ title: '接口账户',
207
+ dataIndex: 'accountName',
208
+
209
+
210
+ },
211
+
212
+
213
+ ]}
214
+ />
215
+ },
216
+
217
+ ]}>
218
+
219
+ </Tabs>
220
+
221
+
222
+ <Modal title='接口访客'
223
+ open={this.state.formOpen}
224
+ onOk={() => this.formRef.current.submit()}
225
+ onCancel={() => this.setState({formOpen: false})}
226
+ destroyOnHidden
227
+ maskClosable={false}
228
+ >
229
+
230
+ <Form ref={this.formRef} labelCol={{flex: '100px'}}
231
+ initialValues={this.state.formValues}
232
+ onFinish={this.onFinish}
233
+
234
+ >
235
+ <Form.Item name='id' noStyle></Form.Item>
236
+
237
+ <Form.Item label='名称' name='name' rules={[{required: true}]}>
238
+ <Input/>
239
+ </Form.Item>
240
+
241
+
242
+ <Form.Item label='appId' name='appId'>
243
+ <Input placeholder='多个用逗号分隔'/>
244
+ </Form.Item>
245
+ <Form.Item label='appSecret' name='appSecret' rules={[{required: true}, {len: 32}]}
246
+ help={<Button size='small' type='link' onClick={this.randomAppSecret}>随机生成</Button>}
247
+ >
248
+ <Input/>
249
+ </Form.Item>
250
+
251
+ <Form.Item label='准入IP' name='accessIp'>
252
+ <Input placeholder='多个用逗号分隔'/>
253
+ </Form.Item>
254
+ <Form.Item label='有效期' name='endTime' style={{marginTop: 32}}>
255
+ <FieldDate type='YYYY-MM-DD'/>
256
+ </Form.Item>
257
+ <Form.Item label='启用' name='enable' rules={[{required: true}]}>
258
+ <FieldBoolean/>
259
+ </Form.Item>
260
+
261
+ </Form>
262
+ </Modal>
263
+ </Page>
264
+
265
+
266
+ }
267
+ }
268
+
@@ -0,0 +1,69 @@
1
+ import {message, Switch} from 'antd'
2
+ import React from 'react'
3
+ import {ArrUtils, HttpUtils, Page, PageUtils, ProTable} from "../../../framework";
4
+
5
+
6
+ export default class extends React.Component {
7
+
8
+
9
+ constructor(props) {
10
+ super(props);
11
+ this.accountId = PageUtils.currentParams().accountId
12
+ }
13
+
14
+ state = {
15
+ perms: []
16
+ }
17
+
18
+ async componentDidMount() {
19
+ const rs = await HttpUtils.get('admin/apiAccount/get', {id: this.accountId})
20
+ this.setState({perms: rs.perms})
21
+ }
22
+
23
+ onChange = async (action, checked) => {
24
+ const hide = message.loading('保存中...', 0)
25
+ await HttpUtils.post('admin/apiAccount/grant', {accountId: this.accountId, action, checked});
26
+
27
+ const perms = this.state.perms
28
+ if (checked) {
29
+ ArrUtils.add(perms, action)
30
+ } else {
31
+ ArrUtils.remove(perms, action)
32
+ }
33
+ this.setState({perms})
34
+ hide();
35
+ }
36
+
37
+
38
+ render() {
39
+ return <Page>
40
+
41
+
42
+ <ProTable
43
+ rowKey='action'
44
+ columns={[
45
+ {dataIndex: 'name', title: '名称'},
46
+ {dataIndex: 'action', title: '动作'},
47
+ {dataIndex: 'desc', title: '描述'},
48
+ {
49
+ dataIndex: 'option', title: '操作',
50
+ render: (_, record) => {
51
+ let action = record.action;
52
+ return <Switch checked={this.state.perms.includes(action)}
53
+ onChange={(checked) => {
54
+ this.onChange(action, checked)
55
+
56
+ }}> </Switch>
57
+ }
58
+ }
59
+ ]}
60
+ request={(params,) => HttpUtils.get('admin/api/resource/page', params)}
61
+ />
62
+
63
+ </Page>
64
+
65
+
66
+ }
67
+ }
68
+
69
+
@@ -0,0 +1,72 @@
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
+ {
21
+ title: '编码',
22
+ dataIndex: 'code',
23
+
24
+
25
+ },
26
+ {
27
+ title: '文本',
28
+ dataIndex: 'text',
29
+ },
30
+
31
+
32
+
33
+ ]
34
+
35
+
36
+
37
+ render() {
38
+ return <>
39
+ <ProTable
40
+ actionRef={this.tableRef}
41
+
42
+ request={(params) => HttpUtils.get('admin/sysDict/page', params)}
43
+ columns={this.columns}
44
+ rowKey='id'
45
+
46
+ rowSelection={{
47
+ type: 'radio',
48
+ selectedRowKeys: this.state.selectedRowKeys,
49
+ onChange: (selectedRowKeys, selectedRows) => {
50
+ this.setState({selectedRowKeys: selectedRowKeys})
51
+ this.props.onChange(selectedRowKeys[0])
52
+ }
53
+ }}
54
+ onRow={(record) => ({
55
+ onClick: () => {
56
+ this.setState({selectedRowKeys: [record.id]})
57
+ this.props.onChange(record.id)
58
+ }
59
+ })}
60
+ />
61
+
62
+
63
+
64
+
65
+ </>
66
+
67
+
68
+ }
69
+ }
70
+
71
+
72
+
@@ -0,0 +1,177 @@
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
+ columns = [
25
+ {
26
+ title: '文本',
27
+ dataIndex: 'text',
28
+ },
29
+ {
30
+ title: '编码',
31
+ dataIndex: 'code',
32
+ },
33
+
34
+ {
35
+ title: '启用',
36
+ dataIndex: 'enabled',
37
+ render(v) {
38
+ return v ? '是' : '否'
39
+ }
40
+
41
+ },
42
+ {
43
+ title: '显示颜色',
44
+ dataIndex: 'color',
45
+ render(v) {
46
+ return <Tag color={v}>COLOR</Tag>
47
+ }
48
+ },
49
+ {
50
+ title: '系统内置',
51
+ dataIndex: 'builtin',
52
+ render(v) {
53
+ return v ? '是' : '否'
54
+ }
55
+
56
+ },
57
+ {
58
+ title: '序号',
59
+ dataIndex: 'seq',
60
+ },
61
+ {
62
+ title: '操作',
63
+ dataIndex: 'option',
64
+ render: (_, record) => {
65
+
66
+ return (
67
+ <ButtonList>
68
+ <Button size='small' perm='sysDict:save'
69
+ onClick={() => this.handleEdit(record)}> 编辑 </Button>
70
+ <Popconfirm perm='sysDict:delete' title='是否确定删除字典项'
71
+ onConfirm={() => this.handleDelete(record)}>
72
+ <Button size='small'>删除</Button>
73
+ </Popconfirm>
74
+ </ButtonList>
75
+ );
76
+ },
77
+ },
78
+ ]
79
+
80
+ handleAdd = () => {
81
+ this.setState({formOpen: true, formValues: {}})
82
+ }
83
+
84
+ handleEdit = record => {
85
+ this.setState({formOpen: true, formValues: record})
86
+ }
87
+
88
+
89
+ onFinish = values => {
90
+ values.sysDict = {id: this.props.sysDictId}
91
+ HttpUtils.post('admin/sysDictItem/save', values).then(rs => {
92
+ this.setState({formOpen: false})
93
+ this.tableRef.current.reload()
94
+ })
95
+ }
96
+
97
+
98
+ handleDelete = row => {
99
+ HttpUtils.get('admin/sysDictItem/delete', row).then(rs => {
100
+ this.tableRef.current.reload()
101
+ })
102
+ }
103
+
104
+ render() {
105
+ return <>
106
+ <ProTable
107
+ headerTitle='字典项列表'
108
+ actionRef={this.tableRef}
109
+ toolBarRender={() => {
110
+ return <ButtonList>
111
+ <Button perm='sysDictItem:save' type='primary' onClick={this.handleAdd}>
112
+ <PlusOutlined/> 新增
113
+ </Button>
114
+ </ButtonList>
115
+ }}
116
+ request={(params) => {
117
+ params.sysDictId = this.props.sysDictId
118
+ return HttpUtils.get('admin/sysDictItem/page', params);
119
+ }}
120
+ columns={this.columns}
121
+ rowKey='id'
122
+ search={false}
123
+ />
124
+
125
+ <Modal
126
+ title='编辑数据字典项'
127
+ open={this.state.formOpen}
128
+ onOk={() => this.formRef.current.submit()}
129
+ onCancel={() => this.setState({formOpen: false})}
130
+ destroyOnHidden
131
+ >
132
+
133
+ <Form ref={this.formRef} labelCol={{flex: '100px'}}
134
+ initialValues={this.state.formValues}
135
+ onFinish={this.onFinish}>
136
+ <Form.Item name='id' noStyle></Form.Item>
137
+
138
+ <Row>
139
+ <Col span={12}>
140
+ <Form.Item label='编码' name='code' rules={[{required: true}]}>
141
+ <Input/>
142
+ </Form.Item>
143
+ </Col>
144
+ <Col span={12}>
145
+ <Form.Item label='文本' name='text' rules={[{required: true}]}>
146
+ <Input/>
147
+ </Form.Item>
148
+ </Col>
149
+ </Row>
150
+
151
+ <Row>
152
+ <Col span={12}>
153
+ <Form.Item label='颜色' name='color' rules={[{required: true}]}>
154
+ <Input/>
155
+ </Form.Item>
156
+ </Col>
157
+ <Col span={12}>
158
+ <Form.Item label='序号' name='seq' rules={[{required: true}]}>
159
+ <InputNumber/>
160
+ </Form.Item>
161
+ </Col>
162
+ </Row>
163
+
164
+ <Form.Item label='启用' name='enabled' rules={[{required: true}]}>
165
+ <FieldBoolean />
166
+ </Form.Item>
167
+
168
+ </Form>
169
+ </Modal>
170
+ </>
171
+
172
+
173
+ }
174
+ }
175
+
176
+
177
+
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import Dict from "./Dict";
3
+ import DictItem from "./DictItem";
4
+ import {Splitter} from "antd";
5
+
6
+ export default class extends React.Component {
7
+
8
+ state = {
9
+ selectedKey: null
10
+ }
11
+
12
+
13
+ render() {
14
+ return <Splitter>
15
+ <Splitter.Panel defaultSize={600} style={{paddingRight:16}}>
16
+ <Dict onChange={selectedKey => this.setState({selectedKey})}/>
17
+ </Splitter.Panel>
18
+ <Splitter.Panel style={{paddingLeft:16}}>
19
+ <DictItem sysDictId={this.state.selectedKey}/>
20
+ </Splitter.Panel>
21
+ </Splitter>
22
+
23
+
24
+ }
25
+ }