$('#quicktools').change(function(){
$('#formAjax').submit();
});
function ajaxfun() { $('#formAjax').ajaxForm({ beforeSubmit: function(arr,$form,options) { var checked_id = $('input[type=checkBox][name=id\\[\\]]:checked').length; if(checked_id == 0) { alert('请选择一个要操作的数据'); return false; } var actval = $("#quicktools").val(); if( actval == 'edit') { if(checked_id == 1) { $('#formAjax').unbind(); $('#formAjax').submit(); }else { alert('编辑操作只能选择一个数据.'); return false; } }else if( actval == 'add') { $('#formAjax').unbind(); $('#formAjax').submit(); }else if( actval == 'del' || actval == 'delavatar' || actval == 'unlock' || actval == 'deldata' || actval == 'ban' ) { if(!opt) { //optverlay(); return false; } } //$('#formAjax').unbind(); },success: function(data) { var obj = data ; //('(' + data + ')'); if(obj.status) { //self.location= "{:U('/supersystem/setauth')}"; $(".errorBox p:first").text(obj.info); $(".errorBox p").css('color','#00FF00'); opt = 0; if(obj.status == 2) setTimeout(function(){ window.location.reload() },600); if(obj.status == 3) setTimeout(function(){ self.location= obj.data.url },600); //setTimeout(function(){ self.location= "{:U('/supersystem/setauth')}" },1000); }else{ $(".errorBox p:first").text(obj.info); $(".errorBox p").css('color','#FFE808'); $("#bansubmit").removeAttr('disabled'); $( "#dialog-confirm" ).dialog( "close" ); opt = 0; } } }); /* global ajax effects $("#formAjax").ajaxStart(function(){ $(".errorBox p:first").text('正在增加配置请稍后...'); $(".errorBox p").css('color','#00CC1F'); $("#bansubmit").attr('disabled','disabled'); }); show Overlay */ } function optverlay() { var delconfirm = $( ".del-confirm" ) delconfirm.click(function(){ var uid = $(this).attr('data-id'); $( "#dialog-confirm" ).dialog({ resizable: false,modal: true,buttons: { "确定": function() { $.post("{:U('/supertraffic/delip')}",{ id: uid },function(data) { if(data.status) { setTimeout(function(){ window.location.reload() },300); }else{ alert("提示信息: " + data); } }); $( this ).dialog( "close" ); },"取消": function() { $( this ).dialog( "close" ); } } }); }) }