<%@ 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{
			left:0;
			top:40px;
		}

	</style>
	<script type="text/javascript">
        function doSubmit(){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
            if(validateForm.form()){
                $("#inputForm").submit();
                return true;
            }
            return false;
        }
        var validateForm;
        $(document).ready(function() {
            validateForm = $("#inputForm").validate({
                submitHandler: function(form){
                    loading('正在提交，请稍等...');
                    form.submit();
                },
                rules:{
                },
                messages:{
                },
                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 isNumber(val){
            if(val === "" || val ==null){
                return false;
            }
            var regPos = /^\d+(\.\d+)?$/; //非负浮点数
            var regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/; //负浮点数
            if(regPos.test(val) || regNeg.test(val)){
                return true;
            }else{
                return false;
            }

        }

	</script>
	<style>
		/*超过5个汉字，调整label的长度，以下是配套的*/
		.layui-item .layui-form-label{
			width:90px;
		}
		.form-group .layui-item .layui-input-block,
		.query .layui-input-block {
			margin-left: 116px;
		}
	</style>
</head>
<body>
<div class="single-form">
	<div class="container">
		<form:form id="inputForm" modelAttribute="sysParameter" action="${ctx}/sysparameter/sysParameter/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-sm6">
					<label class="layui-form-label"><span class="require-item">*</span>分类：</label>
					<div class="layui-input-block">
						<form:select path="type" class="form-control required  simple-select">
							<form:option value="" label=""/>
							<form:options items="${fns:getDictList('parameter_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label"><span class="require-item">*</span>参数：</label>
					<div class="layui-input-block">
						<form:input path="parameter" htmlEscape="false"   id="parameter"  class="form-control required layui-input" value="${sysParameter.parameter}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">名称：</label>
					<div class="layui-input-block">
						<form:input path="name" htmlEscape="false"   id="name"  class="form-control required layui-input" value="${sysParameter.name}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label"><span class="require-item">*</span>值类型：</label>
					<div class="layui-input-block">
						<form:select path="valueType" readonly="true"  class="form-control required  simple-select">
							<form:option value="" label=""/>
							<form:options items="${fns:getDictList('value_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label"><span class="require-item">*</span>参数值：</label>
					<div class="layui-input-block">
						<c:choose>
							<c:when test="${sysParameter.valueType eq '1'}">
								<td>
									<form:input path="parameterValue" htmlEscape="false"  maxlength="20"   id="parameterValue"  class="form-control number required layui-input" value="${sysParameter.parameterValue}"/>
								</td>
							</c:when>
							<c:otherwise>
								<td>
									<form:input path="parameterValue" htmlEscape="false"  maxlength="20"   id="parameterValue"  class="form-control required layui-input" value="${sysParameter.parameterValue}"/>
								</td>
							</c:otherwise>
						</c:choose>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label  double-line">是否单独定义：</label>
					<div class="layui-input-block">
						<form:select path="isForce" class="form-control required  simple-select">
							<form:option value="" label=""/>
							<form:options items="${fns:getDictList('yes_no')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">所属公司：</label>
					<div class="layui-input-block">
						<input readonly="true" name="company" htmlEscape="false" class="hidden layui-input" value="${sysParameter.company}"/>
						<input readonly="true" htmlEscape="false" class="form-control layui-input" value="${sysParameter.companyName}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm12  with-textarea">
					<label class="layui-form-label">说明：</label>
					<div class="layui-input-block">
						<form:textarea path="remarks" htmlEscape="false" rows="3"    maxlength="127" class="form-control"/>
					</div>
				</div>
			</div>
			<div class="form-group layui-row page-end"></div>
		</form:form>
	</div>
</div>

</body>
</html>