2018-10-15 10:14:01 +08:00
|
|
|
$(function(){
|
|
|
|
|
//打开导入modal
|
|
|
|
|
$(".import").click(function(){
|
|
|
|
|
$("#import_modal").modal({
|
|
|
|
|
backdrop:"static",
|
|
|
|
|
keyboard:false,
|
|
|
|
|
show:true
|
|
|
|
|
});
|
|
|
|
|
});
|
2018-10-19 17:19:52 +08:00
|
|
|
$("#appIdId").on("change",function(){
|
|
|
|
|
ajaxBehaviour($(this).val());
|
|
|
|
|
});
|
|
|
|
|
switchService();
|
2018-10-15 10:14:01 +08:00
|
|
|
$("input[name='serviceDictId']").click(function(){
|
2018-10-19 17:19:52 +08:00
|
|
|
switchService();
|
2018-10-15 10:14:01 +08:00
|
|
|
});
|
|
|
|
|
$("input[name='regionDictIds']").click(function(){
|
|
|
|
|
});
|
2018-10-22 17:23:40 +08:00
|
|
|
|
2018-10-15 10:14:01 +08:00
|
|
|
});
|
2018-10-19 17:19:52 +08:00
|
|
|
/**
|
|
|
|
|
* action动作切换
|
|
|
|
|
*/
|
|
|
|
|
function switchService(){
|
|
|
|
|
var functionId=$("#functionId").val();
|
2018-10-22 14:26:12 +08:00
|
|
|
if(functionId==5 || functionId==6){//IP配置特殊处理 //URL配置特殊处理
|
2018-10-19 17:19:52 +08:00
|
|
|
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");
|
2018-10-25 12:59:11 +08:00
|
|
|
if(cfgRegionCodeS.split(",").length <=1 ){
|
2018-10-22 17:23:40 +08:00
|
|
|
$(".region").addClass("hidden");
|
|
|
|
|
}else{
|
|
|
|
|
$(".region").removeClass("hidden");
|
|
|
|
|
}
|
|
|
|
|
}else{
|
2018-10-25 12:59:11 +08:00
|
|
|
if($("input[name='regionDictIds']").length <=1){
|
2018-10-22 17:23:40 +08:00
|
|
|
$(".region").addClass("hidden");
|
|
|
|
|
}else{
|
|
|
|
|
$(".region").removeClass("hidden");
|
|
|
|
|
}
|
2018-10-19 17:19:52 +08:00
|
|
|
}
|
2018-10-25 12:59:11 +08:00
|
|
|
if($("input[name='serviceDictId']").length <=1){
|
2018-10-22 17:23:40 +08:00
|
|
|
$(".service").addClass("hidden");
|
|
|
|
|
}else{
|
|
|
|
|
$(".service").removeClass("hidden");
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-19 17:19:52 +08:00
|
|
|
}
|
2018-10-15 10:14:01 +08:00
|
|
|
/**
|
|
|
|
|
* 模板下载
|
|
|
|
|
* 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;
|
|
|
|
|
|
|
|
|
|
}
|
2018-10-19 17:19:52 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
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='<select name="behaviorId" data-live-search="true" class="selectpicker form-control">'
|
|
|
|
|
+'<option value=""><spring:message code="select"/></option>';
|
|
|
|
|
if(data.length>0){
|
|
|
|
|
for(i=0;i<data.length;i++){
|
|
|
|
|
html+='<option value="'+data[i].code+'"';
|
|
|
|
|
html+='>'+data[i].name+'</option>';
|
|
|
|
|
}
|
|
|
|
|
html+='</select>';
|
|
|
|
|
$("#behaviorId").html(html);
|
|
|
|
|
$("[name='behaviorId']").selectpicker("refresh");
|
|
|
|
|
$("[name='behaviorId']").selectpicker("render");
|
|
|
|
|
}else{
|
|
|
|
|
html+='</select>';
|
|
|
|
|
$("#behaviorId").html(html);
|
|
|
|
|
$("[name='behaviorId']").selectpicker("refresh");
|
|
|
|
|
$("[name='behaviorId']").selectpicker("render");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
complete:function(XMLHttpRequest,status){//超时设置
|
|
|
|
|
if(status=="timeout"){
|
|
|
|
|
var html='<select name="behaviorId" data-live-search="true" class="selectpicker form-control">'
|
|
|
|
|
+'<option value=""><spring:message code="select"/></option></select>';
|
|
|
|
|
$("#behaviorId").html(html);
|
|
|
|
|
$("[name='behaviorId']").selectpicker("refresh");
|
|
|
|
|
$("[name='behaviorId']").selectpicker("render");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2018-10-19 22:07:16 +08:00
|
|
|
//导入配置
|
|
|
|
|
var importCfg=function(){
|
|
|
|
|
if($("#serviceId").val()==""){
|
|
|
|
|
alert("请选择action");
|
|
|
|
|
return ;
|
|
|
|
|
}
|
2018-10-22 17:23:40 +08:00
|
|
|
var appFlag=true;
|
2018-11-08 18:18:28 +08:00
|
|
|
if(($("#functionId").val() == 63)||($("#functionId").val() == 408)||($("#functionId").val() == 407)||
|
|
|
|
|
($("#functionId").val() == 402)||($("#functionId").val() == 403)||($("#functionId").val() == 405)){
|
2018-10-22 17:23:40 +08:00
|
|
|
var appIdValue=$("#appIdName").val();
|
|
|
|
|
if(appIdValue == null || appIdValue ==''){
|
|
|
|
|
appFlag=false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-10-19 22:07:16 +08:00
|
|
|
var fileName = $(".fileupload-preview", $("#importForm1")).text();
|
|
|
|
|
var $error = $('.alert-error', $("#importForm1"));
|
2018-10-22 17:23:40 +08:00
|
|
|
if(!appFlag){
|
|
|
|
|
$("span",$error).html($("#appError").val());
|
|
|
|
|
$error.removeClass("hide");
|
|
|
|
|
$error.addClass("show");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-19 22:07:16 +08:00
|
|
|
if(fileName==""){
|
2018-10-22 20:19:06 +08:00
|
|
|
$("span",$error).html($("#importTip").val());
|
2018-10-19 22:07:16 +08:00
|
|
|
$error.removeClass("hide");
|
|
|
|
|
$error.addClass("show");
|
|
|
|
|
return false;
|
|
|
|
|
|
2018-11-12 14:31:04 +08:00
|
|
|
}else if(fileName.lastIndexOf("\.")==-1/*||fileName.substring(fileName.lastIndexOf("\.")+1).toLowerCase()!='xls'*/ ||fileName.substring(fileName.lastIndexOf("\.")+1).toLowerCase()!='xlsx'){
|
2018-10-22 20:19:06 +08:00
|
|
|
$("span",$error).html($("#importTip").val());
|
2018-10-19 22:07:16 +08:00
|
|
|
$error.removeClass("hide");
|
|
|
|
|
$error.addClass("show");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
$("#import_modal").modal('hide');//导入文件隐藏
|
|
|
|
|
$("#importForm1").submit();
|
|
|
|
|
}
|