$(function(){ //打开导入modal $(".import").click(function(){ $("#import_modal").modal({ backdrop:"static", keyboard:false, show:true }); }); $("#appIdId").on("change",function(){ ajaxBehaviour($(this).val()); }); switchService(); $("input[name='serviceDictId']").click(function(){ switchService(); }); $("input[name='regionDictIds']").click(function(){ }); }); /** * action动作切换 */ function switchService(){ var functionId=$("#functionId").val(); if(functionId==5){//IP配置特殊处理 var cfgRegionCodeS=$("input[name='serviceDictId']:checked").attr("cfgRegionCodeS"); var cfgRegionCode=cfgRegionCodeS.split(",")[0]; $("input[name='regionDictIds'][cfgregioncoder!='"+cfgRegionCode+"']").prop("checked",false); $("input[name='regionDictIds'][cfgRegionCodeR!='"+cfgRegionCode+"']").parents(".radio-inline").addClass("hidden"); $("input[name='regionDictIds'][cfgRegionCodeR='"+cfgRegionCode+"']").prop("checked",true); $("input[name='regionDictIds'][cfgRegionCodeR='"+cfgRegionCode+"']").parents(".radio-inline").removeClass("hidden"); } } /** * 模板下载 * TODO 后期修改为传入regionDictId * */ function downLoadTemplate(path){ var obj={ "regionDictId":$("input[name='regionDictIds']:checked").val() ,"serviceDictId":$("input[name='serviceDictId']:checked").val() ,"requestId":$("select[name='requestId']").val() }; var params = $.param(obj); document.location.href = path+'/ntc/iplist/import/template?' + params; } var ajaxBehaviour=function(val){ var pathName=window.document.location.pathname.substring(0,window.document.location.pathname.indexOf("/nis")+4); var request=$.ajax({ type:'post', url:pathName+'/specific/specificServiceCfg/childrenList', data:{"parent":val}, dataType:'json', async:true, success:function(data,textStatus){//处理返回结果 if(textStatus=="success"){ var html=''; $("#behaviorId").html(html); $("[name='behaviorId']").selectpicker("refresh"); $("[name='behaviorId']").selectpicker("render"); }else{ html+=''; $("#behaviorId").html(html); $("[name='behaviorId']").selectpicker("refresh"); $("[name='behaviorId']").selectpicker("render"); } } }, complete:function(XMLHttpRequest,status){//超时设置 if(status=="timeout"){ var html=''; $("#behaviorId").html(html); $("[name='behaviorId']").selectpicker("refresh"); $("[name='behaviorId']").selectpicker("render"); } } }); }