(1)common.js中action change的代码移除
(2)initCommIpVal的调用改到common.js中
This commit is contained in:
@@ -358,219 +358,8 @@ $(function(){
|
||||
}
|
||||
});
|
||||
$(".action").on("change", function() {
|
||||
//DNS REJECT 时选择dnsStrategyId
|
||||
var action=$("input[name='action']:checked").val();
|
||||
switchAction(action);
|
||||
|
||||
//拦截根据action切换动作部分
|
||||
setInterceptDefaultInfo("");
|
||||
|
||||
//dolog 白名单默认不显示,不记录日志
|
||||
if(action == 128 || action == 32){
|
||||
$(".doLog").addClass("hidden");
|
||||
$("input[name='doLog'][value=0]").prop("checked",true);
|
||||
}else{
|
||||
$(".doLog").removeClass("hidden");
|
||||
$("input[name='doLog'][value=2]").prop("checked",true);
|
||||
|
||||
}
|
||||
|
||||
$("#serviceId").val($(this).attr("serviceId"));
|
||||
$("#protocolId").val($(this).attr("protocolId"));
|
||||
var actionCode=$(this).val();
|
||||
var regionCode=$(this).attr("regionCode");
|
||||
if(!regionCode){
|
||||
regionCode=$("input[name='action']").attr("regionCode");
|
||||
}
|
||||
if(regionCode){
|
||||
if(regionCode.indexOf(",")==-1){
|
||||
$("#cfgRegionCode"+regionCode).attr("name","cfgRegionCode");
|
||||
$("#cfgType"+regionCode).attr("name","cfgType");
|
||||
$("[id^='cfgRegionCode']").each(function(){
|
||||
if($(this).attr("id")==("cfgRegionCode"+regionCode)){
|
||||
$(this).attr("name","cfgRegionCode");
|
||||
}else{
|
||||
$(this).removeAttr("name");
|
||||
}
|
||||
});
|
||||
$("[id^='cfgType']").each(function(){
|
||||
if($(this).attr("id")==("cfgType"+regionCode)){
|
||||
$(this).attr("name","cfgType");
|
||||
}else{
|
||||
$(this).removeAttr("name");
|
||||
}
|
||||
});
|
||||
}else{
|
||||
var _region='';
|
||||
var regionArr=regionCode.split(',');
|
||||
$("input[name$='cfgRegionCode'][regionType='1']").each(function(){
|
||||
for(var re in regionArr){
|
||||
if($(this).val()==regionArr[re]){
|
||||
serviceType=$(this).attr("serviceType");
|
||||
_region=regionArr[re];
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
if(_region!=''){
|
||||
regionCode=_region;
|
||||
}
|
||||
}
|
||||
var ipPortShow=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("ipPortShow"),
|
||||
ipType=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("ipType"),
|
||||
ipPattern=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("ipPattern"),
|
||||
portPattern=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("portPattern"),
|
||||
direction=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("direction"),
|
||||
protocol=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("protocol"),
|
||||
regionType=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("regionType");
|
||||
//ip,端口处理
|
||||
if(ipPortShow){
|
||||
if(ipPortShow.indexOf('1')>-1){//展示源IP,端口
|
||||
$("input[name$='srcIpAddress']").parents(".form-group").removeClass("hidden");
|
||||
$("input[name$='srcPort']").parents(".form-group").removeClass("hidden");
|
||||
}else{
|
||||
$("input[name$='srcIpAddress']").parents(".form-group").addClass("hidden");
|
||||
$("input[name$='srcPort']").parents(".form-group").addClass("hidden");
|
||||
}
|
||||
if(ipPortShow.indexOf('2')>-1){//展示目的IP,端口
|
||||
$("input[name$='destIpAddress']").parents(".form-group").removeClass("hidden");
|
||||
$("input[name$='destPort']").parents(".form-group").removeClass("hidden");
|
||||
}else{
|
||||
$("input[name$='destIpAddress']").parents(".form-group").addClass("hidden");
|
||||
$("input[name$='destPort']").parents(".form-group").addClass("hidden");
|
||||
}
|
||||
}
|
||||
if(ipType){
|
||||
var arr=ipType.split(',');
|
||||
$("select[name$='ipType'] option").each(function(){
|
||||
var has=false;
|
||||
for(var type in arr){
|
||||
if($(this).val()==arr[type]){
|
||||
has=true;
|
||||
if($(this).attr("disabled")){
|
||||
$(this).removeAttr("disabled")
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
$(this).attr("disabled",true);
|
||||
}
|
||||
});
|
||||
$("select[name$='ipType']").selectpicker("refresh");
|
||||
}
|
||||
if(ipPattern){
|
||||
arr=ipPattern.split(',');
|
||||
$("select[name$='ipPattern'] option").each(function(){
|
||||
var has=false;
|
||||
for(var type in arr){
|
||||
if($(this).val()==arr[type]){
|
||||
has=true;
|
||||
if($(this).attr("disabled")){
|
||||
$(this).removeAttr("disabled")
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
$(this).attr("disabled",true);
|
||||
}
|
||||
});
|
||||
$("select[name$='ipPattern']").selectpicker("refresh");
|
||||
}
|
||||
if(portPattern){
|
||||
arr=portPattern.split(',');
|
||||
$("select[name$='portPattern'] option").each(function(){
|
||||
var has=false;
|
||||
for(var type in arr){
|
||||
if($(this).val()==arr[type]){
|
||||
has=true;
|
||||
if($(this).attr("disabled")){
|
||||
$(this).removeAttr("disabled")
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
$(this).attr("disabled",true);
|
||||
}
|
||||
});
|
||||
$("select[name$='portPattern']").selectpicker("refresh");
|
||||
}
|
||||
if(direction){
|
||||
arr=direction.split(',');
|
||||
$("select[name$='direction'] option").each(function(){
|
||||
var has=false;
|
||||
for(var type in arr){
|
||||
if($(this).val()==arr[type]){
|
||||
has=true;
|
||||
if($(this).attr("disabled")){
|
||||
$(this).removeAttr("disabled")
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
$(this).attr("disabled",true);
|
||||
}
|
||||
});
|
||||
$("select[name$='direction']").selectpicker("refresh");
|
||||
}
|
||||
|
||||
if(protocol){
|
||||
arr=protocol.split(',');
|
||||
$("select[name$='protocol'] option").each(function(){
|
||||
var has=false;
|
||||
for(var type in arr){
|
||||
if($(this).val()==arr[type]){
|
||||
has=true;
|
||||
if($(this).attr("disabled")){
|
||||
$(this).removeAttr("disabled")
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
$(this).attr("disabled",true);
|
||||
}
|
||||
});
|
||||
$("select[name$='protocol']").selectpicker("refresh");
|
||||
}
|
||||
|
||||
//处理自定义字段
|
||||
var serviceType=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("serviceType");
|
||||
if(serviceType){
|
||||
if(serviceType.indexOf("ipaddr")>-1){
|
||||
if($(this).val()==32){
|
||||
$("select[name$='protocol'] option[value='1']").removeAttr("disabled")
|
||||
}else{
|
||||
$("select[name$='protocol'] option[value='1']").attr("disabled",true);
|
||||
}
|
||||
$("select[name$='protocol']").selectpicker("refresh");
|
||||
}
|
||||
if(serviceType.indexOf("ipmulitiplex")>-1){
|
||||
$(".ipmulitiplex").removeClass("hidden");
|
||||
}else{
|
||||
$(".ipmulitiplex").addClass("hidden");
|
||||
}
|
||||
if(serviceType.indexOf("ratelimit")>-1){
|
||||
if($(this).val()==64){
|
||||
$(".ratelimit").removeClass("hidden");
|
||||
}else{
|
||||
$(".ratelimit").addClass("hidden");
|
||||
}
|
||||
}else{
|
||||
$(".ratelimit").addClass("hidden");
|
||||
}
|
||||
if($(this).val()==0x20||$(this).val()==0x60){
|
||||
$("input[name$='isAreaEffective']").each(function(){
|
||||
if($(this).val()==0){
|
||||
$(this).click();
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
//选择hex cfgkeywords需校验十六进制
|
||||
$("select[name$='isHexbin']").each(function(){
|
||||
@@ -642,6 +431,7 @@ $(function(){
|
||||
window.history.back();
|
||||
return false;
|
||||
});
|
||||
initCommIpVal();
|
||||
});
|
||||
window.onload=function(){
|
||||
//日志查询IP类型增加格式提示
|
||||
@@ -1486,14 +1276,12 @@ var initCommIpVal=function(){
|
||||
if(regionCode.indexOf(",")==-1){
|
||||
$("#cfgRegionCode"+regionCode).attr("name","cfgRegionCode");
|
||||
$("#cfgType"+regionCode).attr("name","cfgType");
|
||||
serviceType=$("input[name$='cfgRegionCode'][regionType='1'][value='"+regionCode+"']").attr("serviceType");
|
||||
}else{
|
||||
var _region='';
|
||||
var regionArr=regionCode.split(',');
|
||||
$("input[name$='cfgRegionCode'][regionType='1']").each(function(){
|
||||
for(var re in regionArr){
|
||||
if($(this).val()==regionArr[re]){
|
||||
serviceType=$(this).attr("serviceType");
|
||||
_region=regionArr[re];
|
||||
break;
|
||||
}
|
||||
@@ -1504,52 +1292,13 @@ var initCommIpVal=function(){
|
||||
}
|
||||
}
|
||||
}
|
||||
if(serviceType){
|
||||
if(serviceType.indexOf("ipaddr")>-1&&$("input[name$='action']:checked").val()==32){
|
||||
$("select[name$='protocol'] option").each(function(){
|
||||
if($(this).attr("value")==1){
|
||||
$(this).removeAttr("disabled");
|
||||
}
|
||||
});
|
||||
$("select[name$='protocol']").selectpicker("refresh");
|
||||
}
|
||||
if(serviceType&&serviceType.indexOf("ipaddr")>-1&&$("input[name$='action']").val()==32){
|
||||
$("select[name$='protocol'] option").each(function(){
|
||||
if($(this).attr("value")==1){
|
||||
$(this).removeAttr("disabled");
|
||||
}
|
||||
});
|
||||
$("select[name$='protocol']").selectpicker("refresh");
|
||||
}
|
||||
if(serviceType.indexOf("ipmulitiplex")>-1){
|
||||
$(".ipmulitiplex").removeClass("hidden");
|
||||
$("input[name$='isAreaEffective']").each(function(){
|
||||
if($(this).val()==0){
|
||||
$(this).click();
|
||||
}
|
||||
})
|
||||
$(".areaInfo").addClass("hidden");
|
||||
}else{
|
||||
$(".areaInfo").removeClass("hidden");
|
||||
$(".ipmulitiplex").addClass("hidden");
|
||||
}
|
||||
if(serviceType.indexOf("ratelimit")>-1){
|
||||
if($("input[name$='action']").val()==64||$("input[name$='action']:checked").val()==64){
|
||||
$(".ratelimit").removeClass("hidden");
|
||||
}else{
|
||||
$(".ratelimit").addClass("hidden");
|
||||
}
|
||||
}else{
|
||||
$(".ratelimit").addClass("hidden");
|
||||
}
|
||||
}
|
||||
ipPortShow=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("ipPortShow"),
|
||||
ipType=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("ipType"),
|
||||
ipPattern=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("ipPattern"),
|
||||
portPattern=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("portPattern"),
|
||||
direction=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("direction"),
|
||||
protocol=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("protocol"),
|
||||
regionType=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("regionType");
|
||||
ipPortShow=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("ipPortShow"),
|
||||
ipType=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("ipType"),
|
||||
ipPattern=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("ipPattern"),
|
||||
portPattern=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("portPattern"),
|
||||
direction=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("direction"),
|
||||
protocol=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("protocol"),
|
||||
regionType=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("regionType");
|
||||
//ip,端口处理
|
||||
if(ipPortShow){
|
||||
if(ipPortShow.indexOf('1')>-1){//展示源IP,端口
|
||||
|
||||
Reference in New Issue
Block a user