133 lines
5.4 KiB
Plaintext
133 lines
5.4 KiB
Plaintext
<!DOCTYPE html>
|
|
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>定时任务添加</title>
|
|
<link rel="stylesheet" href="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/pear/css/pear.css" />
|
|
</head>
|
|
<body>
|
|
<form class="layui-form" action="">
|
|
<div class="mainBox">
|
|
<div class="main-container">
|
|
<div class="main-container">
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">任务名称</label>
|
|
<div class="layui-input-block">
|
|
<input type="text" name="jobName" lay-verify="jobName" autocomplete="off" placeholder="定时任务名称" class="layui-input">
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">描述</label>
|
|
<div class="layui-input-block">
|
|
<input type="text" name="description" lay-verify="description" autocomplete="off" placeholder="定时任务描述" class="layui-input">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">cron表达式</label>
|
|
<div class="layui-input-block">
|
|
<input type="text" name="cron" id="cron" lay-verify="cron" autocomplete="off" placeholder="cron表达式" onblur="checkCron()" class="layui-input">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">方法名</label>
|
|
<div class="layui-input-inline">
|
|
<select id="methodName" name="methodName" lay-verify="required" lay-search>
|
|
<#if spring_bean_list??>
|
|
<option value="0">请选择...</option>
|
|
<#list spring_bean_list as beanstr >
|
|
<option value="${beanstr!}">${beanstr!}</option>
|
|
</#list>
|
|
<#else >
|
|
暂无分类
|
|
</#if>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="bottom">
|
|
<div class="button-container">
|
|
<button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="job-save">
|
|
<i class="layui-icon layui-icon-ok"></i>
|
|
提交
|
|
</button>
|
|
<button type="reset" class="pear-btn pear-btn-sm">
|
|
<i class="layui-icon layui-icon-refresh"></i>
|
|
重置
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/layui/layui.js"></script>
|
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/js/jquery.min.js"></script>
|
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/component/pear/pear.js"></script>
|
|
<script src="${springMacroRequestContext.contextPath}/mystyle-cloud-admin-manager/system/admin/js/mystyle-admin.js"></script>
|
|
<script>
|
|
layui.use(['form','jquery'],function(){
|
|
let form = layui.form;
|
|
let $ = layui.jquery;
|
|
|
|
form.on('submit(job-save)', function(data){
|
|
var obj = data.field;
|
|
obj['access_token'] = access_token;
|
|
// 请求后台
|
|
$.ajax({
|
|
url: quartz_save_url,
|
|
type: "post",
|
|
data: obj,
|
|
success: function (response) {
|
|
if(response.flag){
|
|
layer.msg(response.message,{icon:1,time:1000},function(){
|
|
parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
|
|
parent.layui.table.reload("job-table");
|
|
});
|
|
}else{
|
|
layer.msg(response.message,{icon:2,time:1000});
|
|
}
|
|
},
|
|
error: function (xhr, textStatus, errorThrown) {
|
|
var josn = xhr.responseText;
|
|
var response = JSON.parse(josn);
|
|
var code = response.code;
|
|
var message = response.message;
|
|
layer.msg(message,{icon:2,time:1000});
|
|
}
|
|
});
|
|
return false;
|
|
});
|
|
});
|
|
|
|
function checkCron() {
|
|
var cron = $("#cron").val();
|
|
if (cron != "") {
|
|
$.ajax({
|
|
type: 'get',
|
|
url: '/job/cron?cron=' + cron + "&token=" + localStorage.getItem("token"),
|
|
success: function (data) {
|
|
var msg = "正确";
|
|
if (!data) {
|
|
msg = "cron表达式不对";
|
|
}
|
|
layer.msg(msg, {
|
|
shift: -1,
|
|
time: 1000
|
|
}, function () {
|
|
});
|
|
}
|
|
});
|
|
} else {
|
|
layer.msg("cron表达式不能为空", {
|
|
shift: -1,
|
|
time: 1000
|
|
}, function () {
|
|
});
|
|
}
|
|
}
|
|
</script>
|
|
<script>
|
|
</script>
|
|
</body>
|
|
</html> |