<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" 
      xmlns:sec="http://www.pollix.at/thymeleaf/shiro">
<head th:replace="admin/common/html/tableHead :: head(~{::title},~{::link},~{::style})">

<title th:text=${title}></title>
<!-- 这儿引用单独的css link -->
<!-- Ladda for Bootstrap 3按钮加载进度插件 -->
<link rel="stylesheet" th:href="@{/static/admin/assets/js/button/ladda/ladda.min.css}">
<!-- bootstrap-table表单样式 -->
<link th:href="@{/static/admin/assets/js/bootstrap/css/bootstrap-table/bootstrap-table.min.css}" rel="stylesheet"/>
<!-- 用户界面自定义css -->
<link th:href="@{/static/admin/user/css/user-add.css}" rel="stylesheet"/>
<link th:href="@{/static/admin/assets/js/iCheck/flat/all.css}" rel="stylesheet">
<link th:href="@{/static/admin/assets/js/iCheck/line/all.css}" rel="stylesheet">
<style type="text/css">
.list222{
	float: left;
	padding-left: 0px;
}
.list222 li{
float: left;
list-style-type:none;
padding-right: 19px;
}
.list222 li div,.list222 li label{
float: left;
list-style-type:none;
}
</style>
</head>

<body>

<div class="content-wrap">
	<div class="row">
		<div class="col-sm-12">
			<div class="nest" id="elementClose">
				<div class="">
				</div>
				<div class="body-nest" id="element">
					<div class="panel-body">
						<form  class="form-horizontal m" id="form-add">
						
									<div class="form-group">
										<label class="col-sm-3 control-label ">任务名称：</label>
										<div class="col-sm-8">
											<input class="form-control" type="text" id="jobName" name="jobName"/>
										</div>
									</div>
									
								
									<div class="form-group">
										<label class="col-sm-3 control-label ">任务组名：</label>
										<div class="col-sm-8">
											<select class="form-control" id="jobGroup" name="jobGroup">
												<option value="DEFAULT">默认</option>
	                							<option value="SYSTEM">系统</option>
											</select>
										</div>
									</div>
									
								
									<div class="form-group">
										<label class="col-sm-3 control-label ">调用目标字符串：</label>
										<div class="col-sm-8">
											<input class="form-control" type="text" id="invokeTarget" name="invokeTarget"/>
											 <span class="help-block">Bean调用示例：v2Task.runTask2(1,2l,'asa',true,2D)</span>
											 <span class="help-block">Class类调用示例：com.gyee.frame.service.websocket.task.runTask2('ry')</span>
											 <span class="help-block">参数说明：支持字符串，布尔类型，长整型，浮点型，整型</span>
										</div>
									</div>
									
								
									<div class="form-group">
										<label class="col-sm-3 control-label ">cron执行表达式：</label>
										<div class="col-sm-8">
											<input class="form-control" type="text" id="cronExpression" name="cronExpression"/>
										</div>
									</div>
									
								
									<div class="form-group">
										<label class="col-sm-3 control-label ">cron计划策略：</label>
										<div class="col-sm-8">
											<ul class="list222">
												<li><input tabindex="1" value="1" type="radio" id="square-radio-1" name="misfirePolicy"> <label for="square-radio-1">立即执行</label></li>
												<li><input tabindex="2" value="2" type="radio" id="square-radio-2" name="misfirePolicy"> <label for="square-radio-2">执行一次  </label></li>
												<li><input tabindex="3" value="3" type="radio" id="square-radio-3" name="misfirePolicy"> <label for="square-radio-3">放弃执行</label></li>
											</ul>
										</div>
									</div>
									
								
									<div class="form-group">
										<label class="col-sm-3 control-label ">是否并发执行：</label>
										<div class="col-sm-8">
											<select class="form-control"  id="concurrent" name="concurrent">
												<option value="0">允许</option>
												<option value="1">禁止</option>
												
											</select>
										</div>
									</div>
									
								
									<div class="form-group">
										<label class="col-sm-3 control-label ">任务状态：</label>
										<div class="col-sm-8">
											<select class="form-control"  id="status" name="status">
												<option value="0">正常</option>
												<option value="1">暂停</option>
											</select>
										</div>
									</div>
			
									<div class="form-group">
										<div class="form-control-static col-sm-offset-9">
											<button type="submit" class="btn btn-primary">提交</button>
											<button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
										</div>
									</div>
						 </form>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<!-- 通用js -->
<div th:include="admin/common/html/js :: onload_js">
   
</div>
<!-- bootstarp 表格 -->
<script th:src="@{/static/admin/assets/js/bootstrap/js/bootstrap-table/bootstrap-table.min.js}" type="text/javascript"></script>
<script th:src="@{/static/admin/assets/js/bootstrap/js/bootstrap-table/locale/bootstrap-table-zh-CN.min.js}" type="text/javascript"></script>
<script th:src="@{/static/admin/assets/js/bootstrap/js/base_list.js}" type="text/javascript"></script>

<script type="text/javascript" th:src="@{/static/admin/assets/js/iCheck/jquery.icheck.js}"></script>

<!-- 弹窗 -->
<script  th:src="@{/static/admin/assets/js/layer/layer.js}" type="text/javascript"></script>
<!-- 遮罩层 -->
<script  th:src="@{/static/admin/assets/js/blockUI/jquery.blockUI.js}" type="text/javascript"></script>
<!-- jqueryForm序列化 -->
<script  th:src="@{/static/js/jqueryFormSerializeJson.js}" type="text/javascript"></script>


<script type="text/javascript">

$(function(){
	 $(".MyDate").datetimepicker({
		 	format: "yyyy-mm-dd hh:00:00",
	        startDate: new Date(),
	        autoclose: true,
	        todayBtn: true,
	        language: 'zh-CN',
	        initialDate:new Date(),
	        minView: 1      
	    });
	
	 //单选标签美化
	 $('input[name="misfirePolicy"]').iCheck({
         checkboxClass: 'icheckbox_flat-red',
         radioClass: 'iradio_flat-red'
     });
})


$("#form-add").validate({
	rules:{
		jobName:{
			required:true,
			minlength: 2,
			maxlength: 20,
			remote: {
                url: rootPath + "/SysQuartzJobController/checkNameUnique",
                type: "post",
                dataType: "json",
                dataFilter: function(data, type) {
                    if (data == "0")
                    	return true;
                    else 
                    	return false;
                }
            }
		}
	},
	messages: {
        "jobName": {
            remote: "已经存在"
        }
    },
	submitHandler:function(form){
		add();
	}
});

/**
 * 添加方法
 */
function add() {
	var dataFormJson=$("#form-add").serialize();
	$.ajax({
		cache : true,
		type : "POST",
		url : rootPath + "/SysQuartzJobController/add",
		data : dataFormJson,
		async : false,
		error : function(request) {
			$.modal.alertError("系统错误");
		},
		success : function(data) {
			$.operate.saveSuccess(data);
		}
	});
}

</script>


</body>


</html>
