@jiangood/open-admin 2.5.1 → 2.5.5
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
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"dev": "umi dev",
|
|
38
38
|
"build": "umi build"
|
|
39
39
|
},
|
|
40
|
-
"version": "2.5.
|
|
40
|
+
"version": "2.5.5"
|
|
41
41
|
},
|
|
42
42
|
"pkgPath": "/home/runner/work/open-admin/open-admin/web/package.json",
|
|
43
43
|
"plugins": {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"config": {},
|
|
51
51
|
"time": {
|
|
52
52
|
"hooks": {},
|
|
53
|
-
"register":
|
|
53
|
+
"register": 1
|
|
54
54
|
},
|
|
55
55
|
"enableBy": "register"
|
|
56
56
|
},
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"time": {
|
|
95
95
|
"hooks": {
|
|
96
96
|
"onStart": [
|
|
97
|
-
|
|
97
|
+
0
|
|
98
98
|
]
|
|
99
99
|
},
|
|
100
100
|
"register": 2
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
0
|
|
115
115
|
]
|
|
116
116
|
},
|
|
117
|
-
"register":
|
|
117
|
+
"register": 1
|
|
118
118
|
},
|
|
119
119
|
"enableBy": "register"
|
|
120
120
|
},
|
|
@@ -141,10 +141,10 @@
|
|
|
141
141
|
"time": {
|
|
142
142
|
"hooks": {
|
|
143
143
|
"modifyAppData": [
|
|
144
|
-
|
|
144
|
+
71
|
|
145
145
|
]
|
|
146
146
|
},
|
|
147
|
-
"register":
|
|
147
|
+
"register": 21
|
|
148
148
|
},
|
|
149
149
|
"enableBy": "register"
|
|
150
150
|
},
|
|
@@ -207,7 +207,7 @@
|
|
|
207
207
|
"config": {},
|
|
208
208
|
"time": {
|
|
209
209
|
"hooks": {},
|
|
210
|
-
"register":
|
|
210
|
+
"register": 0
|
|
211
211
|
},
|
|
212
212
|
"enableBy": "config"
|
|
213
213
|
},
|
|
@@ -224,7 +224,7 @@
|
|
|
224
224
|
0
|
|
225
225
|
]
|
|
226
226
|
},
|
|
227
|
-
"register":
|
|
227
|
+
"register": 6
|
|
228
228
|
},
|
|
229
229
|
"enableBy": "register"
|
|
230
230
|
},
|
|
@@ -1106,7 +1106,7 @@
|
|
|
1106
1106
|
"config": {},
|
|
1107
1107
|
"time": {
|
|
1108
1108
|
"hooks": {},
|
|
1109
|
-
"register":
|
|
1109
|
+
"register": 0
|
|
1110
1110
|
},
|
|
1111
1111
|
"enableBy": "register"
|
|
1112
1112
|
},
|
|
@@ -1201,7 +1201,7 @@
|
|
|
1201
1201
|
"config": {},
|
|
1202
1202
|
"time": {
|
|
1203
1203
|
"hooks": {},
|
|
1204
|
-
"register":
|
|
1204
|
+
"register": 31
|
|
1205
1205
|
}
|
|
1206
1206
|
},
|
|
1207
1207
|
"./node_modules/@umijs/preset-umi/dist/features/mpa/mpa": {
|
|
@@ -1226,7 +1226,7 @@
|
|
|
1226
1226
|
"config": {},
|
|
1227
1227
|
"time": {
|
|
1228
1228
|
"hooks": {},
|
|
1229
|
-
"register":
|
|
1229
|
+
"register": 0
|
|
1230
1230
|
}
|
|
1231
1231
|
},
|
|
1232
1232
|
"./node_modules/@umijs/preset-umi/dist/features/overrides/overrides": {
|
|
@@ -1251,7 +1251,7 @@
|
|
|
1251
1251
|
"config": {},
|
|
1252
1252
|
"time": {
|
|
1253
1253
|
"hooks": {},
|
|
1254
|
-
"register":
|
|
1254
|
+
"register": 1
|
|
1255
1255
|
},
|
|
1256
1256
|
"enableBy": "config"
|
|
1257
1257
|
},
|
|
@@ -1265,7 +1265,7 @@
|
|
|
1265
1265
|
"time": {
|
|
1266
1266
|
"hooks": {
|
|
1267
1267
|
"modifyConfig": [
|
|
1268
|
-
|
|
1268
|
+
0
|
|
1269
1269
|
]
|
|
1270
1270
|
},
|
|
1271
1271
|
"register": 1
|
|
@@ -1280,7 +1280,7 @@
|
|
|
1280
1280
|
"config": {},
|
|
1281
1281
|
"time": {
|
|
1282
1282
|
"hooks": {},
|
|
1283
|
-
"register":
|
|
1283
|
+
"register": 1
|
|
1284
1284
|
},
|
|
1285
1285
|
"enableBy": "register"
|
|
1286
1286
|
},
|
|
@@ -1510,7 +1510,7 @@
|
|
|
1510
1510
|
"config": {},
|
|
1511
1511
|
"time": {
|
|
1512
1512
|
"hooks": {},
|
|
1513
|
-
"register":
|
|
1513
|
+
"register": 0
|
|
1514
1514
|
},
|
|
1515
1515
|
"enableBy": "config"
|
|
1516
1516
|
},
|
|
@@ -1523,7 +1523,7 @@
|
|
|
1523
1523
|
"config": {},
|
|
1524
1524
|
"time": {
|
|
1525
1525
|
"hooks": {},
|
|
1526
|
-
"register":
|
|
1526
|
+
"register": 1
|
|
1527
1527
|
}
|
|
1528
1528
|
},
|
|
1529
1529
|
"./node_modules/@umijs/preset-umi/dist/features/swc/swc": {
|
|
@@ -1690,7 +1690,7 @@
|
|
|
1690
1690
|
"config": {},
|
|
1691
1691
|
"time": {
|
|
1692
1692
|
"hooks": {},
|
|
1693
|
-
"register":
|
|
1693
|
+
"register": 0
|
|
1694
1694
|
},
|
|
1695
1695
|
"enableBy": "register"
|
|
1696
1696
|
},
|
|
@@ -1703,7 +1703,7 @@
|
|
|
1703
1703
|
"config": {},
|
|
1704
1704
|
"time": {
|
|
1705
1705
|
"hooks": {},
|
|
1706
|
-
"register":
|
|
1706
|
+
"register": 1
|
|
1707
1707
|
},
|
|
1708
1708
|
"enableBy": "register"
|
|
1709
1709
|
},
|
|
@@ -1716,7 +1716,7 @@
|
|
|
1716
1716
|
"config": {},
|
|
1717
1717
|
"time": {
|
|
1718
1718
|
"hooks": {},
|
|
1719
|
-
"register":
|
|
1719
|
+
"register": 0
|
|
1720
1720
|
},
|
|
1721
1721
|
"enableBy": "register"
|
|
1722
1722
|
},
|
|
@@ -1729,7 +1729,7 @@
|
|
|
1729
1729
|
"config": {},
|
|
1730
1730
|
"time": {
|
|
1731
1731
|
"hooks": {},
|
|
1732
|
-
"register":
|
|
1732
|
+
"register": 1
|
|
1733
1733
|
},
|
|
1734
1734
|
"enableBy": "register"
|
|
1735
1735
|
},
|
|
@@ -1742,7 +1742,7 @@
|
|
|
1742
1742
|
"config": {},
|
|
1743
1743
|
"time": {
|
|
1744
1744
|
"hooks": {},
|
|
1745
|
-
"register":
|
|
1745
|
+
"register": 1
|
|
1746
1746
|
},
|
|
1747
1747
|
"enableBy": "register"
|
|
1748
1748
|
},
|
|
@@ -1755,7 +1755,7 @@
|
|
|
1755
1755
|
"config": {},
|
|
1756
1756
|
"time": {
|
|
1757
1757
|
"hooks": {},
|
|
1758
|
-
"register":
|
|
1758
|
+
"register": 1
|
|
1759
1759
|
},
|
|
1760
1760
|
"enableBy": "register"
|
|
1761
1761
|
},
|
|
@@ -1768,7 +1768,7 @@
|
|
|
1768
1768
|
"config": {},
|
|
1769
1769
|
"time": {
|
|
1770
1770
|
"hooks": {},
|
|
1771
|
-
"register":
|
|
1771
|
+
"register": 0
|
|
1772
1772
|
},
|
|
1773
1773
|
"enableBy": "register"
|
|
1774
1774
|
},
|
|
@@ -1781,7 +1781,7 @@
|
|
|
1781
1781
|
"config": {},
|
|
1782
1782
|
"time": {
|
|
1783
1783
|
"hooks": {},
|
|
1784
|
-
"register":
|
|
1784
|
+
"register": 1
|
|
1785
1785
|
},
|
|
1786
1786
|
"enableBy": "register"
|
|
1787
1787
|
},
|
|
@@ -1807,7 +1807,7 @@
|
|
|
1807
1807
|
"config": {},
|
|
1808
1808
|
"time": {
|
|
1809
1809
|
"hooks": {},
|
|
1810
|
-
"register":
|
|
1810
|
+
"register": 0
|
|
1811
1811
|
},
|
|
1812
1812
|
"enableBy": "register"
|
|
1813
1813
|
},
|
|
@@ -1833,7 +1833,7 @@
|
|
|
1833
1833
|
"config": {},
|
|
1834
1834
|
"time": {
|
|
1835
1835
|
"hooks": {},
|
|
1836
|
-
"register":
|
|
1836
|
+
"register": 0
|
|
1837
1837
|
},
|
|
1838
1838
|
"enableBy": "register"
|
|
1839
1839
|
},
|
|
@@ -1846,7 +1846,7 @@
|
|
|
1846
1846
|
"config": {},
|
|
1847
1847
|
"time": {
|
|
1848
1848
|
"hooks": {},
|
|
1849
|
-
"register":
|
|
1849
|
+
"register": 1
|
|
1850
1850
|
},
|
|
1851
1851
|
"enableBy": "register"
|
|
1852
1852
|
},
|
|
@@ -1859,7 +1859,7 @@
|
|
|
1859
1859
|
"config": {},
|
|
1860
1860
|
"time": {
|
|
1861
1861
|
"hooks": {},
|
|
1862
|
-
"register":
|
|
1862
|
+
"register": 0
|
|
1863
1863
|
},
|
|
1864
1864
|
"enableBy": "register"
|
|
1865
1865
|
},
|
|
@@ -1872,7 +1872,7 @@
|
|
|
1872
1872
|
"config": {},
|
|
1873
1873
|
"time": {
|
|
1874
1874
|
"hooks": {},
|
|
1875
|
-
"register":
|
|
1875
|
+
"register": 1
|
|
1876
1876
|
},
|
|
1877
1877
|
"enableBy": "register"
|
|
1878
1878
|
},
|
|
@@ -1911,7 +1911,7 @@
|
|
|
1911
1911
|
"config": {},
|
|
1912
1912
|
"time": {
|
|
1913
1913
|
"hooks": {},
|
|
1914
|
-
"register":
|
|
1914
|
+
"register": 21
|
|
1915
1915
|
},
|
|
1916
1916
|
"enableBy": "register"
|
|
1917
1917
|
},
|
|
@@ -1924,7 +1924,7 @@
|
|
|
1924
1924
|
"config": {},
|
|
1925
1925
|
"time": {
|
|
1926
1926
|
"hooks": {},
|
|
1927
|
-
"register":
|
|
1927
|
+
"register": 1
|
|
1928
1928
|
},
|
|
1929
1929
|
"enableBy": "register"
|
|
1930
1930
|
},
|
|
@@ -1950,7 +1950,7 @@
|
|
|
1950
1950
|
"config": {},
|
|
1951
1951
|
"time": {
|
|
1952
1952
|
"hooks": {},
|
|
1953
|
-
"register":
|
|
1953
|
+
"register": 0
|
|
1954
1954
|
},
|
|
1955
1955
|
"enableBy": "register"
|
|
1956
1956
|
},
|
|
@@ -1967,7 +1967,7 @@
|
|
|
1967
1967
|
0
|
|
1968
1968
|
]
|
|
1969
1969
|
},
|
|
1970
|
-
"register":
|
|
1970
|
+
"register": 6
|
|
1971
1971
|
},
|
|
1972
1972
|
"enableBy": "register"
|
|
1973
1973
|
}
|
|
@@ -2114,7 +2114,7 @@
|
|
|
2114
2114
|
"parentId": "@@/global-layout",
|
|
2115
2115
|
"file": "system/job/index.jsx",
|
|
2116
2116
|
"absPath": "/system/job",
|
|
2117
|
-
"__content": "import React from 'react'\nimport {\n Alert,\n AutoComplete,\n Button,\n Divider,\n Form,\n Input,\n message,\n Modal,\n Popconfirm,\n Select,\n Space,\n Switch,\n Tag\n} from 'antd'\nimport {PlusOutlined} from \"@ant-design/icons\";\nimport {ButtonList, HttpUtils, Page, ProTable, StringUtils, SysUtils, ValueType} from \"../../../framework\";\n\n\nconst cronOptions = [\n {\n label: '*/5 * * * * ? 每隔5秒',\n value: '*/5 * * * * ?'\n },\n {\n label: '0 */5 * * * ? 每隔5分钟',\n value: '0 */5 * * * ?'\n },\n {\n label: '0 0 22 * * ? 每天22点',\n value: '0 0 22 * * ?'\n },\n {\n label: '0 0 1 * * ? 每天1点',\n value: '0 0 1 * * ?'\n },\n {\n label: '0 0 1 1 * ? 每月1号凌晨1点',\n value: '0 0 1 1 * ?'\n }\n]\n\n\nexport default class extends React.Component {\n\n state = {\n formValues: {},\n formOpen: false,\n\n selectedRowKeys: [],\n\n jobClassOptions: [],\n\n paramList: [],\n\n statusOpen: false,\n status: null,\n\n executeRecordOpen: false,\n }\n tableRef = React.createRef()\n formRef = React.createRef()\n\n componentDidMount() {\n HttpUtils.get('admin/job/job-class-options').then(rs => {\n this.setState({jobClassOptions: rs})\n }).catch(e => {\n console.error('[Job] 加载作业类选项失败:', e);\n })\n }\n\n handleAdd = () => {\n this.setState({formOpen: true, formValues: {}, paramList: []})\n }\n\n handleEdit = (record) => {\n this.loadJobParamFields(record.jobClass, record.jobData)\n this.setState({formOpen: true, formValues: record,})\n }\n\n loadJobParamFields(className, jobData) {\n HttpUtils.post(\"admin/job/get-job-param-fields\", jobData || {}, {className}).then(rs => {\n this.setState({paramList: rs})\n }).catch(e => {\n console.error('[Job] 加载作业参数字段失败:', e);\n })\n }\n\n onFinish = (values) => {\n const isNew = !values.id;\n const url = isNew ? 'admin/job/create' : 'admin/job/update';\n HttpUtils.post(url, values).then(rs => {\n this.setState({formOpen: false})\n this.tableRef.current.reload();\n }).catch(e => {\n console.error('[Job] 保存作业失败:', e);\n })\n }\n\n handleDelete = row => {\n const hide = message.loading(\"删除作业中...\")\n HttpUtils.post('admin/job/delete', {id: row.id}).then(rs => {\n this.tableRef.current.reload();\n }).catch(e => {\n console.error('[Job] 删除作业失败:', e);\n hide();\n })\n }\n\n handleTriggerJob = row => {\n HttpUtils.get('admin/job/trigger-job', {id: row.id}).then(rs => {\n this.tableRef.current.reload();\n }).catch(e => {\n console.error('[Job] 触发作业失败:', e);\n })\n }\n\n columns = [\n {\n title: '名称',\n dataIndex: 'name',\n\n },\n {\n title: '执行类',\n dataIndex: 'jobClass',\n\n },\n\n {\n title: 'cron',\n dataIndex: 'cron',\n },\n\n\n {\n title: '参数',\n dataIndex: 'jobData',\n render(list) {\n if (list)\n return JSON.stringify(list)\n }\n },\n\n\n {\n title: '启用状态',\n dataIndex: 'enabled',\n render: (v, record) => {\n return record.enabled ? <Tag color='green'>启用</Tag> : <Tag color='red'>停用</Tag>\n },\n },\n\n {\n title: '操作',\n dataIndex: 'option',\n fixed: 'right',\n render: (_, record) => {\n\n return (\n <Space>\n <Button size='small' onClick={() => this.showExecuteRecord(record)}>执行记录</Button>\n <Button size='small' perm='job:trigger' onClick={() => this.handleTriggerJob(record)}>执行一次</Button>\n <Button size='small' perm='job:update' onClick={() => this.handleEdit(record)}> 编辑 </Button>\n <Popconfirm perm='job:delete' title='是否确定删除?' onConfirm={() => this.handleDelete(record)}>\n <Button size='small'>删除</Button>\n </Popconfirm>\n </Space>\n );\n },\n },\n\n ]\n\n showStatus = () => {\n this.setState({statusOpen: true})\n HttpUtils.get('admin/job/status').then(rs => {\n this.setState({status: rs})\n }).catch(e => {\n console.error('[Job] 加载状态失败:', e);\n })\n };\n\n showExecuteRecord(record) {\n this.setState({executeRecordOpen: true, formValues: record})\n }\n\n\n render() {\n return <Page title=\"作业调度\" description=\"管理定时作业任务\" actions={<><Button type='primary' icon={<PlusOutlined/>} onClick={() => this.handleAdd()}>新增</Button><Button onClick={this.showStatus}>查看状态</Button></>}>\n <ProTable\n actionRef={this.tableRef}\n request={(params) => HttpUtils.get('admin/job/page', params)}\n columns={this.columns}\n >\n <Form.Item label='名称' name='name'>\n <Input/>\n </Form.Item>\n <Form.Item label='执行类' name='jobClass'>\n <Input/>\n </Form.Item>\n </ProTable>\n\n\n <Modal title='作业调度'\n open={this.state.formOpen}\n destroyOnHidden\n width={800}\n onOk={() => this.formRef.current.submit()}\n onCancel={() => this.setState({formOpen: false})}\n >\n\n <Form ref={this.formRef} labelCol={{flex: '100px'}}\n initialValues={this.state.formValues}\n onValuesChange={this.onValuesChange}\n onFinish={this.onFinish}>\n <Form.Item name='id' noStyle>\n </Form.Item>\n <Form.Item label='执行类' name='jobClass' rules={[{required: true}]}\n tooltip='org.quartz.Job接口,参考io.tmgg.job.builtin.DemoJob'>\n <Select options={this.state.jobClassOptions}/>\n </Form.Item>\n <Form.Item label='名称' name='name' rules={[{required: true}]}>\n <Input/>\n </Form.Item>\n\n <Form.Item label='cron表达式' name='cron' help='格式:秒分时日月周,留空表示手动执行'\n rules={[{required: true}]}>\n <AutoComplete placeholder='如 0 */5 * * * ?' options={cronOptions}/>\n </Form.Item>\n\n <Form.Item label='启用' name='enabled' valuePropName='checked' rules={[{required: true}]}>\n <Switch/>\n </Form.Item>\n\n\n {this.state.paramList?.map(p => (\n <div key={p.name}>\n <Divider>作业参数</Divider>\n <Form.Item label={p.label}\n name={['jobData', p.name]}\n key={p.name}\n rules={[{required: p.required}]}>\n {ValueType.renderField(p.componentType, p.componentProps)}\n </Form.Item>\n </div>\n ))}\n </Form>\n </Modal>\n\n <Modal title='作业调度状态'\n open={this.state.statusOpen}\n onCancel={() => this.setState({statusOpen: false})}\n footer={null}\n width={1024}\n >\n <Alert title={<pre>{this.state.status}</pre>}></Alert>\n\n </Modal>\n\n <Modal title='作业调度记录'\n open={this.state.executeRecordOpen}\n onCancel={() => this.setState({executeRecordOpen: false})}\n footer={null}\n width={1024}\n destroyOnHidden\n >\n <ProTable columns={[{\n title: '开始时间',\n dataIndex: 'beginTime',\n },\n {\n title: '结束时间',\n dataIndex: 'endTime',\n },\n {\n title: '耗时',\n dataIndex: 'jobRunTimeLabel',\n\n },\n {\n title: '是否成功',\n dataIndex: 'success',\n width: 200,\n render: v => {\n if (v != null) {\n return v ? '成功' : '异常'\n }\n }\n },\n {\n title: '返回结果',\n dataIndex: 'result',\n width: 300\n },\n\n {\n title: '操作',\n dataIndex: 'option',\n render: (_, record) => {\n const url = SysUtils.contextPath('/admin/sys/log/' + record.id);\n return <a href={url} target='_blank'>日志</a>;\n },\n }\n ]} request={params => {\n params.jobId = this.state.formValues.id\n return HttpUtils.get('admin/job/execute-record', params);\n }}></ProTable>\n\n </Modal>\n </Page>\n }\n\n onValuesChange = (changed, values) => {\n if (changed.jobClass) {\n this.loadJobParamFields(values.jobClass)\n const option = this.state.jobClassOptions.find(o => o.value === changed.jobClass)\n if (option) {\n const {label} = option;\n if (StringUtils.contains(label, \" \")) { // 取中文名部门设置为name\n this.formRef.current.setFieldValue(\"name\", label.split(\" \")[1])\n }\n }\n }\n\n if (changed.jobData) {\n this.loadJobParamFields(values.jobClass, values.jobData)\n }\n\n };\n}\n\n\n\n",
|
|
2117
|
+
"__content": "import React from 'react'\nimport {\n Alert,\n AutoComplete,\n Button,\n Divider,\n Form,\n Input,\n message,\n Modal,\n Popconfirm,\n Select,\n Space,\n Switch,\n Tag\n} from 'antd'\nimport {PlusOutlined} from \"@ant-design/icons\";\nimport {ButtonList, HttpUtils, Page, ProTable, StringUtils, SysUtils, ValueType} from \"../../../framework\";\n\n\nconst cronOptions = [\n {\n label: '*/5 * * * * ? 每隔5秒',\n value: '*/5 * * * * ?'\n },\n {\n label: '0 */5 * * * ? 每隔5分钟',\n value: '0 */5 * * * ?'\n },\n {\n label: '0 0 22 * * ? 每天22点',\n value: '0 0 22 * * ?'\n },\n {\n label: '0 0 1 * * ? 每天1点',\n value: '0 0 1 * * ?'\n },\n {\n label: '0 0 1 1 * ? 每月1号凌晨1点',\n value: '0 0 1 1 * ?'\n }\n]\n\n\nexport default class extends React.Component {\n\n state = {\n formValues: {},\n formOpen: false,\n\n selectedRowKeys: [],\n\n jobClassOptions: [],\n\n paramList: [],\n\n statusOpen: false,\n status: null,\n\n executeRecordOpen: false,\n }\n tableRef = React.createRef()\n formRef = React.createRef()\n\n componentDidMount() {\n HttpUtils.get('admin/job/job-class-options').then(rs => {\n this.setState({jobClassOptions: rs})\n }).catch(e => {\n console.error('[Job] 加载作业类选项失败:', e);\n })\n }\n\n handleAdd = () => {\n this.setState({formOpen: true, formValues: {}, paramList: []})\n }\n\n handleEdit = (record) => {\n this.loadJobParamFields(record.jobClass, record.jobData)\n this.setState({formOpen: true, formValues: record,})\n }\n\n loadJobParamFields(className, jobData) {\n HttpUtils.post(\"admin/job/get-job-param-fields\", jobData || {}, {className}).then(rs => {\n this.setState({paramList: rs})\n }).catch(e => {\n console.error('[Job] 加载作业参数字段失败:', e);\n })\n }\n\n onFinish = (values) => {\n const isNew = !values.id;\n const url = isNew ? 'admin/job/create' : 'admin/job/update';\n HttpUtils.post(url, values).then(rs => {\n this.setState({formOpen: false})\n this.tableRef.current.reload();\n }).catch(e => {\n console.error('[Job] 保存作业失败:', e);\n })\n }\n\n handleDelete = row => {\n const hide = message.loading(\"删除作业中...\")\n HttpUtils.post('admin/job/delete', {id: row.id}).then(rs => {\n this.tableRef.current.reload();\n }).catch(e => {\n console.error('[Job] 删除作业失败:', e);\n hide();\n })\n }\n\n handleTriggerJob = row => {\n HttpUtils.get('admin/job/trigger-job', {id: row.id}).then(rs => {\n this.tableRef.current.reload();\n }).catch(e => {\n console.error('[Job] 触发作业失败:', e);\n })\n }\n\n columns = [\n {\n title: '名称',\n dataIndex: 'name',\n\n },\n {\n title: '执行类',\n dataIndex: 'jobClass',\n\n },\n\n {\n title: 'cron',\n dataIndex: 'cron',\n },\n\n\n {\n title: '参数',\n dataIndex: 'jobData',\n render(list) {\n if (list)\n return JSON.stringify(list)\n }\n },\n\n\n {\n title: '启用状态',\n dataIndex: 'enabled',\n render: (v, record) => {\n return record.enabled ? <Tag color='green'>启用</Tag> : <Tag color='red'>停用</Tag>\n },\n },\n\n {\n title: '操作',\n dataIndex: 'option',\n fixed: 'right',\n render: (_, record) => {\n\n return (\n <Space>\n <Button size='small' onClick={() => this.showExecuteRecord(record)}>执行记录</Button>\n <Button size='small' perm='job:trigger' onClick={() => this.handleTriggerJob(record)}>执行一次</Button>\n <Button size='small' perm='job:update' onClick={() => this.handleEdit(record)}> 编辑 </Button>\n <Popconfirm perm='job:delete' title='是否确定删除?' onConfirm={() => this.handleDelete(record)}>\n <Button size='small'>删除</Button>\n </Popconfirm>\n </Space>\n );\n },\n },\n\n ]\n\n showStatus = () => {\n this.setState({statusOpen: true})\n HttpUtils.get('admin/job/status').then(rs => {\n this.setState({status: rs})\n }).catch(e => {\n console.error('[Job] 加载状态失败:', e);\n })\n };\n\n showExecuteRecord(record) {\n this.setState({executeRecordOpen: true, formValues: record})\n }\n\n\n render() {\n return <Page title=\"作业调度\" description=\"管理定时作业任务\" actions={<><Button type='primary' icon={<PlusOutlined/>} onClick={() => this.handleAdd()}>新增</Button><Button onClick={this.showStatus}>查看状态</Button></>}>\n <ProTable\n actionRef={this.tableRef}\n request={(params) => HttpUtils.get('admin/job/page', params)}\n columns={this.columns}\n >\n <Form.Item label='名称' name='name'>\n <Input/>\n </Form.Item>\n <Form.Item label='执行类' name='jobClass'>\n <Input/>\n </Form.Item>\n </ProTable>\n\n\n <Modal title='作业调度'\n open={this.state.formOpen}\n destroyOnHidden\n width={800}\n onOk={() => this.formRef.current.submit()}\n onCancel={() => this.setState({formOpen: false})}\n >\n\n <Form ref={this.formRef} labelCol={{flex: '100px'}}\n initialValues={this.state.formValues}\n onValuesChange={this.onValuesChange}\n onFinish={this.onFinish}>\n <Form.Item name='id' noStyle>\n </Form.Item>\n <Form.Item label='执行类' name='jobClass' rules={[{required: true}]}\n tooltip='org.quartz.Job接口,参考io.tmgg.job.builtin.DemoJob'>\n <Select options={this.state.jobClassOptions}/>\n </Form.Item>\n <Form.Item label='名称' name='name' rules={[{required: true}]}>\n <Input/>\n </Form.Item>\n\n <Form.Item label='cron表达式' name='cron' help='格式:秒分时日月周,留空表示手动执行'\n rules={[{required: true}]}>\n <AutoComplete placeholder='如 0 */5 * * * ?' options={cronOptions}/>\n </Form.Item>\n\n <Form.Item label='启用' name='enabled' valuePropName='checked' rules={[{required: true}]}>\n <Switch/>\n </Form.Item>\n\n\n {this.state.paramList?.map(p => (\n <div key={p.name}>\n <Divider>作业参数</Divider>\n <Form.Item label={p.label}\n name={['jobData', p.name]}\n key={p.name}\n initialValue={p.defaultValue}\n rules={[{required: p.required}]}>\n {ValueType.renderField(p.componentType, {\n ...p.componentProps,\n placeholder: p.placeholder || '请输入'\n })}\n </Form.Item>\n </div>\n ))}\n </Form>\n </Modal>\n\n <Modal title='作业调度状态'\n open={this.state.statusOpen}\n onCancel={() => this.setState({statusOpen: false})}\n footer={null}\n width={1024}\n >\n <Alert title={<pre>{this.state.status}</pre>}></Alert>\n\n </Modal>\n\n <Modal title='作业调度记录'\n open={this.state.executeRecordOpen}\n onCancel={() => this.setState({executeRecordOpen: false})}\n footer={null}\n width={1024}\n destroyOnHidden\n >\n <ProTable columns={[{\n title: '开始时间',\n dataIndex: 'beginTime',\n },\n {\n title: '结束时间',\n dataIndex: 'endTime',\n },\n {\n title: '耗时',\n dataIndex: 'jobRunTimeLabel',\n\n },\n {\n title: '是否成功',\n dataIndex: 'success',\n width: 200,\n render: v => {\n if (v != null) {\n return v ? '成功' : '异常'\n }\n }\n },\n {\n title: '返回结果',\n dataIndex: 'result',\n width: 300\n },\n\n {\n title: '操作',\n dataIndex: 'option',\n render: (_, record) => {\n const url = SysUtils.contextPath('/admin/sys/log/' + record.id);\n return <a href={url} target='_blank'>日志</a>;\n },\n }\n ]} request={params => {\n params.jobId = this.state.formValues.id\n return HttpUtils.get('admin/job/execute-record', params);\n }}></ProTable>\n\n </Modal>\n </Page>\n }\n\n onValuesChange = (changed, values) => {\n if (changed.jobClass) {\n this.loadJobParamFields(values.jobClass)\n const option = this.state.jobClassOptions.find(o => o.value === changed.jobClass)\n if (option) {\n const {label} = option;\n if (StringUtils.contains(label, \" \")) { // 取中文名部门设置为name\n this.formRef.current.setFieldValue(\"name\", label.split(\" \")[1])\n }\n }\n }\n\n if (changed.jobData) {\n this.loadJobParamFields(values.jobClass, values.jobData)\n }\n\n };\n}\n\n\n\n",
|
|
2118
2118
|
"__isJSFile": true,
|
|
2119
2119
|
"__absFile": "/home/runner/work/open-admin/open-admin/web/src/pages/system/job/index.jsx"
|
|
2120
2120
|
},
|
|
@@ -201,7 +201,7 @@ export default class extends React.Component {
|
|
|
201
201
|
breakpoint={'md'}
|
|
202
202
|
>
|
|
203
203
|
<div className='sider-header'>
|
|
204
|
-
<img className='logo-img' src="./logo.
|
|
204
|
+
<img className='logo-img' src="./logo.png" onClick={() => history.push('/')} alt='logo'/>
|
|
205
205
|
<h3 className='hide-on-mobile'>
|
|
206
206
|
<Link to="/" style={{color: 'rgba(255,255,255,0.85)'}}>{siteInfo.title}</Link>
|
|
207
207
|
</h3>
|
|
@@ -241,8 +241,12 @@ export default class extends React.Component {
|
|
|
241
241
|
<Form.Item label={p.label}
|
|
242
242
|
name={['jobData', p.name]}
|
|
243
243
|
key={p.name}
|
|
244
|
+
initialValue={p.defaultValue}
|
|
244
245
|
rules={[{required: p.required}]}>
|
|
245
|
-
{ValueType.renderField(p.componentType,
|
|
246
|
+
{ValueType.renderField(p.componentType, {
|
|
247
|
+
...p.componentProps,
|
|
248
|
+
placeholder: p.placeholder || '请输入'
|
|
249
|
+
})}
|
|
246
250
|
</Form.Item>
|
|
247
251
|
</div>
|
|
248
252
|
))}
|