@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.
- package/config/dist/common-plugin.js +148 -0
- package/config/dist/config.js +45 -0
- package/config/dist/index.js +18 -0
- package/package.json +41 -0
- package/src/app.js +1 -0
- package/src/asserts/welcome.png +0 -0
- package/src/forms/demoForm.jsx +16 -0
- package/src/framework/components/DownloadFileButton.d.ts +11 -0
- package/src/framework/components/DownloadFileButton.jsx +33 -0
- package/src/framework/components/Ellipsis.jsx +39 -0
- package/src/framework/components/Ellipsis.less +8 -0
- package/src/framework/components/Gap/index.d.ts +23 -0
- package/src/framework/components/Gap/index.jsx +46 -0
- package/src/framework/components/LinkButton.d.ts +14 -0
- package/src/framework/components/LinkButton.jsx +10 -0
- package/src/framework/components/NamedIcon.tsx +15 -0
- package/src/framework/components/Page/index.d.ts +17 -0
- package/src/framework/components/Page/index.jsx +30 -0
- package/src/framework/components/Page/index.less +10 -0
- package/src/framework/components/PageLoading.tsx +27 -0
- package/src/framework/components/ProModal/index.tsx +66 -0
- package/src/framework/components/ProTable/components/ToolBar/index.jsx +123 -0
- package/src/framework/components/ProTable/components/ToolBar/index.less +53 -0
- package/src/framework/components/ProTable/index.d.ts +42 -0
- package/src/framework/components/ProTable/index.jsx +260 -0
- package/src/framework/components/ProTable/index.less +14 -0
- package/src/framework/components/ProTable/utils/index.js +43 -0
- package/src/framework/components/ValueType/index.jsx +34 -0
- package/src/framework/components/ValueType/registry.jsx +27 -0
- package/src/framework/components/index.ts +17 -0
- package/src/framework/components/system/ButtonList.d.ts +8 -0
- package/src/framework/components/system/ButtonList.jsx +42 -0
- package/src/framework/components/system/HasPerm.tsx +14 -0
- package/src/framework/components/system/index.tsx +29 -0
- package/src/framework/components/view/ViewBooleanEnableDisable.tsx +20 -0
- package/src/framework/components/view/ViewEllipsis.d.ts +11 -0
- package/src/framework/components/view/ViewEllipsis.jsx +30 -0
- package/src/framework/components/view/ViewFile.d.ts +10 -0
- package/src/framework/components/view/ViewFile.jsx +49 -0
- package/src/framework/components/view/ViewFileButton.d.ts +10 -0
- package/src/framework/components/view/ViewFileButton.jsx +0 -0
- package/src/framework/components/view/ViewImage.d.ts +9 -0
- package/src/framework/components/view/ViewImage.jsx +60 -0
- package/src/framework/components/view/ViewRange/index.d.ts +16 -0
- package/src/framework/components/view/ViewRange/index.jsx +20 -0
- package/src/framework/components/view/ViewText.tsx +16 -0
- package/src/framework/components/view/index.ts +10 -0
- package/src/framework/field-components/FieldBoolean.d.ts +13 -0
- package/src/framework/field-components/FieldBoolean.jsx +76 -0
- package/src/framework/field-components/FieldDate.d.ts +27 -0
- package/src/framework/field-components/FieldDate.jsx +114 -0
- package/src/framework/field-components/FieldDateRange.d.ts +6 -0
- package/src/framework/field-components/FieldDateRange.jsx +104 -0
- package/src/framework/field-components/FieldDictSelect.d.ts +13 -0
- package/src/framework/field-components/FieldDictSelect.jsx +16 -0
- package/src/framework/field-components/FieldEditor.d.ts +10 -0
- package/src/framework/field-components/FieldEditor.jsx +58 -0
- package/src/framework/field-components/FieldNumberRange.d.ts +13 -0
- package/src/framework/field-components/FieldNumberRange.jsx +59 -0
- package/src/framework/field-components/FieldPercent.d.ts +12 -0
- package/src/framework/field-components/FieldPercent.jsx +27 -0
- package/src/framework/field-components/FieldRemoteSelect.d.ts +13 -0
- package/src/framework/field-components/FieldRemoteSelect.jsx +87 -0
- package/src/framework/field-components/FieldRemoteSelectMultiple.d.ts +13 -0
- package/src/framework/field-components/FieldRemoteSelectMultiple.jsx +86 -0
- package/src/framework/field-components/FieldRemoteSelectMultipleInline.d.ts +20 -0
- package/src/framework/field-components/FieldRemoteSelectMultipleInline.jsx +86 -0
- package/src/framework/field-components/FieldRemoteTree.d.ts +21 -0
- package/src/framework/field-components/FieldRemoteTree.jsx +45 -0
- package/src/framework/field-components/FieldRemoteTreeCascader.d.ts +23 -0
- package/src/framework/field-components/FieldRemoteTreeCascader.jsx +61 -0
- package/src/framework/field-components/FieldRemoteTreeSelect.d.ts +17 -0
- package/src/framework/field-components/FieldRemoteTreeSelect.jsx +67 -0
- package/src/framework/field-components/FieldRemoteTreeSelectMultiple.d.ts +17 -0
- package/src/framework/field-components/FieldRemoteTreeSelectMultiple.jsx +72 -0
- package/src/framework/field-components/FieldSysOrgTree.d.ts +12 -0
- package/src/framework/field-components/FieldSysOrgTree.jsx +23 -0
- package/src/framework/field-components/FieldSysOrgTreeSelect.d.ts +12 -0
- package/src/framework/field-components/FieldSysOrgTreeSelect.jsx +23 -0
- package/src/framework/field-components/FieldTable.d.ts +17 -0
- package/src/framework/field-components/FieldTable.jsx +108 -0
- package/src/framework/field-components/FieldTable.less +29 -0
- package/src/framework/field-components/FieldTableSelect.d.ts +19 -0
- package/src/framework/field-components/FieldTableSelect.jsx +59 -0
- package/src/framework/field-components/FieldUploadFile.d.ts +34 -0
- package/src/framework/field-components/FieldUploadFile.jsx +141 -0
- package/src/framework/field-components/index.ts +21 -0
- package/src/framework/field-components/system/OrgTree.tsx +61 -0
- package/src/framework/field-components/system/RoleTree.tsx +53 -0
- package/src/framework/field-components/system/index.ts +2 -0
- package/src/framework/index.ts +5 -0
- package/src/framework/pages/LoginPage.d.ts +16 -0
- package/src/framework/pages/LoginPage.jsx +135 -0
- package/src/framework/pages/LoginPage.less +53 -0
- package/src/framework/pages/LoginPageUtils.ts +36 -0
- package/src/framework/pages/index.ts +2 -0
- package/src/framework/utils/ArrUtils.ts +229 -0
- package/src/framework/utils/ColorsUtils.ts +378 -0
- package/src/framework/utils/DateUtils.ts +187 -0
- package/src/framework/utils/DeviceUtils.ts +46 -0
- package/src/framework/utils/DomUtils.ts +50 -0
- package/src/framework/utils/EventBusUtils.ts +144 -0
- package/src/framework/utils/Logger.ts +40 -0
- package/src/framework/utils/MessageUtils.tsx +170 -0
- package/src/framework/utils/ObjectUtils.ts +118 -0
- package/src/framework/utils/StorageUtils.ts +50 -0
- package/src/framework/utils/StringUtils.ts +436 -0
- package/src/framework/utils/TreeUtils.ts +251 -0
- package/src/framework/utils/UrlUtils.ts +152 -0
- package/src/framework/utils/UuidUtils.ts +88 -0
- package/src/framework/utils/ValidateUtils.ts +28 -0
- package/src/framework/utils/index.ts +16 -0
- package/src/framework/utils/system/DictUtils.ts +97 -0
- package/src/framework/utils/system/FormRegistryUtils.ts +77 -0
- package/src/framework/utils/system/HttpUtils.ts +247 -0
- package/src/framework/utils/system/PageUtils.ts +163 -0
- package/src/framework/utils/system/PermUtils.ts +79 -0
- package/src/framework/utils/system/SysUtils.ts +97 -0
- package/src/framework/utils/system/ThemeUtils.ts +27 -0
- package/src/framework/utils/system/index.ts +7 -0
- package/src/framework/view-components/ViewApproveStatus.tsx +26 -0
- package/src/framework/view-components/ViewBoolean.tsx +6 -0
- package/src/framework/view-components/ViewFlowableInstanceProgress.d.ts +12 -0
- package/src/framework/view-components/ViewFlowableInstanceProgress.jsx +97 -0
- package/src/framework/view-components/ViewFlowableInstanceProgressButton.tsx +26 -0
- package/src/framework/view-components/ViewPassword.tsx +25 -0
- package/src/framework/view-components/ViewProps.ts +11 -0
- package/src/framework/view-components/index.ts +6 -0
- package/src/index.ts +2 -0
- package/src/layouts/PageRender.d.ts +22 -0
- package/src/layouts/PageRender.jsx +90 -0
- package/src/layouts/admin/HeaderRight.jsx +104 -0
- package/src/layouts/admin/TabPageRender.jsx +158 -0
- package/src/layouts/admin/index.jsx +161 -0
- package/src/layouts/admin/index.less +65 -0
- package/src/layouts/index.jsx +165 -0
- package/src/layouts/index.less +24 -0
- package/src/loading.jsx +18 -0
- package/src/pages/404.jsx +13 -0
- package/src/pages/about.jsx +14 -0
- package/src/pages/index.jsx +25 -0
- package/src/pages/login.jsx +21 -0
- package/src/pages/system/api/ApiDoc.jsx +144 -0
- package/src/pages/system/api/index.jsx +268 -0
- package/src/pages/system/api/perm.jsx +69 -0
- package/src/pages/system/dict/Dict.jsx +72 -0
- package/src/pages/system/dict/DictItem.jsx +177 -0
- package/src/pages/system/dict/index.jsx +25 -0
- package/src/pages/system/file/index.jsx +160 -0
- package/src/pages/system/job/index.jsx +324 -0
- package/src/pages/system/log/index.jsx +78 -0
- package/src/pages/system/org/index.jsx +262 -0
- package/src/pages/system/role/index.jsx +308 -0
- package/src/pages/system/role/perm.jsx +108 -0
- package/src/pages/system/sysManual/index.jsx +127 -0
- package/src/pages/system/user/UserPerm.jsx +97 -0
- package/src/pages/system/user/index.jsx +258 -0
- package/src/pages/test.jsx +200 -0
- package/src/pages/ureport/index.jsx +16 -0
- package/src/pages/userCenter/ChangePassword.jsx +63 -0
- package/src/pages/userCenter/index.jsx +90 -0
- package/src/pages/userCenter/manual.jsx +59 -0
- package/src/pages/userCenter/message.jsx +105 -0
- package/src/style/global.less +51 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import {Button, Form, Input, Modal, Popconfirm} from 'antd'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import {
|
|
4
|
+
ButtonList,
|
|
5
|
+
FieldDateRange,
|
|
6
|
+
FieldDictSelect,
|
|
7
|
+
FieldUploadFile,
|
|
8
|
+
HttpUtils,
|
|
9
|
+
ProTable,
|
|
10
|
+
SysUtils
|
|
11
|
+
} from "../../../framework";
|
|
12
|
+
import {CloudUploadOutlined} from "@ant-design/icons";
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export default class extends React.Component {
|
|
16
|
+
|
|
17
|
+
state = {
|
|
18
|
+
formOpen: false,
|
|
19
|
+
formValues: {}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
tableRef = React.createRef()
|
|
23
|
+
formRef = React.createRef()
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
columns = [
|
|
27
|
+
{
|
|
28
|
+
title: '原始名称',
|
|
29
|
+
tooltip: '上传时候的文件名',
|
|
30
|
+
dataIndex: 'originName',
|
|
31
|
+
width:200,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
title: '存储名称',
|
|
35
|
+
dataIndex: 'objectName',
|
|
36
|
+
tooltip: '文件唯一标识id'
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
{
|
|
40
|
+
title: '文件大小',
|
|
41
|
+
dataIndex: 'sizeInfo',
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
{
|
|
45
|
+
title: 'mime',
|
|
46
|
+
dataIndex: 'mimeType',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
title: '扩展名',
|
|
50
|
+
dataIndex: 'suffix',
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
{
|
|
54
|
+
title: '上传时间',
|
|
55
|
+
dataIndex: 'createTime',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
title: '上传者',
|
|
59
|
+
dataIndex: 'createUserLabel',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
title: '预览',
|
|
63
|
+
dataIndex: 'id',
|
|
64
|
+
render(id,record){
|
|
65
|
+
const nodes = [ <a href={'/admin/sysFile/preview/' + record.id } target='_blank'>预览</a>]
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
if(record.imageUrls?.length > 0){
|
|
69
|
+
for(let item of record.imageUrls){
|
|
70
|
+
let url = item.url;
|
|
71
|
+
let label = item.label;
|
|
72
|
+
nodes.push(<a href={( url) } target='_blank' style={{marginLeft:8}} >{label}</a>)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return nodes;
|
|
77
|
+
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
title: '操作',
|
|
82
|
+
dataIndex: 'option',
|
|
83
|
+
render: (_, record) => (
|
|
84
|
+
<ButtonList>
|
|
85
|
+
<Popconfirm perm='sysFile:delete' title='是否确定删除文件信息'
|
|
86
|
+
onConfirm={() => this.handleDelete(record)}>
|
|
87
|
+
<a>删除</a>
|
|
88
|
+
</Popconfirm>
|
|
89
|
+
</ButtonList>
|
|
90
|
+
),
|
|
91
|
+
},
|
|
92
|
+
]
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
handleDelete = row => {
|
|
96
|
+
HttpUtils.get('admin/sysFile/delete', row).then(rs => {
|
|
97
|
+
this.tableRef.current.reload()
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
render() {
|
|
104
|
+
return <>
|
|
105
|
+
<ProTable
|
|
106
|
+
actionRef={this.tableRef}
|
|
107
|
+
toolBarRender={() => {
|
|
108
|
+
return <Button type='primary' icon={<CloudUploadOutlined/>}
|
|
109
|
+
onClick={() => this.setState({formOpen: true})}>
|
|
110
|
+
上传文件
|
|
111
|
+
</Button>
|
|
112
|
+
}}
|
|
113
|
+
request={(params) => {
|
|
114
|
+
return HttpUtils.get('admin/sysFile/page', params);
|
|
115
|
+
}}
|
|
116
|
+
|
|
117
|
+
columns={this.columns}
|
|
118
|
+
|
|
119
|
+
>
|
|
120
|
+
<Form.Item label='文件名' name='originName'>
|
|
121
|
+
<Input/>
|
|
122
|
+
</Form.Item>
|
|
123
|
+
<Form.Item label='对象名称' name='objectName'>
|
|
124
|
+
<Input/>
|
|
125
|
+
</Form.Item>
|
|
126
|
+
<Form.Item label='类型' name='type'>
|
|
127
|
+
<FieldDictSelect typeCode='materialType'/>
|
|
128
|
+
</Form.Item>
|
|
129
|
+
|
|
130
|
+
<Form.Item label='上传时间' name='dateRange'>
|
|
131
|
+
<FieldDateRange/>
|
|
132
|
+
</Form.Item>
|
|
133
|
+
</ProTable>
|
|
134
|
+
|
|
135
|
+
<Modal open={this.state.formOpen} title='上传文件'
|
|
136
|
+
width={800}
|
|
137
|
+
onCancel={() => {
|
|
138
|
+
this.setState({formOpen: false})
|
|
139
|
+
this.tableRef.current.reload()
|
|
140
|
+
}}
|
|
141
|
+
footer={null}
|
|
142
|
+
destroyOnHidden
|
|
143
|
+
>
|
|
144
|
+
<Form ref={this.formRef}
|
|
145
|
+
initialValues={this.state.formValues}
|
|
146
|
+
>
|
|
147
|
+
<Form.Item name='文件'>
|
|
148
|
+
<FieldUploadFile accept="*/*"/>
|
|
149
|
+
</Form.Item>
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
</Form>
|
|
153
|
+
</Modal>
|
|
154
|
+
|
|
155
|
+
</>
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Alert,
|
|
3
|
+
AutoComplete,
|
|
4
|
+
Button,
|
|
5
|
+
Divider,
|
|
6
|
+
Form,
|
|
7
|
+
Input,
|
|
8
|
+
message,
|
|
9
|
+
Modal,
|
|
10
|
+
Popconfirm,
|
|
11
|
+
Select,
|
|
12
|
+
Space,
|
|
13
|
+
Switch,
|
|
14
|
+
Tag
|
|
15
|
+
} from 'antd'
|
|
16
|
+
import React from 'react'
|
|
17
|
+
import {PlusOutlined} from "@ant-design/icons";
|
|
18
|
+
import {ButtonList, HttpUtils, Page, ProTable, StringUtils, ValueType} from "../../../framework";
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
const cronOptions = [
|
|
22
|
+
{
|
|
23
|
+
label: '*/5 * * * * ? 每隔5秒',
|
|
24
|
+
value: '*/5 * * * * ?'
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: '0 */5 * * * ? 每隔5分钟',
|
|
28
|
+
value: '0 */5 * * * ?'
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: '0 0 22 * * ? 每天22点',
|
|
32
|
+
value: '0 0 22 * * ?'
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
label: '0 0 1 * * ? 每天1点',
|
|
36
|
+
value: '0 0 1 * * ?'
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: '0 0 1 1 * ? 每月1号凌晨1点',
|
|
40
|
+
value: '0 0 1 1 * ?'
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
export default class extends React.Component {
|
|
46
|
+
|
|
47
|
+
state = {
|
|
48
|
+
formValues: {},
|
|
49
|
+
formOpen: false,
|
|
50
|
+
|
|
51
|
+
selectedRowKeys: [],
|
|
52
|
+
|
|
53
|
+
jobClassOptions: [],
|
|
54
|
+
|
|
55
|
+
paramList: [],
|
|
56
|
+
|
|
57
|
+
statusOpen: false,
|
|
58
|
+
status: null,
|
|
59
|
+
|
|
60
|
+
executeRecordOpen: false,
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
componentDidMount() {
|
|
64
|
+
HttpUtils.get('admin/job/jobClassOptions').then(rs => {
|
|
65
|
+
this.setState({jobClassOptions: rs})
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
tableRef = React.createRef()
|
|
70
|
+
formRef = React.createRef()
|
|
71
|
+
|
|
72
|
+
columns = [
|
|
73
|
+
{
|
|
74
|
+
title: '名称',
|
|
75
|
+
dataIndex: 'name',
|
|
76
|
+
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
title: '执行类',
|
|
80
|
+
dataIndex: 'jobClass',
|
|
81
|
+
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
{
|
|
85
|
+
title: 'cron',
|
|
86
|
+
dataIndex: 'cron',
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
{
|
|
91
|
+
title: '参数',
|
|
92
|
+
dataIndex: 'jobData',
|
|
93
|
+
render(list) {
|
|
94
|
+
if (list)
|
|
95
|
+
return JSON.stringify(list)
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
{
|
|
102
|
+
title: '启用状态',
|
|
103
|
+
dataIndex: 'enabled',
|
|
104
|
+
render: (v, record) => {
|
|
105
|
+
return record.enabled ? <Tag color='green'>启用</Tag> : <Tag color='red'>停用</Tag>
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
{
|
|
110
|
+
title: '操作',
|
|
111
|
+
dataIndex: 'option',
|
|
112
|
+
fixed: 'right',
|
|
113
|
+
render: (_, record) => {
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<Space>
|
|
117
|
+
<Button size='small' onClick={()=>this.showExecuteRecord(record)}>执行记录</Button>
|
|
118
|
+
<Button size='small' onClick={() => this.handleTriggerJob(record)}>执行一次</Button>
|
|
119
|
+
<Button size='small' onClick={() => this.handleEdit(record)}> 编辑 </Button>
|
|
120
|
+
<Popconfirm title='是否确定删除?' onConfirm={() => this.handleDelete(record)}>
|
|
121
|
+
<Button size='small'>删除</Button>
|
|
122
|
+
</Popconfirm>
|
|
123
|
+
</Space>
|
|
124
|
+
);
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
]
|
|
129
|
+
|
|
130
|
+
handleAdd = () => {
|
|
131
|
+
this.setState({formOpen: true, formValues: {}, paramList: []})
|
|
132
|
+
}
|
|
133
|
+
handleEdit = (record) => {
|
|
134
|
+
this.loadJobParamFields(record.jobClass, record.jobData)
|
|
135
|
+
this.setState({formOpen: true, formValues: record,})
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
loadJobParamFields(className, jobData) {
|
|
139
|
+
HttpUtils.post("admin/job/getJobParamFields", jobData || {}, {className}).then(rs => {
|
|
140
|
+
this.setState({paramList: rs})
|
|
141
|
+
})
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
onFinish = (values) => {
|
|
145
|
+
HttpUtils.post('admin/job/save', values).then(rs => {
|
|
146
|
+
this.setState({formOpen: false})
|
|
147
|
+
this.tableRef.current.reload();
|
|
148
|
+
})
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
handleDelete = row => {
|
|
152
|
+
const hide = message.loading("删除作业中...")
|
|
153
|
+
HttpUtils.get('admin/job/delete', {id: row.id}).then(rs => {
|
|
154
|
+
this.tableRef.current.reload();
|
|
155
|
+
}).catch(hide)
|
|
156
|
+
}
|
|
157
|
+
handleTriggerJob = row => {
|
|
158
|
+
HttpUtils.get('admin/job/triggerJob', {id: row.id}).then(rs => {
|
|
159
|
+
this.tableRef.current.reload();
|
|
160
|
+
})
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
showStatus = () => {
|
|
164
|
+
this.setState({statusOpen: true})
|
|
165
|
+
HttpUtils.get('admin/job/status').then(rs => {
|
|
166
|
+
this.setState({status: rs})
|
|
167
|
+
})
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
showExecuteRecord(record) {
|
|
171
|
+
this.setState({executeRecordOpen: true,formValues: record})
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
render() {
|
|
176
|
+
return <Page padding>
|
|
177
|
+
<ProTable
|
|
178
|
+
actionRef={this.tableRef}
|
|
179
|
+
toolBarRender={() => {
|
|
180
|
+
return <ButtonList>
|
|
181
|
+
<Button type='primary' onClick={() => this.handleAdd()} icon={<PlusOutlined/>}>
|
|
182
|
+
新增
|
|
183
|
+
</Button>
|
|
184
|
+
<Button onClick={this.showStatus}>
|
|
185
|
+
查看状态
|
|
186
|
+
</Button>
|
|
187
|
+
</ButtonList>
|
|
188
|
+
}}
|
|
189
|
+
request={(params) => HttpUtils.get('admin/job/page', params)}
|
|
190
|
+
columns={this.columns}
|
|
191
|
+
showToolbarSearch
|
|
192
|
+
/>
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
<Modal title='作业调度'
|
|
196
|
+
open={this.state.formOpen}
|
|
197
|
+
destroyOnHidden
|
|
198
|
+
width={800}
|
|
199
|
+
onOk={() => this.formRef.current.submit()}
|
|
200
|
+
onCancel={() => this.setState({formOpen: false})}
|
|
201
|
+
>
|
|
202
|
+
|
|
203
|
+
<Form ref={this.formRef} labelCol={{flex: '100px'}}
|
|
204
|
+
initialValues={this.state.formValues}
|
|
205
|
+
onValuesChange={this.onValuesChange}
|
|
206
|
+
onFinish={this.onFinish}>
|
|
207
|
+
<Form.Item name='id' noStyle>
|
|
208
|
+
</Form.Item>
|
|
209
|
+
<Form.Item label='执行类' name='jobClass' rules={[{required: true}]}
|
|
210
|
+
tooltip='org.quartz.Job接口,参考io.tmgg.job.builtin.DemoJob'>
|
|
211
|
+
<Select options={this.state.jobClassOptions}/>
|
|
212
|
+
</Form.Item>
|
|
213
|
+
<Form.Item label='名称' name='name' rules={[{required: true}]}>
|
|
214
|
+
<Input/>
|
|
215
|
+
</Form.Item>
|
|
216
|
+
|
|
217
|
+
<Form.Item label='cron表达式' name='cron' help='格式:秒分时日月周,留空表示手动执行'
|
|
218
|
+
rules={[{required: true}]}>
|
|
219
|
+
<AutoComplete placeholder='如 0 */5 * * * ?' options={cronOptions}/>
|
|
220
|
+
</Form.Item>
|
|
221
|
+
|
|
222
|
+
<Form.Item label='启用' name='enabled' valuePropName='checked' rules={[{required: true}]}>
|
|
223
|
+
<Switch/>
|
|
224
|
+
</Form.Item>
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
{this.state.paramList?.map(p => (
|
|
228
|
+
<div key={p.name}>
|
|
229
|
+
<Divider>作业参数</Divider>
|
|
230
|
+
<Form.Item label={p.label}
|
|
231
|
+
name={['jobData', p.name]}
|
|
232
|
+
key={p.name}
|
|
233
|
+
rules={[{required: p.required}]}>
|
|
234
|
+
{ValueType.renderField(p.componentType, p.componentProps)}
|
|
235
|
+
</Form.Item>
|
|
236
|
+
</div>
|
|
237
|
+
))}
|
|
238
|
+
</Form>
|
|
239
|
+
</Modal>
|
|
240
|
+
|
|
241
|
+
<Modal title='作业调度状态'
|
|
242
|
+
open={this.state.statusOpen}
|
|
243
|
+
onCancel={() => this.setState({statusOpen: false})}
|
|
244
|
+
footer={null}
|
|
245
|
+
width={1024}
|
|
246
|
+
>
|
|
247
|
+
<Alert message={<pre>{this.state.status}</pre>}></Alert>
|
|
248
|
+
|
|
249
|
+
</Modal>
|
|
250
|
+
|
|
251
|
+
<Modal title='作业调度记录'
|
|
252
|
+
open={this.state.executeRecordOpen}
|
|
253
|
+
onCancel={() => this.setState({executeRecordOpen: false})}
|
|
254
|
+
footer={null}
|
|
255
|
+
width={1024}
|
|
256
|
+
destroyOnHidden
|
|
257
|
+
>
|
|
258
|
+
<ProTable columns={[{
|
|
259
|
+
title: '开始时间',
|
|
260
|
+
dataIndex: 'beginTime',
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
title: '结束时间',
|
|
264
|
+
dataIndex: 'endTime',
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
title: '耗时',
|
|
268
|
+
dataIndex: 'jobRunTimeLabel',
|
|
269
|
+
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
title: '是否成功',
|
|
273
|
+
dataIndex: 'success',
|
|
274
|
+
width: 200,
|
|
275
|
+
render:v=>{
|
|
276
|
+
if(v != null){
|
|
277
|
+
return v ? '成功':'异常'
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
title: '返回结果',
|
|
283
|
+
dataIndex: 'result',
|
|
284
|
+
width:300
|
|
285
|
+
},
|
|
286
|
+
|
|
287
|
+
{
|
|
288
|
+
title: '操作',
|
|
289
|
+
dataIndex: 'option',
|
|
290
|
+
render: (_, record) => {
|
|
291
|
+
let url = '/admin/sys/log/'+ record.id;
|
|
292
|
+
return <a href={url} target='_blank'>日志</a>;
|
|
293
|
+
},
|
|
294
|
+
}
|
|
295
|
+
]} request={params => {
|
|
296
|
+
params.jobId = this.state.formValues.id
|
|
297
|
+
return HttpUtils.get('admin/job/executeRecord', params);
|
|
298
|
+
}}></ProTable>
|
|
299
|
+
|
|
300
|
+
</Modal>
|
|
301
|
+
</Page>
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
onValuesChange = (changed, values) => {
|
|
305
|
+
if (changed.jobClass) {
|
|
306
|
+
this.loadJobParamFields(values.jobClass)
|
|
307
|
+
const option = this.state.jobClassOptions.find(o => o.value === changed.jobClass)
|
|
308
|
+
if (option) {
|
|
309
|
+
let {label} = option;
|
|
310
|
+
if (StringUtils.contains(label, " ")) { // 取中文名部门设置为name
|
|
311
|
+
this.formRef.current.setFieldValue("name", label.split(" ")[1])
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
if (changed.jobData) {
|
|
317
|
+
this.loadJobParamFields(values.jobClass, values.jobData)
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React, {Fragment} from 'react';
|
|
2
|
+
import {Form, Input, Tag} from "antd";
|
|
3
|
+
import {Ellipsis, FieldDateRange, HttpUtils, ProTable} from "../../../framework";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export default class extends React.Component {
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
columns = [
|
|
10
|
+
{
|
|
11
|
+
title: '操作',
|
|
12
|
+
dataIndex: 'operation',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
title: '操作者',
|
|
16
|
+
dataIndex: 'username'
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
{
|
|
20
|
+
title: 'ip',
|
|
21
|
+
dataIndex: 'ip',
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
{
|
|
26
|
+
title: '时间',
|
|
27
|
+
dataIndex: 'operationTime',
|
|
28
|
+
sorter: true,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
title: '参数',
|
|
32
|
+
dataIndex: 'params',
|
|
33
|
+
render(v) {
|
|
34
|
+
return <Ellipsis pre={true}>{v}</Ellipsis>
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
title: '结果',
|
|
40
|
+
dataIndex: 'success',
|
|
41
|
+
render(v) {
|
|
42
|
+
return <>
|
|
43
|
+
<Tag color={v ? 'green' : 'red'}>{v ? '成功' : '失败'}</Tag>
|
|
44
|
+
</>
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
title: '错误消息',
|
|
49
|
+
dataIndex: 'error',
|
|
50
|
+
render(v) {
|
|
51
|
+
return <Ellipsis>{v}</Ellipsis>
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
render() {
|
|
58
|
+
return <>
|
|
59
|
+
<ProTable
|
|
60
|
+
request={(params) => HttpUtils.get('admin/sysLog/page', params)}
|
|
61
|
+
columns={this.columns}
|
|
62
|
+
>
|
|
63
|
+
<Form.Item label='操作' name='operation'>
|
|
64
|
+
<Input/>
|
|
65
|
+
</Form.Item>
|
|
66
|
+
<Form.Item label='时间' name='dateRange'>
|
|
67
|
+
<FieldDateRange/>
|
|
68
|
+
</Form.Item>
|
|
69
|
+
</ProTable>
|
|
70
|
+
|
|
71
|
+
</>
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|