2018-07-09 08:44:52 +08:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org"
|
|
|
|
xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<head th:include="include :: header"></head>
|
|
|
|
<body class="gray-bg">
|
|
|
|
|
|
|
|
<div class="container-div">
|
|
|
|
<div class="row">
|
2018-10-01 21:32:01 +08:00
|
|
|
<div class="col-sm-12 search-collapse">
|
2018-07-15 20:39:59 +08:00
|
|
|
<form id="job-form">
|
2018-08-01 10:07:28 +08:00
|
|
|
<div class="select-list">
|
2018-07-09 08:44:52 +08:00
|
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
任务名称:<input type="text" name="jobName"/>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
方法名称:<input type="text" name="methodName"/>
|
|
|
|
</li>
|
|
|
|
<li>
|
2018-07-22 23:05:50 +08:00
|
|
|
任务状态:<select name="status" th:with="type=${@dict.getType('sys_job_status')}">
|
2018-07-09 08:44:52 +08:00
|
|
|
<option value="">所有</option>
|
2018-08-23 17:06:31 +08:00
|
|
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
2018-07-09 08:44:52 +08:00
|
|
|
</select>
|
|
|
|
</li>
|
|
|
|
<li>
|
2018-07-27 21:56:08 +08:00
|
|
|
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
|
2018-10-05 18:43:41 +08:00
|
|
|
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
|
2018-07-09 08:44:52 +08:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
|
2019-02-28 20:52:07 +08:00
|
|
|
<div class="btn-group-sm" id="toolbar" role="group">
|
2018-10-05 18:43:41 +08:00
|
|
|
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="monitor:job:add">
|
|
|
|
<i class="fa fa-plus"></i> 新增
|
2018-07-09 08:44:52 +08:00
|
|
|
</a>
|
2018-10-05 18:43:41 +08:00
|
|
|
<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="system:job:edit">
|
|
|
|
<i class="fa fa-edit"></i> 修改
|
|
|
|
</a>
|
2018-10-03 17:42:25 +08:00
|
|
|
<a class="btn btn-danger btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="monitor:job:remove">
|
|
|
|
<i class="fa fa-remove"></i> 删除
|
2018-07-09 08:44:52 +08:00
|
|
|
</a>
|
2018-10-05 18:43:41 +08:00
|
|
|
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="monitor:job:export">
|
|
|
|
<i class="fa fa-download"></i> 导出
|
|
|
|
</a>
|
2018-12-01 16:14:19 +08:00
|
|
|
<a class="btn btn-info" onclick="javascript:jobLog()" shiro:hasPermission="monitor:job:list">
|
|
|
|
<i class="fa fa-list"></i> 日志
|
|
|
|
</a>
|
2018-07-09 08:44:52 +08:00
|
|
|
</div>
|
|
|
|
|
2018-08-23 17:06:31 +08:00
|
|
|
<div class="col-sm-12 select-table table-striped">
|
2018-07-09 08:44:52 +08:00
|
|
|
<table id="bootstrap-table" data-mobile-responsive="true"></table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div th:include="include :: footer"></div>
|
|
|
|
<script th:inline="javascript">
|
2018-12-01 16:14:19 +08:00
|
|
|
var detailFlag = [[${@permission.hasPermi('monitor:job:detail')}]];
|
2018-07-22 23:05:50 +08:00
|
|
|
var editFlag = [[${@permission.hasPermi('monitor:job:edit')}]];
|
|
|
|
var removeFlag = [[${@permission.hasPermi('monitor:job:remove')}]];
|
|
|
|
var statusFlag = [[${@permission.hasPermi('monitor:job:changeStatus')}]];
|
|
|
|
var datas = [[${@dict.getType('sys_job_status')}]];
|
2018-10-05 19:27:24 +08:00
|
|
|
var prefix = ctx + "monitor/job";
|
2018-07-09 08:44:52 +08:00
|
|
|
|
|
|
|
$(function() {
|
|
|
|
var options = {
|
|
|
|
url: prefix + "/list",
|
2018-12-01 16:14:19 +08:00
|
|
|
detailUrl: prefix + "/detail/{id}",
|
2018-07-09 08:44:52 +08:00
|
|
|
createUrl: prefix + "/add",
|
|
|
|
updateUrl: prefix + "/edit/{id}",
|
|
|
|
removeUrl: prefix + "/remove",
|
|
|
|
exportUrl: prefix + "/export",
|
|
|
|
sortName: "createTime",
|
|
|
|
sortOrder: "desc",
|
|
|
|
modalName: "任务",
|
|
|
|
columns: [{
|
|
|
|
checkbox: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'jobId',
|
|
|
|
title: '任务编号'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'jobName',
|
2018-07-19 21:17:17 +08:00
|
|
|
title: '任务名称',
|
|
|
|
sortable: true
|
2018-07-09 08:44:52 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'jobGroup',
|
2018-07-19 21:17:17 +08:00
|
|
|
title: '任务组名',
|
|
|
|
sortable: true
|
2018-07-09 08:44:52 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'methodName',
|
|
|
|
title: '方法名称'
|
|
|
|
},
|
|
|
|
{
|
2018-07-19 21:17:17 +08:00
|
|
|
field: 'methodParams',
|
2018-07-09 08:44:52 +08:00
|
|
|
title: '方法参数'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
field: 'cronExpression',
|
|
|
|
title: '执行表达式'
|
|
|
|
},
|
|
|
|
{
|
2019-01-16 14:56:27 +08:00
|
|
|
visible: statusFlag == 'hidden' ? false : true,
|
|
|
|
title: '任务状态',
|
|
|
|
align: 'center',
|
|
|
|
formatter: function (value, row, index) {
|
|
|
|
return statusTools(row);
|
|
|
|
}
|
2018-07-09 08:44:52 +08:00
|
|
|
},
|
|
|
|
{
|
2018-07-19 21:17:17 +08:00
|
|
|
field: 'createTime',
|
|
|
|
title: '创建时间',
|
|
|
|
sortable: true
|
2018-07-09 08:44:52 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: '操作',
|
|
|
|
align: 'center',
|
|
|
|
formatter: function(value, row, index) {
|
|
|
|
var actions = [];
|
2019-03-13 19:45:12 +08:00
|
|
|
actions.push('<a class="btn btn-primary btn-xs ' + statusFlag + '" href="#" onclick="run(\'' + row.jobId + '\')"><i class="fa fa-play-circle-o"></i> 执行一次</a> ');
|
2018-12-01 16:14:19 +08:00
|
|
|
actions.push('<a class="btn btn-warning btn-xs ' + detailFlag + '" href="#" onclick="$.operate.detail(\'' + row.jobId + '\')"><i class="fa fa-search"></i>详细</a> ');
|
2018-07-09 08:44:52 +08:00
|
|
|
return actions.join('');
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
$.table.init(options);
|
|
|
|
});
|
2019-01-16 14:56:27 +08:00
|
|
|
|
|
|
|
/* 调度任务状态显示 */
|
2018-07-09 08:44:52 +08:00
|
|
|
function statusTools(row) {
|
|
|
|
if (row.status == 1) {
|
2019-01-16 14:56:27 +08:00
|
|
|
return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="start(\'' + row.jobId + '\')"></i> ';
|
|
|
|
} else {
|
|
|
|
return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="stop(\'' + row.jobId + '\')"></i> ';
|
|
|
|
}
|
2018-07-09 08:44:52 +08:00
|
|
|
}
|
|
|
|
|
2019-01-16 14:56:27 +08:00
|
|
|
/* 立即执行一次 */
|
2018-07-09 08:44:52 +08:00
|
|
|
function run(jobId) {
|
2019-03-13 19:45:12 +08:00
|
|
|
$.modal.confirm("确认要立即执行一次任务吗?", function() {
|
2018-07-09 08:44:52 +08:00
|
|
|
$.operate.post(prefix + "/run", { "jobId": jobId});
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2019-01-16 14:56:27 +08:00
|
|
|
/* 调度任务-停用 */
|
2018-07-09 08:44:52 +08:00
|
|
|
function stop(jobId) {
|
|
|
|
$.modal.confirm("确认要停用任务吗?", function() {
|
|
|
|
$.operate.post(prefix + "/changeStatus", { "jobId": jobId, "status": 1 });
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2019-01-16 14:56:27 +08:00
|
|
|
/* 调度任务-启用 */
|
2018-07-09 08:44:52 +08:00
|
|
|
function start(jobId) {
|
|
|
|
$.modal.confirm("确认要启用任务吗?", function() {
|
|
|
|
$.operate.post(prefix + "/changeStatus", { "jobId": jobId, "status": 0 });
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2019-01-16 14:56:27 +08:00
|
|
|
/* 调度日志查询 */
|
2018-07-09 08:44:52 +08:00
|
|
|
function jobLog(id) {
|
|
|
|
var url = ctx + 'monitor/jobLog';
|
|
|
|
createMenuItem(url, "调度日志");
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|