<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>编号模板管理</title>
	<meta name="decorator" content="default"/>
	<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);
					}
				}
			});
			
		});
		
		function setCompInfo(comId) {
            $.ajax({
                type:'post',
                url:'${ctx}/sys/office/compInfo',
                data:{
                    "id":comId
                },
                success:function(data){
                    if(data.parent!=null) {
                        $("#comSimpleName").val(data.parent.simpleName);
                        $("#branchSimpleName").val(data.simpleName);
                    }else {
                        $("#comSimpleName").val(data.simpleName);
					}
                }
            })
        }
	</script>
</head>
<body>
<div class="single-form">
	<div class="container view-form">
		<form:form id="inputForm" modelAttribute="serialNumTpl" action="${ctx}/serialnum/serialNumTpl/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>	

			<div class="form-group layui-row first lw9">
				<div class="form-group-label"><h2>基础信息</h2></div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">模板名称：</label>
					<div class="layui-input-block">
						<input readonly="true" htmlEscape="false" class="form-control layui-input" value="${serialNumTpl.tplName}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">公司：</label>
					<div class="layui-input-block">
						<input readonly="true" htmlEscape="false" class="form-control layui-input" value="${serialNumTpl.company.name}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">公司简称：</label>
					<div class="layui-input-block">
						<input readonly="true" htmlEscape="false" class="form-control layui-input" value="<c:choose><c:when test="${serialNumTpl.company.parent!=null}">${serialNumTpl.company.parent.simpleName}</c:when><c:otherwise>${serialNumTpl.company.simpleName}</c:otherwise></c:choose>"/>

					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">分公司简称：</label>
					<div class="layui-input-block">
						<input readonly="true" htmlEscape="false" class="form-control layui-input" value="<c:if test="${serialNumTpl.company.parent!=null}">${serialNumTpl.company.simpleName}</c:if>"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">业务标识：</label>
					<div class="layui-input-block">
						<input readonly="true" htmlEscape="false" class="form-control layui-input" value="${fns:getDictLabel(serialNumTpl.bizCode,'serial_biztype','')}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">起始序列号：</label>
					<div class="layui-input-block">
						<input readonly="true" htmlEscape="false" class="form-control layui-input" value="${serialNumTpl.serialNum}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">序列号长度：</label>
					<div class="layui-input-block">
						<input readonly="true" htmlEscape="false" class="form-control layui-input" value="${serialNumTpl.serialNumLen}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">编号模板：</label>
					<div class="layui-input-block">
						<input readonly="true" htmlEscape="false" class="form-control layui-input" value="${serialNumTpl.serialTpl}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">编号示例：</label>
					<div class="layui-input-block">
						<input readonly="true" htmlEscape="false" class="form-control layui-input" value="${serialNumTpl.serialTplEx}"/>
					</div>
				</div>
			</div>
		</form:form>
	</div>
</div>
</body>
</html>