策略分组添加asn号属性.

This commit is contained in:
zhangwq
2018-10-25 19:43:54 +08:00
parent 6855454715
commit 5b89e6cff5
10 changed files with 116 additions and 11 deletions

View File

@@ -13,8 +13,19 @@ $(function(){
});
$("[name=groupType]").selectpicker("refresh");
}
$(".action").on("change", function() {
/* $(".action").on("change", function() {
$("#serviceId").val($(this).attr("serviceId"));
}); */
if($("#groupType").val() == 4){
$("#asnNo").parents(".form-group").removeClass("hidden");
}
$("#groupType").on("change",function(){
if($(this).val() != 4){
$("#asnNo").parents(".form-group").addClass("hidden");
}else{
$("#asnNo").parents(".form-group").removeClass("hidden");
}
});
$("#cfgFrom").validate({
errorPlacement: function(error,element){
@@ -63,13 +74,14 @@ $(function(){
<div class="col-md-6">
<input class="form-control required" type="text" name="groupName" value="${_cfg.groupName}">
</div>
<div for="groupName"></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="group_type"/></label>
<div class="col-md-6">
<select name="groupType" class="selectpicker select2 form-control required" >
<select id="groupType" name="groupType" class="selectpicker select2 form-control required" >
<c:forEach items="${fns:getDictList('GROUP_TYPE')}" var="groupTypeC">
<option value="${groupTypeC.itemCode}" <c:if test="${_cfg.groupType==groupTypeC.itemCode || (_cfg.groupType==null && groupTypeC.itemCode==1)}">selected</c:if>><spring:message code="${groupTypeC.itemValue}"/></option>
</c:forEach>
@@ -88,6 +100,15 @@ $(function(){
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group hidden">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="asn_no"/></label>
<div class="col-md-6">
<input id="asnNo" class="form-control required asnNoUnique" type="text" name="asnNo" value="${_cfg.asnNo}" autocomplete="off" maxlength="20" ctx="${ctx }">
</div>
<div for="asnNo"></div>
</div>
</div>
</div>
</div>
<div class="form-actions">

View File

@@ -137,6 +137,7 @@
<form:select path="seltype" class="selectpicker select2 input-small" >
<form:option value="groupName"><spring:message code="group_name"></spring:message></form:option>
<form:option value="asnNo"><spring:message code="asn_no"></spring:message></form:option>
</form:select>
</div>
@@ -216,6 +217,7 @@
<th><input type="checkbox" class="i-checks" id="checkAll"></th>
<th><spring:message code="group_name"/></th>
<th><spring:message code="group_type"/></th>
<th><spring:message code="asn_no"/></th>
<th><spring:message code="desc"/></th>
<th><spring:message code="creator"/></th>
<th class="sort-column r.create_time"><spring:message code="config_time"/></th>
@@ -239,6 +241,7 @@
<c:if test="${cfg.groupType==groupTypeC.itemCode }"><spring:message code="${groupTypeC.itemValue}"/></c:if>
</c:forEach>
</td>
<td>${cfg.asnNo}</td>
<td title="${cfg.description }">${fns:abbr(cfg.description,20)}</td>
<td>${cfg.creatorName }</td>
<td><fmt:formatDate value="${cfg.createTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>

View File

@@ -924,7 +924,7 @@ var fillIp=function (ip){
}
return ip;
}
// snat复用地址池ip唯一
jQuery.validator.addMethod("ipUnique",function(value, element) {
var ctx=$(element).attr("ctx");
var cfgId= $("[name='cfgId']").val();
@@ -941,4 +941,21 @@ jQuery.validator.addMethod("ipUnique",function(value, element) {
}
});
return result;
});
// 策略分组管理asn号唯一
jQuery.validator.addMethod("asnNoUnique",function(value, element) {
var ctx=$(element).attr("ctx");
var groupId= $("[name='groupId']").val();
var url = ctx+"/basics/policyGroup/checkAsnNo";
var result = true;
$.ajax({
type:'post',
async:false,
url: url,
data:{"groupId":groupId,"asnNo":value},
success:function(data){
result = data;
}
});
return result;
});

View File

@@ -76,6 +76,7 @@
protocolPort:"TCP protocol or UDP protocol must be chosen when port is greater than 0",
protocolPort1:"Only when TCP protocol or UDP protocol is chosen can port greater than 0,ALL protocol has no limit",
netAddress:"The class C type of IP addresses must has the same network number bit field",
ipUnique:"IP already exists."
ipUnique:"IP already exists.",
asnNoUnique:"ASN already exists."
});
}(jQuery));

View File

@@ -76,6 +76,7 @@
protocolPort:"端口大于0时必须选择TCP协议或者UDP协议",
protocolPort1:"只有tcp,udp协议端口号可以不为0,全部协议无限制",
netAddress:"C类IP地址网络位必须相同",
ipUnique:"IP已存在"
ipUnique:"IP已存在",
asnNoUnique:"ASN号已存在",
});
}(jQuery));