修改区域详情查看bug,区域信息查看修改为click事件

tagINput增加非空校验
This commit is contained in:
duandongmei
2018-06-05 20:35:37 +08:00
parent f18dc424ac
commit f00797071a
11 changed files with 147 additions and 101 deletions

View File

@@ -397,13 +397,12 @@ public class AvContentController extends BaseController {
return "redirect:" + adminPath +"/ntc/av/picUrlList?functionId="+functionId;
}
/*****************************picUrl业务***************/
/**
* 1、effectiveIds分组展示
* 2、无effectiveIds查询area_ip根据compileId查询展示
*/
@ResponseBody
@RequestMapping(value = "/ajaxAreaEffictiveInfo")
@RequestMapping(value = "/area/ajaxAreaEffictiveInfo")
public Map ajaxAreaEffictiveInfo(String areaEffectiveIds,Integer compileId) {
Map<String, Object> data=new HashMap<String, Object>();

View File

@@ -2,6 +2,7 @@
<%@ include file="/WEB-INF/include/taglib.jsp"%>
<h3 class="form-section"><spring:message code="block_config"/></h3>
<div class="row stringInfo">
<span id="keywordError" style="display:none"><spring:message code="required"></spring:message></span>
<div class="row">
<div class="col-md-6">
<div class="form-group ">

View File

@@ -344,7 +344,7 @@
<td>
<c:if test="${cfg.isAreaEffective==0}"><spring:message code="no"/></c:if>
<c:if test="${cfg.isAreaEffective==1}">
<a areaEffectiveIds="${cfg.areaEffectiveIds }" compileId="${cfg.compileId }" href="javascript:void(0)" name="viewAreaInfo">
<a href="javascript:viewAreaInfo('${ctx}','${cfg.areaEffectiveIds }','${cfg.compileId }')" >
<spring:message code="yes"/>
</a>
</c:if>

View File

@@ -14,12 +14,28 @@ $(function(){
$("#serviceId").val($(".action:checked").attr("serviceId"));
$("#cfgFrom").validate({
errorPlacement: function(error,element){
$(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error);
if($(element).parents().hasClass("tagsinput")){
$(element).parents(".col-md-6").next("div").append(error);
}else{
$(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error);
}
},
submitHandler: function(form){
//loading('onloading...');
$("input[name$='exprType']").attr("disabled",false);
form.submit();
var flag = true;
$("input[name$='cfgKeywords']").each(function(){
if($(this).val()==''){
$(this).parents(".form-group").find(
"div[for='"
+ $(this).attr("name")
+ "']").html("<label id=\"cfgKeywordsError\" class=\"error\">"+$("#keywordError").text()+"</label>");
flag = false;
return;
}
})
if(flag){
$("input[name$='exprType']").attr("disabled",false);
form.submit();
}
},
errorContainer: "#messageBox",
});

View File

@@ -330,7 +330,7 @@
<td>
<c:if test="${cfg.isAreaEffective==0}"><spring:message code="no"/></c:if>
<c:if test="${cfg.isAreaEffective==1}">
<a areaEffectiveIds="${cfg.areaEffectiveIds }" compileId="${cfg.compileId }" href="javascript:void(0)" name="viewAreaInfo">
<a href="javascript:viewAreaInfo('${ctx}','${cfg.areaEffectiveIds }','${cfg.compileId }')" >
<spring:message code="yes"/>
</a>
</c:if>

View File

@@ -344,7 +344,7 @@
<td>
<c:if test="${cfg.isAreaEffective==0}"><spring:message code="no"/></c:if>
<c:if test="${cfg.isAreaEffective==1}">
<a areaEffectiveIds="${cfg.areaEffectiveIds }" compileId="${cfg.compileId }" href="javascript:void(0)" name="viewAreaInfo">
<a href="javascript:viewAreaInfo('${ctx}','${cfg.areaEffectiveIds }','${cfg.compileId }')" >
<spring:message code="yes"/>
</a>
</c:if>

View File

@@ -14,12 +14,29 @@ $(function(){
$("#serviceId").val($(".action:checked").attr("serviceId"));
$("#cfgFrom").validate({
errorPlacement: function(error,element){
$(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error);
if($(element).parents().hasClass("tagsinput")){
$(element).parents(".col-md-6").next("div").append(error);
}else{
$(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error);
}
},
submitHandler: function(form){
//loading('onloading...');
$("input[name$='exprType']").attr("disabled",false);
form.submit();
var flag = true;
$("input[name$='cfgKeywords']").each(function(){
if($(this).val()==''){
$(this).parents(".form-group").find(
"div[for='"
+ $(this).attr("name")
+ "']").html("<label id=\"cfgKeywordsError\" class=\"error\">"+$("#keywordError").text()+"</label>");
flag = false;
return;
}
})
if(flag){
$("input[name$='exprType']").attr("disabled",false);
form.submit();
}
},
errorContainer: "#messageBox",
});

View File

@@ -330,7 +330,7 @@
<td>
<c:if test="${cfg.isAreaEffective==0}"><spring:message code="no"/></c:if>
<c:if test="${cfg.isAreaEffective==1}">
<a areaEffectiveIds="${cfg.areaEffectiveIds }" compileId="${cfg.compileId }" href="javascript:void(0)" name="viewAreaInfo">
<a href="javascript:viewAreaInfo('${ctx}','${cfg.areaEffectiveIds }','${cfg.compileId }')" >
<spring:message code="yes"/>
</a>
</c:if>

View File

@@ -658,7 +658,7 @@
<td>
<c:if test="${indexCfg.isAreaEffective==0}"><spring:message code="no"/></c:if>
<c:if test="${indexCfg.isAreaEffective==1}">
<a areaEffectiveIds="${indexCfg.areaEffectiveIds }" compileId="${indexCfg.compileId }" href="javascript:void(0)" name="viewAreaInfo">
<a href="javascript:viewAreaInfo('${ctx}','${indexCfg.areaEffectiveIds }','${indexCfg.compileId }')" >
<spring:message code="yes"/>
</a>
</c:if>

View File

@@ -261,7 +261,11 @@
</td>
<td>
<c:if test="${cfg.isAreaEffective==0}"><spring:message code="no"/></c:if>
<c:if test="${cfg.isAreaEffective==1}"><spring:message code="yes"/></c:if>
<c:if test="${cfg.isAreaEffective==1}">
<a href="javascript:viewAreaInfo('${ctx }','${cfg.areaEffectiveIds }','${cfg.compileId }')" >
<spring:message code="yes"/>
</a>
</c:if>
</td>
<td>${cfg.requestName }</td>
<td>

View File

@@ -247,92 +247,19 @@ $(function(){
}
});
/*=====关键字与表达式处理 结束=====*/
$("a[name=viewAreaInfo]").hover(function(){
var areaEffectiveIds=$(this).attr("areaEffectiveIds");
var compileId=$(this).attr("compileId");
$.ajax({
type:'post',
url:'ajaxAreaEffictiveInfo',
data:{"areaEffectiveIds":areaEffectiveIds,"compileId":compileId},
dataType:'json',
async:false,
success:function(data,textStatus){
if(textStatus=="success"){
var html = "";
var title="";
if(data.areaIsps.length > 0){
title=$.validator.messages.area+" "+$.validator.messages.isp;
html+="<table class='table table-striped table-bordered table-condensed' style='margin-left: 10px; width: 96%;'>";
html+="<thead>";
html+="<th>"+$.validator.messages.area+"</th>" +
"<th>"+$.validator.messages.isp+"</th>";
html+="</thead>";
html+="<tbody>";
for(i=0;i<data.areaIsps.length;i++){
html+="<tr>";
html+="<td>"+data.areaIsps[i].areaName;
html+="</td>";
html+="<td>"+data.areaIsps[i].ispName;
html+="</td>";
html+="</tr>";
}
html+="</tbody>";
html+="</table>";
}
if(data.areaIps.length > 0){
title=$.validator.messages.area+" ip";
html+="<table class='table table-striped table-bordered table-condensed' style='margin-left: 10px; width: 96%;'>";
html+="<thead>";
html+="<th>"+$.validator.messages.ip_type+"</th>" +
"<th>"+$.validator.messages.ip_pattern+"</th>" +
"<th>"+$.validator.messages.client_ip+"</th>";
html+="</thead>";
html+="<tbody>";
for(i=0;i<data.areaIps.length;i++){
html+="<tr>";
html+="<td>";
if(data.areaIps[i].ipType==4){
html+=$.validator.messages.ipv4;
}
if(data.areaIps[i].ipType==6){
html+=$.validator.messages.ipv6;
}
if(data.areaIps[i].ipType==46){
html+=$.validator.messages.over4;
}
if(data.areaIps[i].ipType==64){
html+=$.validator.messages.over6;
}
if(data.areaIps[i].ipType==10){
html+=$.validator.messages.all;
}
html+="</td>";
html+="<td>";
if(data.areaIps[i].ipPattern==1){
html+=$.validator.messages.ip_subnet;
}
if(data.areaIps[i].ipPattern==2){
html+=$.validator.messages.ip_range;
}
if(data.areaIps[i].ipPattern==3){
html+="IP";
}
html+="</td>";
html+="<td>"+data.areaIps[i].srcIpAddress;
html+="</td>";
html+="</tr>";
}
html+="</tbody>";
html+="</table>";
}
top.$.jBox(html,{width: $(document).width()*0.4,height: 400,title:title, buttons:false});
}
/*$("input[name$='cfgKeywords']").each(function(){
if($(this).hasClass("tags")){
if($(this).val()==''){
$(this).parents(".form-group").find(
"div[for='"
+ $(this).attr("name")
+ "']").html("<label id=\"cfgKeywordsError\" class=\"error\">"+$("#keywordError").text()+"</label>");
flag = false;
return;
}
});
},function(){});
}
})*/
});
var switchIpType=function(obj){
var type=$(obj).val();
@@ -570,7 +497,89 @@ var more=function(obj){
}
}
var viewAreaInfo=function(path,areaEffectiveIds,compileId){
$.ajax({
type:'post',
url:path+'/ntc/av/area/ajaxAreaEffictiveInfo',
data:{"areaEffectiveIds":areaEffectiveIds,"compileId":compileId},
dataType:'json',
async:false,
success:function(data,textStatus){
if(textStatus=="success"){
var html = "";
var title="";
if(data.areaIsps.length > 0){
title=$.validator.messages.area+" "+$.validator.messages.isp;
html+="<table class='table table-striped table-bordered table-condensed' style='margin-left: 10px; width: 96%;'>";
html+="<thead>";
html+="<th>"+$.validator.messages.area+"</th>" +
"<th>"+$.validator.messages.isp+"</th>";
html+="</thead>";
html+="<tbody>";
for(i=0;i<data.areaIsps.length;i++){
html+="<tr>";
html+="<td>"+data.areaIsps[i].areaName;
html+="</td>";
html+="<td>"+data.areaIsps[i].ispName;
html+="</td>";
html+="</tr>";
}
html+="</tbody>";
html+="</table>";
}
if(data.areaIps.length > 0){
title=$.validator.messages.area+" ip";
html+="<table class='table table-striped table-bordered table-condensed' style='margin-left: 10px; width: 96%;'>";
html+="<thead>";
html+="<th>"+$.validator.messages.ip_type+"</th>" +
"<th>"+$.validator.messages.ip_pattern+"</th>" +
"<th>"+$.validator.messages.client_ip+"</th>";
html+="</thead>";
html+="<tbody>";
for(i=0;i<data.areaIps.length;i++){
html+="<tr>";
html+="<td>";
if(data.areaIps[i].ipType==4){
html+=$.validator.messages.ipv4;
}
if(data.areaIps[i].ipType==6){
html+=$.validator.messages.ipv6;
}
if(data.areaIps[i].ipType==46){
html+=$.validator.messages.over4;
}
if(data.areaIps[i].ipType==64){
html+=$.validator.messages.over6;
}
if(data.areaIps[i].ipType==10){
html+=$.validator.messages.all;
}
html+="</td>";
html+="<td>";
if(data.areaIps[i].ipPattern==1){
html+=$.validator.messages.ip_subnet;
}
if(data.areaIps[i].ipPattern==2){
html+=$.validator.messages.ip_range;
}
if(data.areaIps[i].ipPattern==3){
html+="IP";
}
html+="</td>";
html+="<td>"+data.areaIps[i].srcIpAddress;
html+="</td>";
html+="</tr>";
}
html+="</tbody>";
html+="</table>";
}
top.$.jBox(html,{width: $(document).width()*0.4,height: 400,title:title, buttons:false});
}
}
});
}
//删除区域IP
function delAreaIp(obj){
var thisObj=$(obj);