代理操控业务部分功能提交配置、导入、导出

This commit is contained in:
zhangwenqing
2019-05-21 19:15:54 +08:00
parent 8657cfa142
commit ac52747686
22 changed files with 3402 additions and 30 deletions

View File

@@ -14,6 +14,7 @@ $(function(){
$("input[name='serviceDictId']").click(function(){
switchService();
});
$("input[name='regionDictIds']").click(function(){
});
@@ -36,12 +37,21 @@ $(function(){
}
}
if($("#functionId").val() == 215){
profileChange($("input[name='manipulatType']:checked").val());
$("input[name='manipulatType']").click(function(){
profileChange($(this).val());
});
}
});
/**
* action动作切换
*/
function switchService(){
var functionId=$("#functionId").val();
if(functionId==5){//IP配置特殊处理
var cfgRegionCodeS=$("input[name='serviceDictId']:checked").attr("cfgRegionCodeS");
var cfgRegionCode=cfgRegionCodeS.split(",")[0];
@@ -78,6 +88,7 @@ function switchService(){
$(label).show();
}
}
}
/**
* 模板下载
@@ -85,9 +96,10 @@ function switchService(){
* */
function downLoadTemplate(path){
var obj={
"regionDictId":$("input[name='regionDictIds']:checked").val()
,"serviceDictId":$("input[name='serviceDictId']:checked").val()
,"requestId":$("select[name='requestId']").val()
"regionDictId":$("input[name='regionDictIds']:checked").val(),
"serviceDictId":$("input[name='serviceDictId']:checked").val(),
"requestId":$("select[name='requestId']").val(),
"manipulatType":$("input[name='manipulatType']:checked").val()
};
var params = $.param(obj);
document.location.href = path+'/ntc/iplist/import/template?' + params;
@@ -151,6 +163,7 @@ var importCfg=function(){
appFlag=false;
}
}
var fileName = $(".fileupload-preview", $("#importForm1")).text();
var $error = $('.alert-error', $("#importForm1"));
if(!appFlag){
@@ -160,6 +173,14 @@ var importCfg=function(){
return false;
}
// 代理-操控业务Profile Info
if($("#profileSelId").val() == "" || $("#profileSelId").val() == null){
$("span",$error).html($("#noneProfileTip").val());
$error.removeClass("hide");
$error.addClass("show");
return false;
}
if(fileName==""){
$("span",$error).html($("#noneFileTip").val());
$error.removeClass("hide");
@@ -172,6 +193,7 @@ var importCfg=function(){
$error.addClass("show");
return false;
}
$("#import_modal").modal('hide');//导入文件隐藏
$("#importForm1").submit();
}
@@ -181,4 +203,67 @@ var closeTip = function(){
var $error = $('.alert-error', $("#importForm1"));
$error.removeClass("show");
$error.addClass("hide");
}
function profileChange(val){
if(typeof val == 'undefined'){
return false;
}
$(".region").find("label[class='radio-inline']").each(function(){
$(this).show();
});
var reqHdrInput = $(".region").find("input[regionvalue='PXY_CTRL_HTTP_REQ_HDR']");
var resBodyInput = $(".region").find("input[regionvalue='PXY_CTRL_HTTP_RES_BODY']");
var reqBodyInput = $(".region").find("input[regionvalue='PXY_CTRL_HTTP_REQ_BODY']");
// 根据动作隐藏配置域,若该域隐藏前已被选中则默认选中首个
var resetFlag = false;
if(val == 48){
if($(resBodyInput).prop("checked") == true){
resetFlag = true;
}
$(resBodyInput).parents("label:first").hide();
}else if(val == 80){
if($(reqBodyInput).prop("checked") == true || $(resBodyInput).prop("checked") == true){
resetFlag = true;
}
$(reqBodyInput).parents("label:first").hide();
$(resBodyInput).parents("label:first").hide();
}else if(val == 85 || val == 90){
if($(reqHdrInput).prop("checked") == true || $(reqBodyInput).prop("checked") == true || $(resBodyInput).prop("checked") == true){
resetFlag = true;
}
$(reqHdrInput).parents("label:first").hide();
$(reqBodyInput).parents("label:first").hide();
$(resBodyInput).parents("label:first").hide();
}
if(resetFlag){
$("input[name='regionDictIds']:first").prop("checked",true);
}
if(val == 48 || val == 80){ // 重定向和替换动作无Profile属性
$(".profileInfo").addClass("hidden");
}else{
$(".profileInfo").removeClass("hidden");
// Get Policy Profile Info
var pathName = window.document.location.pathname.substring(0,window.document.location.pathname.lastIndexOf("/nis")+4);
$.ajax({
type:'get',
url:pathName+'/proxy/control/manipulatPolicy/ajaxGetProfileInfo?source='+val,
dataType:'json',
success:function(data){
if(data != null){
$("#profileSelId").empty();
$.each(data, function(i, n){
var option = new Option(data[i].cfgDesc, data[i].compileId);
$("#profileSelId")[0].options.add(option);
});
$("#profileSelId").selectpicker("refresh");
}
}
});
}
}