@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,10 +1,11 @@
|
|
|
1
1
|
import {DeleteOutlined, EditOutlined, PlusOutlined} from '@ant-design/icons';
|
|
2
|
-
import {Button, Card, Descriptions, Empty, Form, Input, InputNumber,
|
|
2
|
+
import {Button, Card, Descriptions, Empty, Form, Input, InputNumber, Popconfirm, Splitter, Tree, Tag, TreeSelect, Typography} from 'antd';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import {
|
|
5
5
|
PermActions,
|
|
6
6
|
FieldBoolean,
|
|
7
7
|
FieldDictSelect,
|
|
8
|
+
FormModal,
|
|
8
9
|
HttpUtils,
|
|
9
10
|
Page,
|
|
10
11
|
ProTable,
|
|
@@ -18,16 +19,10 @@ export default class extends React.Component {
|
|
|
18
19
|
treeLoading: false,
|
|
19
20
|
selectedType: null,
|
|
20
21
|
selectedTypeCode: null,
|
|
21
|
-
|
|
22
|
-
formOpen: false,
|
|
23
|
-
formValues: {},
|
|
24
|
-
typeFormOpen: false,
|
|
25
|
-
typeFormValues: {},
|
|
26
|
-
|
|
27
22
|
}
|
|
28
23
|
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
modalRef = React.createRef();
|
|
25
|
+
typeModalRef = React.createRef();
|
|
31
26
|
tableRef = React.createRef();
|
|
32
27
|
|
|
33
28
|
componentDidMount() {
|
|
@@ -44,16 +39,13 @@ export default class extends React.Component {
|
|
|
44
39
|
}
|
|
45
40
|
|
|
46
41
|
handleTypeAdd = () => {
|
|
47
|
-
this.
|
|
48
|
-
typeFormOpen: true,
|
|
49
|
-
typeFormValues: {pid: this.state.selectedType?.id, enabled: true},
|
|
50
|
-
})
|
|
42
|
+
this.typeModalRef.current.open({pid: this.state.selectedType?.id, enabled: true})
|
|
51
43
|
}
|
|
52
44
|
|
|
53
45
|
handleTypeEdit = () => {
|
|
54
46
|
const {selectedType} = this.state
|
|
55
47
|
if (!selectedType) return
|
|
56
|
-
this.
|
|
48
|
+
this.typeModalRef.current.open({...selectedType})
|
|
57
49
|
}
|
|
58
50
|
|
|
59
51
|
handleTypeDelete = () => {
|
|
@@ -65,13 +57,11 @@ export default class extends React.Component {
|
|
|
65
57
|
})
|
|
66
58
|
}
|
|
67
59
|
|
|
68
|
-
handleTypeFormFinish = values => {
|
|
60
|
+
handleTypeFormFinish = async values => {
|
|
69
61
|
const isNew = !values.id
|
|
70
62
|
const url = isNew ? 'admin/dict/type-create' : 'admin/dict/type-update'
|
|
71
|
-
HttpUtils.post(url, values)
|
|
72
|
-
|
|
73
|
-
this.loadTree()
|
|
74
|
-
})
|
|
63
|
+
await HttpUtils.post(url, values)
|
|
64
|
+
this.loadTree()
|
|
75
65
|
}
|
|
76
66
|
|
|
77
67
|
findNode = (nodes, key) => {
|
|
@@ -105,11 +95,11 @@ export default class extends React.Component {
|
|
|
105
95
|
}
|
|
106
96
|
|
|
107
97
|
handleItemAdd = () => {
|
|
108
|
-
this.
|
|
98
|
+
this.modalRef.current.open({typeCode: this.state.selectedTypeCode})
|
|
109
99
|
}
|
|
110
100
|
|
|
111
101
|
handleItemEdit = record => {
|
|
112
|
-
this.
|
|
102
|
+
this.modalRef.current.open(record)
|
|
113
103
|
}
|
|
114
104
|
|
|
115
105
|
handleItemDelete = row => {
|
|
@@ -118,13 +108,11 @@ export default class extends React.Component {
|
|
|
118
108
|
})
|
|
119
109
|
}
|
|
120
110
|
|
|
121
|
-
onItemFormFinish = values => {
|
|
111
|
+
onItemFormFinish = async values => {
|
|
122
112
|
const isNew = !values.id
|
|
123
113
|
const url = isNew ? 'admin/dict/create' : 'admin/dict/update'
|
|
124
|
-
HttpUtils.post(url, values)
|
|
125
|
-
|
|
126
|
-
this.tableRef.current.reload()
|
|
127
|
-
})
|
|
114
|
+
await HttpUtils.post(url, values)
|
|
115
|
+
this.tableRef.current.reload()
|
|
128
116
|
}
|
|
129
117
|
|
|
130
118
|
columns = [
|
|
@@ -164,14 +152,16 @@ export default class extends React.Component {
|
|
|
164
152
|
const {selectedType, selectedTypeCode} = this.state
|
|
165
153
|
const hasTypeSelected = selectedType != null && selectedTypeCode != null
|
|
166
154
|
|
|
167
|
-
return <Page title="数据字典" description="管理数据字典类型和字典项"
|
|
168
|
-
actions={<Button perm='sys-dict:create' icon={<PlusOutlined/>} onClick={this.handleTypeAdd}>新增类型</Button>}>
|
|
155
|
+
return <Page title="数据字典" description="管理数据字典类型和字典项">
|
|
169
156
|
<Splitter>
|
|
170
157
|
<Splitter.Panel defaultSize={300} style={{paddingRight: 8}}>
|
|
171
158
|
<Card loading={this.state.treeLoading}
|
|
172
159
|
size='small'
|
|
160
|
+
title={<div style={{display: 'flex', justifyContent: 'space-between', alignItems: 'center'}}>
|
|
161
|
+
<Typography.Text strong>字典类型</Typography.Text>
|
|
162
|
+
<Button size='small' perm='sys-dict:create' icon={<PlusOutlined/>} onClick={this.handleTypeAdd}>新增类型</Button>
|
|
163
|
+
</div>}
|
|
173
164
|
>
|
|
174
|
-
<Typography.Text strong style={{marginBottom: 8, display: 'block'}}>字典类型</Typography.Text>
|
|
175
165
|
<Tree
|
|
176
166
|
treeData={this.state.typeTree}
|
|
177
167
|
onSelect={this.onTreeSelect}
|
|
@@ -226,69 +216,48 @@ export default class extends React.Component {
|
|
|
226
216
|
</Splitter.Panel>
|
|
227
217
|
</Splitter>
|
|
228
218
|
|
|
229
|
-
<
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
>
|
|
239
|
-
|
|
240
|
-
<
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
<
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
<Form.Item label='类型名称' name='typeLabel' rules={[{required: true}]}>
|
|
250
|
-
<Input placeholder='举例: 订单状态'/>
|
|
251
|
-
</Form.Item>
|
|
252
|
-
<Form.Item label='启用' name='enabled' rules={[{required: true}]}>
|
|
253
|
-
<FieldBoolean/>
|
|
254
|
-
</Form.Item>
|
|
255
|
-
<Form.Item label='序号' name='seq'>
|
|
256
|
-
<InputNumber/>
|
|
257
|
-
</Form.Item>
|
|
258
|
-
</Form>
|
|
259
|
-
</Modal>
|
|
219
|
+
<FormModal ref={this.typeModalRef} title='编辑字典类型'
|
|
220
|
+
onFinish={this.handleTypeFormFinish}>
|
|
221
|
+
<Form.Item label='父类型' name='pid'>
|
|
222
|
+
<TreeSelect treeData={this.state.typeTree}
|
|
223
|
+
fieldNames={{label: 'typeLabel', value: 'id'}}
|
|
224
|
+
allowClear/>
|
|
225
|
+
</Form.Item>
|
|
226
|
+
<Form.Item label='类型编码' name='typeCode' rules={[{required: true}]}>
|
|
227
|
+
<Input placeholder='举例: orderStatus'/>
|
|
228
|
+
</Form.Item>
|
|
229
|
+
<Form.Item label='类型名称' name='typeLabel' rules={[{required: true}]}>
|
|
230
|
+
<Input placeholder='举例: 订单状态'/>
|
|
231
|
+
</Form.Item>
|
|
232
|
+
<Form.Item label='启用' name='enabled' rules={[{required: true}]}>
|
|
233
|
+
<FieldBoolean/>
|
|
234
|
+
</Form.Item>
|
|
235
|
+
<Form.Item label='序号' name='seq'>
|
|
236
|
+
<InputNumber/>
|
|
237
|
+
</Form.Item>
|
|
238
|
+
</FormModal>
|
|
260
239
|
|
|
261
|
-
<
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
<FieldDictSelect typeCode='statusColor'/>
|
|
283
|
-
</Form.Item>
|
|
284
|
-
<Form.Item label='序号' name='seq'>
|
|
285
|
-
<InputNumber/>
|
|
286
|
-
</Form.Item>
|
|
287
|
-
<Form.Item label='启用' name='enabled' rules={[{required: true}]}>
|
|
288
|
-
<FieldBoolean/>
|
|
289
|
-
</Form.Item>
|
|
290
|
-
</Form>
|
|
291
|
-
</Modal>
|
|
240
|
+
<FormModal ref={this.modalRef} title='编辑字典项'
|
|
241
|
+
onFinish={this.onItemFormFinish}>
|
|
242
|
+
<Form.Item label='类型编码' name='typeCode'>
|
|
243
|
+
<Input disabled/>
|
|
244
|
+
</Form.Item>
|
|
245
|
+
<Form.Item label='编码' name='code' rules={[{required: true}]}>
|
|
246
|
+
<Input/>
|
|
247
|
+
</Form.Item>
|
|
248
|
+
<Form.Item label='标签' name='label' rules={[{required: true}]} help='显示文本'>
|
|
249
|
+
<Input/>
|
|
250
|
+
</Form.Item>
|
|
251
|
+
<Form.Item label='颜色' name='color'>
|
|
252
|
+
<FieldDictSelect typeCode='statusColor'/>
|
|
253
|
+
</Form.Item>
|
|
254
|
+
<Form.Item label='序号' name='seq'>
|
|
255
|
+
<InputNumber/>
|
|
256
|
+
</Form.Item>
|
|
257
|
+
<Form.Item label='启用' name='enabled' rules={[{required: true}]}>
|
|
258
|
+
<FieldBoolean/>
|
|
259
|
+
</Form.Item>
|
|
260
|
+
</FormModal>
|
|
292
261
|
</Page>
|
|
293
262
|
}
|
|
294
263
|
}
|
|
@@ -89,30 +89,36 @@ export default class extends React.Component {
|
|
|
89
89
|
]
|
|
90
90
|
|
|
91
91
|
render() {
|
|
92
|
-
return <Page title="文件管理" description="管理系统上传文件"
|
|
92
|
+
return <Page title="文件管理" description="管理系统上传文件">
|
|
93
93
|
<ProTable
|
|
94
94
|
actionRef={this.tableRef}
|
|
95
|
+
toolBarRender={() => (
|
|
96
|
+
<PermActions>
|
|
97
|
+
<Button type='primary' perm='sys-file:upload' icon={<CloudUploadOutlined/>} onClick={() => this.setState({formOpen: true})}>上传文件</Button>
|
|
98
|
+
</PermActions>
|
|
99
|
+
)}
|
|
95
100
|
request={(params) => {
|
|
96
101
|
return HttpUtils.get('admin/sysFile/page', params);
|
|
97
102
|
}}
|
|
98
103
|
|
|
99
104
|
columns={this.columns}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
105
|
+
searchFormRender={() => (
|
|
106
|
+
<>
|
|
107
|
+
<Form.Item label='文件名' name='originName'>
|
|
108
|
+
<Input/>
|
|
109
|
+
</Form.Item>
|
|
110
|
+
<Form.Item label='对象名称' name='objectName'>
|
|
111
|
+
<Input/>
|
|
112
|
+
</Form.Item>
|
|
113
|
+
<Form.Item label='类型' name='type'>
|
|
114
|
+
<FieldDictSelect typeCode='materialType'/>
|
|
115
|
+
</Form.Item>
|
|
116
|
+
<Form.Item label='上传时间' name='dateRange'>
|
|
117
|
+
<FieldDateRange/>
|
|
118
|
+
</Form.Item>
|
|
119
|
+
</>
|
|
120
|
+
)}
|
|
121
|
+
/>
|
|
116
122
|
|
|
117
123
|
<Modal open={this.state.formOpen} title='上传文件'
|
|
118
124
|
width={800}
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
Tag
|
|
16
16
|
} from 'antd'
|
|
17
17
|
import {PlusOutlined} from "@ant-design/icons";
|
|
18
|
-
import {HttpUtils, Page, ProTable, StringUtils, UrlUtils, ValueType} from "../../../framework";
|
|
18
|
+
import {FormModal, HttpUtils, Page, PermActions, ProTable, StringUtils, UrlUtils, ValueType} from "../../../framework";
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
const cronOptions = [
|
|
@@ -45,9 +45,6 @@ const cronOptions = [
|
|
|
45
45
|
export default class extends React.Component {
|
|
46
46
|
|
|
47
47
|
state = {
|
|
48
|
-
formValues: {},
|
|
49
|
-
formOpen: false,
|
|
50
|
-
|
|
51
48
|
selectedRowKeys: [],
|
|
52
49
|
|
|
53
50
|
jobClassOptions: [],
|
|
@@ -60,7 +57,7 @@ export default class extends React.Component {
|
|
|
60
57
|
executeRecordOpen: false,
|
|
61
58
|
}
|
|
62
59
|
tableRef = React.createRef()
|
|
63
|
-
|
|
60
|
+
modalRef = React.createRef()
|
|
64
61
|
|
|
65
62
|
componentDidMount() {
|
|
66
63
|
HttpUtils.get('admin/job/job-class-options').then(rs => {
|
|
@@ -71,12 +68,13 @@ export default class extends React.Component {
|
|
|
71
68
|
}
|
|
72
69
|
|
|
73
70
|
handleAdd = () => {
|
|
74
|
-
this.setState({
|
|
71
|
+
this.setState({paramList: []})
|
|
72
|
+
this.modalRef.current.open({})
|
|
75
73
|
}
|
|
76
74
|
|
|
77
75
|
handleEdit = (record) => {
|
|
78
76
|
this.loadJobParamFields(record.jobClass, record.jobData)
|
|
79
|
-
this.
|
|
77
|
+
this.modalRef.current.open(record)
|
|
80
78
|
}
|
|
81
79
|
|
|
82
80
|
loadJobParamFields(className, jobData) {
|
|
@@ -87,20 +85,17 @@ export default class extends React.Component {
|
|
|
87
85
|
})
|
|
88
86
|
}
|
|
89
87
|
|
|
90
|
-
onFinish =
|
|
88
|
+
onFinish = async values => {
|
|
91
89
|
const isNew = !values.id;
|
|
92
90
|
const url = isNew ? 'admin/job/create' : 'admin/job/update';
|
|
93
|
-
HttpUtils.post(url, values)
|
|
94
|
-
|
|
95
|
-
this.tableRef.current.reload();
|
|
96
|
-
}).catch(e => {
|
|
97
|
-
console.error('[Job] 保存作业失败:', e);
|
|
98
|
-
})
|
|
91
|
+
await HttpUtils.post(url, values)
|
|
92
|
+
this.tableRef.current.reload()
|
|
99
93
|
}
|
|
100
94
|
|
|
101
95
|
handleDelete = row => {
|
|
102
96
|
const hide = message.loading("删除作业中...")
|
|
103
97
|
HttpUtils.post('admin/job/delete', {id: row.id}).then(rs => {
|
|
98
|
+
hide();
|
|
104
99
|
this.tableRef.current.reload();
|
|
105
100
|
}).catch(e => {
|
|
106
101
|
console.error('[Job] 删除作业失败:', e);
|
|
@@ -109,7 +104,7 @@ export default class extends React.Component {
|
|
|
109
104
|
}
|
|
110
105
|
|
|
111
106
|
handleTriggerJob = row => {
|
|
112
|
-
HttpUtils.
|
|
107
|
+
HttpUtils.post('admin/job/trigger-job', {id: row.id}).then(rs => {
|
|
113
108
|
this.tableRef.current.reload();
|
|
114
109
|
}).catch(e => {
|
|
115
110
|
console.error('[Job] 触发作业失败:', e);
|
|
@@ -183,75 +178,71 @@ export default class extends React.Component {
|
|
|
183
178
|
};
|
|
184
179
|
|
|
185
180
|
showExecuteRecord(record) {
|
|
186
|
-
this.setState({executeRecordOpen: true,
|
|
181
|
+
this.setState({executeRecordOpen: true, selectedRecord: record})
|
|
187
182
|
}
|
|
188
183
|
|
|
189
184
|
|
|
190
185
|
render() {
|
|
191
|
-
return <Page title="作业调度" description="管理定时作业任务"
|
|
186
|
+
return <Page title="作业调度" description="管理定时作业任务">
|
|
192
187
|
<ProTable
|
|
193
188
|
actionRef={this.tableRef}
|
|
189
|
+
toolBarRender={() => (
|
|
190
|
+
<PermActions>
|
|
191
|
+
<Button type='primary' perm='job:create' icon={<PlusOutlined/>} onClick={() => this.handleAdd()}>新增</Button>
|
|
192
|
+
<Button perm='job:read' onClick={this.showStatus}>查看状态</Button>
|
|
193
|
+
</PermActions>
|
|
194
|
+
)}
|
|
194
195
|
request={(params) => HttpUtils.get('admin/job/page', params)}
|
|
195
196
|
columns={this.columns}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
197
|
+
searchFormRender={() => (
|
|
198
|
+
<>
|
|
199
|
+
<Form.Item label='名称' name='name'>
|
|
200
|
+
<Input/>
|
|
201
|
+
</Form.Item>
|
|
202
|
+
<Form.Item label='执行类' name='jobClass'>
|
|
203
|
+
<Input/>
|
|
204
|
+
</Form.Item>
|
|
205
|
+
</>
|
|
206
|
+
)}
|
|
207
|
+
/>
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
<FormModal ref={this.modalRef} title='作业调度' width={800}
|
|
211
|
+
onFinish={this.onFinish}
|
|
212
|
+
onValuesChange={this.onValuesChange}>
|
|
213
|
+
<Form.Item label='执行类' name='jobClass' rules={[{required: true}]}
|
|
214
|
+
tooltip='org.quartz.Job接口,参考io.tmgg.job.builtin.DemoJob'>
|
|
215
|
+
<Select options={this.state.jobClassOptions}/>
|
|
199
216
|
</Form.Item>
|
|
200
|
-
<Form.Item label='
|
|
217
|
+
<Form.Item label='名称' name='name' rules={[{required: true}]}>
|
|
201
218
|
<Input/>
|
|
202
219
|
</Form.Item>
|
|
203
|
-
</ProTable>
|
|
204
220
|
|
|
221
|
+
<Form.Item label='cron表达式' name='cron' help='格式:秒分时日月周,留空表示手动执行'
|
|
222
|
+
rules={[{required: true}]}>
|
|
223
|
+
<AutoComplete placeholder='如 0 */5 * * * ?' options={cronOptions}/>
|
|
224
|
+
</Form.Item>
|
|
205
225
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
width={800}
|
|
210
|
-
onOk={() => this.formRef.current.submit()}
|
|
211
|
-
onCancel={() => this.setState({formOpen: false})}
|
|
212
|
-
>
|
|
226
|
+
<Form.Item label='启用' name='enabled' valuePropName='checked' rules={[{required: true}]}>
|
|
227
|
+
<Switch/>
|
|
228
|
+
</Form.Item>
|
|
213
229
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
<AutoComplete placeholder='如 0 */5 * * * ?' options={cronOptions}/>
|
|
231
|
-
</Form.Item>
|
|
232
|
-
|
|
233
|
-
<Form.Item label='启用' name='enabled' valuePropName='checked' rules={[{required: true}]}>
|
|
234
|
-
<Switch/>
|
|
235
|
-
</Form.Item>
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
{this.state.paramList?.map(p => (
|
|
239
|
-
<div key={p.name}>
|
|
240
|
-
<Divider>作业参数</Divider>
|
|
241
|
-
<Form.Item label={p.label}
|
|
242
|
-
name={['jobData', p.name]}
|
|
243
|
-
key={p.name}
|
|
244
|
-
initialValue={p.defaultValue}
|
|
245
|
-
rules={[{required: p.required}]}>
|
|
246
|
-
{ValueType.renderField(p.componentType, {
|
|
247
|
-
...p.componentProps,
|
|
248
|
-
placeholder: p.placeholder || '请输入'
|
|
249
|
-
})}
|
|
250
|
-
</Form.Item>
|
|
251
|
-
</div>
|
|
252
|
-
))}
|
|
253
|
-
</Form>
|
|
254
|
-
</Modal>
|
|
230
|
+
{this.state.paramList?.map(p => (
|
|
231
|
+
<div key={p.name}>
|
|
232
|
+
<Divider>作业参数</Divider>
|
|
233
|
+
<Form.Item label={p.label}
|
|
234
|
+
name={['jobData', p.name]}
|
|
235
|
+
key={p.name}
|
|
236
|
+
initialValue={p.defaultValue}
|
|
237
|
+
rules={[{required: p.required}]}>
|
|
238
|
+
{ValueType.renderField(p.componentType, {
|
|
239
|
+
...p.componentProps,
|
|
240
|
+
placeholder: p.placeholder || '请输入'
|
|
241
|
+
})}
|
|
242
|
+
</Form.Item>
|
|
243
|
+
</div>
|
|
244
|
+
))}
|
|
245
|
+
</FormModal>
|
|
255
246
|
|
|
256
247
|
<Modal title='作业调度状态'
|
|
257
248
|
open={this.state.statusOpen}
|
|
@@ -308,7 +299,7 @@ export default class extends React.Component {
|
|
|
308
299
|
},
|
|
309
300
|
}
|
|
310
301
|
]} request={params => {
|
|
311
|
-
params.jobId = this.state.
|
|
302
|
+
params.jobId = this.state.selectedRecord.id
|
|
312
303
|
return HttpUtils.get('admin/job/execute-record', params);
|
|
313
304
|
}}></ProTable>
|
|
314
305
|
|
|
@@ -323,7 +314,7 @@ export default class extends React.Component {
|
|
|
323
314
|
if (option) {
|
|
324
315
|
const {label} = option;
|
|
325
316
|
if (StringUtils.contains(label, " ")) { // 取中文名部门设置为name
|
|
326
|
-
this.
|
|
317
|
+
this.modalRef.current.formInstance.setFieldValue("name", label.split(" ")[1])
|
|
327
318
|
}
|
|
328
319
|
}
|
|
329
320
|
}
|
|
@@ -59,14 +59,17 @@ export default class extends React.Component {
|
|
|
59
59
|
<ProTable
|
|
60
60
|
request={(params) => HttpUtils.get('admin/sysLog/page', params)}
|
|
61
61
|
columns={this.columns}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
62
|
+
searchFormRender={() => (
|
|
63
|
+
<>
|
|
64
|
+
<Form.Item label='操作' name='operation'>
|
|
65
|
+
<Input/>
|
|
66
|
+
</Form.Item>
|
|
67
|
+
<Form.Item label='时间' name='dateRange'>
|
|
68
|
+
<FieldDateRange/>
|
|
69
|
+
</Form.Item>
|
|
70
|
+
</>
|
|
71
|
+
)}
|
|
72
|
+
/>
|
|
70
73
|
</Page>
|
|
71
74
|
}
|
|
72
75
|
|