防止不同页面冲突,加入判断
This commit is contained in:
@@ -367,174 +367,177 @@ $(function(){
|
|||||||
if(!regionCode){
|
if(!regionCode){
|
||||||
regionCode=$("input[name='action']").attr("regionCode");
|
regionCode=$("input[name='action']").attr("regionCode");
|
||||||
}
|
}
|
||||||
$("[id='cfgRegionCode']").each(function(){
|
if(regionCode){
|
||||||
if($(this).attr("id")==("cfgRegionCode"+regionCode)){
|
$("[id='cfgRegionCode']").each(function(){
|
||||||
$(this).attr("name","cfgRegionCode");
|
if($(this).attr("id")==("cfgRegionCode"+regionCode)){
|
||||||
}else{
|
$(this).attr("name","cfgRegionCode");
|
||||||
$(this).removeAttr("name");
|
}else{
|
||||||
}
|
$(this).removeAttr("name");
|
||||||
});
|
|
||||||
$("[id='cfgType']").each(function(){
|
|
||||||
if($(this).attr("id")==("cfgType"+regionCode)){
|
|
||||||
$(this).attr("name","cfgType");
|
|
||||||
}else{
|
|
||||||
$(this).removeAttr("name");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
var ipPortShow=$("input[name='cfgRegionCode']").attr("ipPortShow"),
|
|
||||||
ipType=$("input[name='cfgRegionCode']").attr("ipType"),
|
|
||||||
ipPattern=$("input[name='cfgRegionCode']").attr("ipPattern"),
|
|
||||||
portPattern=$("input[name='cfgRegionCode']").attr("portPattern"),
|
|
||||||
direction=$("input[name='cfgRegionCode']").attr("direction"),
|
|
||||||
protocol=$("input[name='cfgRegionCode']").attr("protocol");
|
|
||||||
//ip,端口处理
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
arr=ipPattern.split(',');
|
$("[id='cfgType']").each(function(){
|
||||||
$("select[name='ipPattern'] option").each(function(){
|
if($(this).attr("id")==("cfgType"+regionCode)){
|
||||||
var has=false;
|
$(this).attr("name","cfgType");
|
||||||
for(var type in arr){
|
}else{
|
||||||
if($(this).val()==arr[type]){
|
$(this).removeAttr("name");
|
||||||
has=true;
|
|
||||||
if($(this).attr("disabled")){
|
|
||||||
$(this).removeAttr("disabled")
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!has){
|
|
||||||
$(this).attr("disabled",true);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
arr=portPattern.split(',');
|
var ipPortShow=$("input[name='cfgRegionCode']").attr("ipPortShow"),
|
||||||
$("select[name='portPattern'] option").each(function(){
|
ipType=$("input[name='cfgRegionCode']").attr("ipType"),
|
||||||
var has=false;
|
ipPattern=$("input[name='cfgRegionCode']").attr("ipPattern"),
|
||||||
for(var type in arr){
|
portPattern=$("input[name='cfgRegionCode']").attr("portPattern"),
|
||||||
if($(this).val()==arr[type]){
|
direction=$("input[name='cfgRegionCode']").attr("direction"),
|
||||||
has=true;
|
protocol=$("input[name='cfgRegionCode']").attr("protocol");
|
||||||
if($(this).attr("disabled")){
|
//ip,端口处理
|
||||||
$(this).removeAttr("disabled")
|
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");
|
||||||
|
}
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
if(!has){
|
||||||
if(!has){
|
$(this).attr("disabled",true);
|
||||||
$(this).attr("disabled",true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//处理自定义字段
|
|
||||||
var serviceType=$("#cfgRegionCode"+regionCode).attr("serviceType");
|
|
||||||
/*if(serviceType.indexOf("ipaddr")>-1){
|
|
||||||
if($(this).val()==32){
|
|
||||||
if($("[name='protocol']").find("option[value='1']").length==0){
|
|
||||||
$("[name='protocol']").append('<option class="icmp" value="1" <c:if test="${_cfg.protocol==1}">selected</c:if>><spring:message code="ICMP"/></option>');
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
if($("[name='protocol'] option[value='1']")){
|
|
||||||
if($("[name='protocol'] option[value='1']").is(":selected")){
|
|
||||||
$("[name='protocol'] option[value='1']").removeAttr("selected");
|
|
||||||
$("[name='protocol']").val(0);
|
|
||||||
}
|
|
||||||
$("[name='protocol'] option[value='1']").remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
$("[name='protocol']").selectpicker("render");
|
|
||||||
$("[name='protocol']").selectpicker("refresh");
|
|
||||||
|
|
||||||
}*/
|
|
||||||
if(serviceType.indexOf("ipaddr")>-1){
|
|
||||||
if($(this).val()==32){
|
|
||||||
$("select[name='protocol'] option").each(function(){
|
|
||||||
if($(this).attr("value")==32){
|
|
||||||
$(this).removeAttr("disabled");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}else{
|
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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//处理自定义字段
|
||||||
|
var serviceType=$("#cfgRegionCode"+regionCode).attr("serviceType");
|
||||||
|
/*if(serviceType.indexOf("ipaddr")>-1){
|
||||||
|
if($(this).val()==32){
|
||||||
|
if($("[name='protocol']").find("option[value='1']").length==0){
|
||||||
|
$("[name='protocol']").append('<option class="icmp" value="1" <c:if test="${_cfg.protocol==1}">selected</c:if>><spring:message code="ICMP"/></option>');
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if($("[name='protocol'] option[value='1']")){
|
||||||
|
if($("[name='protocol'] option[value='1']").is(":selected")){
|
||||||
|
$("[name='protocol'] option[value='1']").removeAttr("selected");
|
||||||
|
$("[name='protocol']").val(0);
|
||||||
|
}
|
||||||
|
$("[name='protocol'] option[value='1']").remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
$("[name='protocol']").selectpicker("render");
|
||||||
|
$("[name='protocol']").selectpicker("refresh");
|
||||||
|
|
||||||
|
}*/
|
||||||
|
if(serviceType.indexOf("ipaddr")>-1){
|
||||||
|
if($(this).val()==32){
|
||||||
|
$("select[name='protocol'] option").each(function(){
|
||||||
|
if($(this).attr("value")==32){
|
||||||
|
$(this).removeAttr("disabled");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if(serviceType.indexOf("ipmulitiplex")>-1){
|
||||||
if(serviceType.indexOf("ipmulitiplex")>-1){
|
$(".ipmulitiplex").removeClass("hidden");
|
||||||
$(".ipmulitiplex").removeClass("hidden");
|
}else{
|
||||||
}else{
|
$(".ipmulitiplex").addClass("hidden");
|
||||||
$(".ipmulitiplex").addClass("hidden");
|
}
|
||||||
}
|
if(serviceType.indexOf("ratelimit")>-1){
|
||||||
if(serviceType.indexOf("ratelimit")>-1){
|
if($(this).val()==64){
|
||||||
if($(this).val()==64){
|
$(".ratelimit").removeClass("hidden");
|
||||||
$(".ratelimit").removeClass("hidden");
|
}else{
|
||||||
|
$(".ratelimit").addClass("hidden");
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
$(".ratelimit").addClass("hidden");
|
$(".ratelimit").addClass("hidden");
|
||||||
}
|
}
|
||||||
}else{
|
if($(this).val()==0x20||$(this).val()==0x60){
|
||||||
$(".ratelimit").addClass("hidden");
|
$("input[name='isAreaEffective']").each(function(){
|
||||||
}
|
if($(this).val()==0){
|
||||||
if($(this).val()==0x20||$(this).val()==0x60){
|
$(this).click();
|
||||||
$("input[name='isAreaEffective']").each(function(){
|
}
|
||||||
if($(this).val()==0){
|
})
|
||||||
$(this).click();
|
}
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
//选择hex cfgkeywords需校验十六进制
|
//选择hex cfgkeywords需校验十六进制
|
||||||
$("select[name$='isHexbin']").each(function(){
|
$("select[name$='isHexbin']").each(function(){
|
||||||
|
|||||||
Reference in New Issue
Block a user