配置保护名单功能改为实时查询.

This commit is contained in:
zhangwenqing
2019-04-02 11:50:12 +08:00
parent 04db6bcb47
commit f6405c6f04
3 changed files with 39 additions and 21 deletions

View File

@@ -10,7 +10,7 @@ public class P2pIpTemplate extends IpAllTemplate {
private String userRegion2; private String userRegion2;
@ExcelField(title="p2p_ip_config_type",dictType="P2P_IP_TYPE",align=2,sort=2) @ExcelField(title="p2p_ip_config_type",dictType="P2P_IP_TYPE",align=2,sort=5)
public String getUserRegion2() { public String getUserRegion2() {
return userRegion2; return userRegion2;
} }

View File

@@ -96,7 +96,9 @@ public class InnerProtectionListService extends BaseService{
if(dictMap.containsKey(info.getTargetType())) { if(dictMap.containsKey(info.getTargetType())) {
putList = dictMap.get(info.getTargetType()); putList = dictMap.get(info.getTargetType());
} }
putList.add(info.getKeyword()); if(!putList.contains(info.getKeyword())) {
putList.add(info.getKeyword());
}
dictMap.put(info.getTargetType(), putList); dictMap.put(info.getTargetType(), putList);
} }
CacheUtils.put(Constants.CACHE_PROTECTION_LIST_DICT, dictMap); CacheUtils.put(Constants.CACHE_PROTECTION_LIST_DICT, dictMap);

View File

@@ -34,7 +34,6 @@ $(function(){
type:'get', type:'get',
url:pathName+'/basics/innerProtectionList/ajaxGetAllInfo', url:pathName+'/basics/innerProtectionList/ajaxGetAllInfo',
dataType:"json", dataType:"json",
async:false,
success:function(data){ success:function(data){
if(data != null){ if(data != null){
protectionData = data; protectionData = data;
@@ -42,18 +41,15 @@ $(function(){
var list = data[key]; var list = data[key];
$("."+key).each(function(){ $("."+key).each(function(){
if(!$(this).hasClass("tags")){ if(!$(this).hasClass("tags")){
this.setAttribute("onblur","protectedListWarn(this,'"+list+"')"); this.setAttribute("onblur","protectedListWarn(this,'"+key+"')");
} }
protectedListWarn(this,list); protectedListWarn(this,key);
}); });
} }
} }
} }
}); });
//增加描述新增时的文字长度限制 //增加描述新增时的文字长度限制
$("form input[name='cfgDesc']").attr("maxlength","128"); $("form input[name='cfgDesc']").attr("maxlength","128");
$("form input[name='cfgDesc']").addClass("required"); $("form input[name='cfgDesc']").addClass("required");
@@ -459,7 +455,7 @@ $(function(){
var tagObj = $(this); var tagObj = $(this);
for(var key in protectionData){ for(var key in protectionData){
if(tagObj.hasClass(key)){ if(tagObj.hasClass(key)){
protectedListWarn(tagObj,protectionData[key]); protectedListWarn(tagObj,key);
} }
} }
}, },
@@ -476,7 +472,7 @@ $(function(){
var tagObj = $(this); var tagObj = $(this);
for(var key in protectionData){ for(var key in protectionData){
if(tagObj.hasClass(key)){ if(tagObj.hasClass(key)){
protectedListWarn(tagObj,protectionData[key]); protectedListWarn(tagObj,key);
} }
} }
} }
@@ -1746,15 +1742,35 @@ function addPrintTableCss(rowValue,cellValue,tableIdValue,cssName){
} }
} }
/**保护名单提醒**/ /**保护名单提醒**/
function protectedListWarn(obj,protectedList){ function protectedListWarn(obj,tagKey){
$(obj).next(".fa-warning").remove(); var pathName = window.document.location.pathname.substring(0,window.document.location.pathname.lastIndexOf("/nis")+4);
var value = $(obj).val(); $.ajax({
if(value != ""){ type:'get',
protectedList = typeof(protectedList) == 'string' ? protectedList.split(",") : protectedList; url:pathName+'/basics/innerProtectionList/ajaxGetAllInfo',
if(protectedList.indexOf(value) >= 0){ dataType:"json",
//$(obj).after("<i class='fa fa-warning font-red-flamingo'>"+$.validator.messages.protect_warn+"</i>"); success:function(data){
$.jBox.info($.validator.messages.protect_warn,$.validator.messages.info); if(data != null){
$('.jbox-body .jbox-icon').css('top','55px'); for(var key in data){
var list = data[key];
$("."+key).each(function(){
if(!$(this).hasClass("tags")){
this.setAttribute("onblur","protectedListWarn(this,'"+key+"')");
}
});
}
$(obj).next(".fa-warning").remove();
var value = $(obj).val();
var protectedList = data[tagKey];
if(value != "" && typeof(protectedList) != "undefined"){
if(protectedList.indexOf(value) >= 0){ // 关键字匹配则弹出提示框
$.jBox.info($.validator.messages.protect_warn,$.validator.messages.info);
$('.jbox-body .jbox-icon').css('top','55px');
}
}
}
} }
} });
} }