(1)调整ip界面参数顺序

(2)修正验证方法同级触发时错误验证的bug
This commit is contained in:
wangxin
2018-05-25 16:35:20 +08:00
parent 3f52339f8f
commit 64da56e32d
2 changed files with 25 additions and 13 deletions

View File

@@ -129,7 +129,7 @@ $(function(){
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="ip_pattern"/></label>
<div class="col-md-6">
<select name="ipPattern" class="selectpicker show-tick form-control required">
<option value="1" <c:if test="${_cfg.ipPattern==1}">selected</c:if> ><spring:message code="subnet"/></option>
<option value="1" <c:if test="${_cfg.ipPattern==1}">selected</c:if>><spring:message code="subnet"/></option>
<option value="2" <c:if test="${_cfg.ipPattern==2}">selected</c:if>><spring:message code="ip_range"/></option>
<option value="3" <c:if test="${_cfg.ipPattern==3}">selected</c:if>><spring:message code="ip"/></option>
</select>
@@ -139,6 +139,17 @@ $(function(){
</div>
</div>
<div class="col-md-6">
<div class="form-group ">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="client_ip"/></label>
<div class="col-md-6">
<input class="form-control required ipCheck" type="text" name="srcIpAddress" value="${_cfg.srcIpAddress}">
</div>
<div for="srcIpAddress"></div>
</div>
</div>
</div>
<div class="row hidden port">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="port_pattern"/></label>
<div class="col-md-6">
@@ -150,17 +161,6 @@ $(function(){
<div for="portPattern"></div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group ">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="client_ip"/></label>
<div class="col-md-6">
<input class="form-control required ipCheck" type="text" name="srcIpAddress" value="${_cfg.srcIpAddress}">
</div>
<div for="srcIpAddress"></div>
</div>
</div>
<div class="col-md-6">
<div class="form-group ">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="client_port"/></label>
@@ -171,7 +171,7 @@ $(function(){
</div>
</div>
</div>
<div class="row hidden disabled port">
<div class="row hidden protocol">
<div class="col-md-6">
<div class="form-group ">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="server_ip"/></label>

View File

@@ -170,7 +170,13 @@ jQuery.validator.addMethod("notStartZero",function(value, element) {
jQuery.validator.addMethod("ipCheck",function(value, element) {
if(value.length==0||value.trim().length==0){return true;}
var typeInt=$(element).parents(".row").siblings().find("select[name$='ipType']").val();
if(!typeInt){
typeInt=$(element).parents(".row").find("select[name$='ipType']").val();
}
var ipPattern=$(element).parents(".row").siblings().find("select[name$='ipPattern']").val();
if(!ipPattern){
ipPattern=$(element).parents(".row").find("select[name$='ipPattern']").val();
}
if(typeInt==4){
if(ipPattern){
if(ipPattern==1){//ip/掩码格式
@@ -231,6 +237,9 @@ jQuery.validator.addMethod("ipMask",function(value, element) {
if(value.length==0||value.trim().length==0){return true;}
obj=value;
var typeInt=$(element).parents(".row").siblings().find("select[name$='ipType']").val();
if(!typeInt){
typeInt=$(element).parents(".row").find("select[name$='ipType']").val();
}
if(typeInt==4){
if(obj=="255.255.255.255"){
return true;
@@ -249,6 +258,9 @@ jQuery.validator.addMethod("portCheck",function(value, element) {
if(value.length==0||value.trim().length==0){return true;}
obj=value;
var typeInt=$(element).parents(".row").siblings().find("select[name$='portPattern']").val();
if(!typeInt){
typeInt=$(element).parents(".row").find("select[name$='portPattern']").val();
}
if(typeInt==1){//port 0~65535
return this.optional(element)||(/^([0-9]+)$/.test(value) && (RegExp.$1 <=65535 && RegExp.$1 >=0));
}else if(typeInt==2){// port -mask 0~65535/0~65535