修改ip通用类界面ipInfo默认值切换bug

去除common.js中switchIpInfo方法的无用参数
This commit is contained in:
duandongmei
2018-05-30 15:00:19 +08:00
parent d8c21e1f3a
commit 6cea62df85
2 changed files with 143 additions and 139 deletions

View File

@@ -2,143 +2,147 @@
<%@ include file="/WEB-INF/include/taglib.jsp"%> <%@ include file="/WEB-INF/include/taglib.jsp"%>
<h3 class="form-section"><spring:message code="block_config"/></h3> <h3 class="form-section"><spring:message code="block_config"/></h3>
<div class="row"> <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="ip_type"/></label>
<div class="col-md-6">
<select name="ipType" class="selectpicker show-tick form-control required">
<option value="4" <c:if test="${_cfg.ipType==4 || _cfg.ipType==null }">selected</c:if> >V4</option>
<option value="6" <c:if test="${_cfg.ipType==6}">selected</c:if>>V6</option>
</select>
</div>
<div for="ipType"></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="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="ip_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 || _cfg.ipPattern==null}">selected</c:if>>IP</option>
</select>
</div>
<div for="ipPattern"></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_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>
<c:choose>
<c:when test="${_cfg.cfgId==null}">
<div class="row hidden port">
</c:when>
<c:otherwise>
<div class="row port">
</c:otherwise>
</c:choose>
<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">
<select name="portPattern" class="selectpicker show-tick form-control required">
<option value="1" <c:if test="${_cfg.portPattern==1 || _cfg.portPattern== null}">selected</c:if> >port</option>
<option value="2" <c:if test="${_cfg.portPattern==2}">selected</c:if>><spring:message code="port_mask"/></option>
</select>
</div>
<div for="portPattern"></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>
<div class="col-md-6">
<input class="form-control required portCheck" type="text" name="srcPort" value="${_cfg.srcPort}">
</div>
<div for="srcPort"></div>
</div>
</div>
</div>
<c:choose>
<c:when test="${_cfg.cfgId==null}">
<div class="row hidden destPort">
</c:when>
<c:otherwise>
<div class="row destPort">
</c:otherwise>
</c:choose>
<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>
<div class="col-md-6">
<input class="form-control required ipCheck" type="text" name="destIpAddress" value="${_cfg.destIpAddress}">
</div>
<div for="destIpAddress"></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="server_port"/></label>
<div class="col-md-6">
<input class="form-control required portCheck" type="text" name="destPort" value="${_cfg.destPort}">
</div>
<div for="destPort"></div>
</div>
</div>
</div>
<c:choose>
<c:when test="${_cfg.cfgId==null}">
<div class="row hidden protocol">
</c:when>
<c:otherwise>
<div class="row protocol">
</c:otherwise>
</c:choose>
<div class="col-md-6">
<div class="form-group ">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="protocol"/></label>
<div class="col-md-6">
<select name="protocol" class="selectpicker show-tick form-control required">
<option value=""><spring:message code="select"/></option>
<option value="6" <c:if test="${_cfg.protocol==6}">selected</c:if>>TCP</option>
<option value="17" <c:if test="${_cfg.protocol==17}">selected</c:if>>UDP</option>
<option value="0" <c:if test="${_cfg.protocol==0 || _cfg.protocol==null}">selected</c:if>><spring:message code="arbitrary"/></option>
</select>
<input type="hidden" name="protocolId" value="0">
</div>
<div for="protocol"></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="direction"/></label>
<div class="col-md-6">
<select name="direction" class="selectpicker show-tick form-control required" >
<option value=""><spring:message code="select"/></option>
<option value="0" <c:if test="${_cfg.direction==0 || _cfg.direction==null}">selected</c:if>><spring:message code="twoway"/></option>
<option value="1" <c:if test="${_cfg.direction==1 }">selected</c:if>><spring:message code="ingress"/></option>
<option value="2" <c:if test="${_cfg.direction==2 }">selected</c:if>><spring:message code="degress"/></option>
</select>
</div>
<div for="direction"></div>
</div>
</div>
</div>
<c:if test="${_cfg.cfgId==null}">
<div class="row"> <div class="row">
<button type="button" class="btn btn-red-hollow center-block" onClick="more(this);" data-click-times="0"><spring:message code="show_more"/></button> <div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="ip_type"/></label>
<div class="col-md-6">
<select name="ipType" class="selectpicker show-tick form-control required">
<c:forEach items="${fns:getDictList('IP_TYPE')}" var="ipTypeC">
<option value="${ipTypeC.itemCode}" <c:if test="${_cfg.ipType==ipTypeC.itemCode}">selected</c:if>>${ipTypeC.itemValue}</option>
</c:forEach>
</select>
</div>
<div for="ipType"></div>
</div>
</div>
</div> </div>
</c:if> <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="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="ip_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 || _cfg.ipPattern==null}">selected</c:if>>IP</option>
</select>
</div>
<div for="ipPattern"></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_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>
<c:choose>
<c:when test="${_cfg.cfgId==null}">
<div class="row hidden port">
</c:when>
<c:otherwise>
<div class="row port">
</c:otherwise>
</c:choose>
<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">
<select name="portPattern" class="selectpicker show-tick form-control required">
<option value="1" <c:if test="${_cfg.portPattern==1 || _cfg.portPattern== null}">selected</c:if> >port</option>
<option value="2" <c:if test="${_cfg.portPattern==2}">selected</c:if>><spring:message code="port_mask"/></option>
</select>
</div>
<div for="portPattern"></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>
<div class="col-md-6">
<input class="form-control required portCheck" type="text" name="srcPort" value="${_cfg.srcPort}">
</div>
<div for="srcPort"></div>
</div>
</div>
</div>
<c:choose>
<c:when test="${_cfg.cfgId==null}">
<div class="row hidden destPort">
</c:when>
<c:otherwise>
<div class="row destPort">
</c:otherwise>
</c:choose>
<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>
<div class="col-md-6">
<input class="form-control required ipCheck" type="text" name="destIpAddress" value="${_cfg.destIpAddress}">
</div>
<div for="destIpAddress"></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="server_port"/></label>
<div class="col-md-6">
<input class="form-control required portCheck" type="text" name="destPort" value="${_cfg.destPort}">
</div>
<div for="destPort"></div>
</div>
</div>
</div>
<c:choose>
<c:when test="${_cfg.cfgId==null}">
<div class="row hidden protocol">
</c:when>
<c:otherwise>
<div class="row protocol">
</c:otherwise>
</c:choose>
<div class="col-md-6">
<div class="form-group ">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="protocol"/></label>
<div class="col-md-6">
<select name="protocol" class="selectpicker show-tick form-control required">
<option value=""><spring:message code="select"/></option>
<option value="6" <c:if test="${_cfg.protocol==6}">selected</c:if>>TCP</option>
<option value="17" <c:if test="${_cfg.protocol==17}">selected</c:if>>UDP</option>
<option value="0" <c:if test="${_cfg.protocol==0 || _cfg.protocol==null}">selected</c:if>><spring:message code="arbitrary"/></option>
</select>
<input type="hidden" name="protocolId" value="0">
</div>
<div for="protocol"></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="direction"/></label>
<div class="col-md-6">
<select name="direction" class="selectpicker show-tick form-control required" >
<option value=""><spring:message code="select"/></option>
<option value="0" <c:if test="${_cfg.direction==0 || _cfg.direction==null}">selected</c:if>><spring:message code="twoway"/></option>
<option value="1" <c:if test="${_cfg.direction==1 }">selected</c:if>><spring:message code="ingress"/></option>
<option value="2" <c:if test="${_cfg.direction==2 }">selected</c:if>><spring:message code="degress"/></option>
</select>
</div>
<div for="direction"></div>
</div>
</div>
</div>
<c:if test="${_cfg.cfgId==null}">
<div class="row">
<button type="button" class="btn btn-red-hollow center-block" onClick="more(this);" data-click-times="0"><spring:message code="show_more"/></button>
</div>
</c:if>
</div>
<%-- <c:choose> <%-- <c:choose>
<c:when test="${action==5}"> <c:when test="${action==5}">
<input type="hidden" name="protocol" value="0"> <input type="hidden" name="protocol" value="0">

View File

@@ -32,12 +32,12 @@ $(function(){
$(this).selectpicker("refresh"); $(this).selectpicker("refresh");
}); });
obj.removeClass("hidden"); obj.removeClass("hidden");
switchIpInfo(obj.find("select[name$='ipType']"),"ipType"); switchIpInfo(obj.find("select[name$='ipType']"));
obj.find("select[name$='ipType']").on("change",function(){ obj.find("select[name$='ipType']").on("change",function(){
switchIpInfo($(this),"ipType"); switchIpInfo($(this));
}); });
obj.find("select[name$='ipPattern']").on("change",function(){ obj.find("select[name$='ipPattern']").on("change",function(){
switchIpInfo($(this),"ipPattern"); switchIpInfo($(this));
}); });
obj.appendTo("#areaIp"); obj.appendTo("#areaIp");
$("#areaIsp").find(".container-fluid").each(function(){ $("#areaIsp").find(".container-fluid").each(function(){
@@ -175,7 +175,7 @@ var switchIpType=function(obj){
} }
} }
//ipType、ipPattern、portPattern选项变化时调用此方法添加默认值 //ipType、ipPattern、portPattern选项变化时调用此方法添加默认值
var switchIpInfo=function(obj,type){ var switchIpInfo=function(obj){
var ipType=""; var ipType="";
var ipPattern=""; var ipPattern="";
var portPattern=""; var portPattern="";