<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>复核标准管理</title>
	<meta name="decorator" content="default"/>
	<style>
		label.error{
			top:40px;
			left:0;
		}
		#standardDetail-error{
			top:82px;
			left:0;
		}
	</style>
	<script type="text/javascript">
		var validateForm;
		function doSubmit(){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
		  if(validateForm.form()){
			  $("#inputForm").submit();
			  return true;
		  }
	
		  return false;
		}
		$(document).ready(function() {
			validateForm = $("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
            var edit = "${workReviewStandard.id}";
            if(edit!=null && edit!=''){
                $("#reviewParentButton").attr("disabled","disabled");
            }
            setParentInfo($("#reviewParentId").val());
		});
        function setParentInfo(parentId){
            $.ajax({
                url:"${ctx}/workreview/workReviewStandard/jsonData",
                dataType:"json",
                data:{id:parentId},
                success:function (data) {
                    if(data.proofread==1&&data.grade==1){
                        $("#maxDeductTr").show();
                    }else {
                        $("#maxDeductTr").hide();
                    }
                }
            })
        }
	</script>
</head>
<body>
<div class="single-form">
	<div class="container">
		<form:form id="inputForm" modelAttribute="workReviewStandard" action="${ctx}/workreview/workReviewStandard/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
			<div class="form-group layui-row first">
				<div class="form-group-label"><h2>复核信息</h2></div>
				<div class="layui-item layui-col-sm12">
					<label class="layui-form-label"><span class="require-item">*</span>上级节点：</label>
					<div class="layui-input-block with-icon">
						<sys:treeselectReview id="reviewParent" name="parent.id" value="${workReviewStandard.parent.id}" labelName="parent.name" labelValue="${workReviewStandard.parent.standardDetail}"
											  title="复核标准" url="/workreview/workReviewStandard/treeData" extId="${workReviewStandard.id}"  cssClass="form-control required layui-input" allowClear="${workReviewStandard.currentUser.admin}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm12 with-textarea">
					<label class="layui-form-label"><span class="require-item">*</span>标准内容：</label>
					<div class="layui-input-block">
						<form:textarea path="standardDetail" htmlEscape="false"  rows="4" style="resize:none;" class="form-control required"/>
					</div>
				</div>
				<div id="maxDeductTr" class="layui-item layui-col-sm12">
					<label class="layui-form-label"><span class="require-item">*</span>最多扣分：</label>
					<div class="layui-input-block">
						<form:input path="maxDeduct" htmlEscape="false" max="100" min="0" class="form-control digits required layui-input"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm12">
					<label class="layui-form-label">序号：</label>
					<div class="layui-input-block">
						<form:input path="orderNum" htmlEscape="false"  readonly="true"  class="form-control layui-input"/>
					</div>
				</div>
			</div>
		</form:form>
	</div>
</div>
</body>
</html>