ip配置form表单调整action与协议

This commit is contained in:
wangxin
2018-09-28 19:34:04 +08:00
parent 190d924195
commit 75060d9a09
2 changed files with 63 additions and 9 deletions

View File

@@ -20,10 +20,10 @@
$(".glyphicon-plus").first().click();
$(".ipPortList").find(".glyphicon-remove").addClass("hidden")
var action=$(".action:checked").val();
if(action==32||action==96){
$(".subscribeId").find(".glyphicon-remove").click();
/*if(action==32){
$(".subscribeId").find(".glyphicon-remove").click();
$(".subscribeId").prev("h4").addClass("hidden");
}
}*/
var regionCodes=$(".action:checked").attr("regionCode").split(",");
$("h4[class*='ipPortListTitle']").each(function(){
var has=false;
@@ -36,6 +36,7 @@
$(this).html("");
}
});
processAction($(".ipPortList"));
$(".action").on("change", function() {
$("#serviceId").val($(this).attr("serviceId"));
$("#protocolId").val($(this).attr("protocolId"));
@@ -57,16 +58,17 @@
$(this).find(".ipPortTitle").html(i18nCode);
});
var tabInfo=$(".ipPortList");
if(tabInfo){
processAction(tabInfo);
/* if(tabInfo){
tabInfo.find("[name$='cfgType']").val(cfgType);
tabInfo.find("[name$='cfgRegionCode']").val(cfgRegionCode);
//丢弃回流没有subscribeId
if($(this).val()==32||$(this).val()==96){
if($(this).val()==32||$(this).val()==96){
$(".subscribeId").find(".glyphicon-remove").click();
$(".subscribeId").prev("h4").addClass("hidden");
}else{
$(".subscribeId").prev("h4").removeClass("hidden");
}
}
//处理ICMP
if($(this).val()==32){
$.ipcommon.protocol.each(function(){
@@ -80,7 +82,7 @@
tabInfo.find("select[name$='protocol']").selectpicker("refresh");
}
}
} */
});
$("#serviceId").val($(".action:checked").attr("serviceId"));
$("#protocolId").val($(".action:checked").attr("protocolId"));
@@ -101,10 +103,10 @@
subscribeId=1;
}
//代表所有业务都隐藏了,提示必须增加一种业务数据
if(($(".boxSolid").length-1) ==($(".boxSolid.hidden").length-subscribeId)){
/* if(($(".boxSolid").length-1) ==($(".boxSolid.hidden").length-subscribeId)){
top.$.jBox.tip("<spring:message code='one_more'/>", "<spring:message code='info'/>");
return;
}
} */
//代表所有区域都隐藏了,提示必须增加个区域信息
if($("input[name='isAreaEffective']:checked").val()==1 && $(".container-fluid:visible").size()==0){
if($("#areaIsp").hasClass("hidden")) $("#areaIp").find(".glyphicon-plus").click();
@@ -183,6 +185,42 @@
}); */
$("." + addBtnClassName).removeClass("hidden");
}
var processAction=function(obj){
var o=$(obj)
if(o){
var action=$(".action:checked").val();
/*处理协议*/
var selectedProtocol=o.find("select[name$='protocol'] option:selected").attr("value");
//先清空,再添加
o.find("select[name$='protocol']").empty();
if(action==32){
$.ipcommon.protocol.each(function(){
if($(this).attr("value")==0||$(this).attr("value")==6||$(this).attr("value")==17||$(this).attr("value")==1||$(this).attr("value")==8||$(this).attr("value")==15){
o.find("select[name$='protocol']").append($(this));
}
})
}else if(action==16){
$.ipcommon.protocol.each(function(){
if($(this).attr("value")==0||$(this).attr("value")==6){
o.find("select[name$='protocol']").append($(this));
}
})
}else if(action==64){
$.ipcommon.protocol.each(function(){
if($(this).attr("value")==0||$(this).attr("value")==6||$(this).attr("value")==17){
o.find("select[name$='protocol']").append($(this));
}
})
}
o.find("select[name$='protocol']").selectpicker("refresh");
//切换后如果没找到选项,选任意协议
if(o.find("select[name$='protocol'] option[value='"+selectedProtocol+"']").length>0){
o.find("select[name$='protocol']").selectpicker("val",selectedProtocol);
}else{
o.find("select[name$='protocol']").selectpicker("val",0);
}
}
}
</script>
</head>
<body>