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

@@ -0,0 +1,16 @@
UPDATE function_service_dict SET region_code=1 WHERE function_id=5 AND region_code='1,3';
UPDATE function_service_dict SET region_code=2 WHERE function_id=5 AND region_code='2,3';
UPDATE function_service_dict SET is_valid=0 WHERE function_id=5 AND ACTION=1;
UPDATE function_service_dict SET is_valid=0 WHERE function_id=5 AND ACTION=96;
#service_id需要定义出来之后进行替换
INSERT INTO function_service_dict (function_id,protocol_id,ACTION,action_code,service_id,service_name,service_desc,is_valid,region_code) VALUES(5,0,64,'ratelimit',1234,'ip_ratelimit','ip地址限速',1,1);
#根据PROTOCOL字典查出的值替换63
SELECT id FROM sys_data_dictionary_name WHERE mark= 'PROTOCOL';
INSERT INTO sys_data_dictionary_item (item_code,item_value,item_desc,item_sort,STATUS,TYPE,dictionary_id) VALUES(8,'IPSEC','IPSEC',0,1,1,63);
INSERT INTO sys_data_dictionary_item (item_code,item_value,item_desc,item_sort,STATUS,TYPE,dictionary_id) VALUES(15,'IPSEC','IPSEC',0,1,1,63);
UPDATE function_region_dict SET is_valid=0 WHERE function_id=5 AND config_region_value ='NTC_SUBSCRIBE_ID';
UPDATE function_region_dict SET config_protocol='0,6,17,1,8,15' WHERE function_id=5 AND config_region_value ='INLINE_IP_CB';
update function_region_dict set config_ip_type='4,6' where region_type=1 and config_ip_type like '%,46,64,10%';

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){
/*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,7 +58,8 @@
$(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
@@ -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>