employeeuser.js 5.4 KB
// 程序名称:    时速邮件管理系统(EsMail)
// 程序版本:    V2.0
// 作    者:    深圳市科飞时速网络技术有限公司(0755-88843776)
// 版权所有:    深圳市科飞时速网络技术有限公司
// 技术支持:    Tech@21gmail.com
// 单元名称:    用户管理js文件
// 开始时间:    2013.11.1
// 程 序 员:    谢勇
// 最后修改:    2013.11.1
// 备    注:    
var user_currpage=1;//当前页
var user_pageSize=10;//每页显示量
var user_tolpage=1;//总页数
$(document).ready(function(){
	
	//查找该域所有用户
	findDomainUser();
	
	//用户选择每页显示量
	$("#user_pageNum").blur(function(){
		user_pageSize=$("#user_pageNum").val();
		if(isNaN($('#user_pageNum').val())){
			alert("只能是数字");
		}else{
			user_currpage=1;
			findDomainUser();
		}
	});
	//跳转到多少页
	$("#user_selectpage").change(function(){
		user_currpage=$("#user_selectpage").val();
		findDomainUser();
	});
});

//查找该域所有用户
function findDomainUser(){	
	$.ajax({ 
		type: "post", 
		url: "yxyinfo_findDomainUser.action", 
		dataType:"json",
		async:false,
	 	cache: false,
		data:{
			currpage:user_currpage,
			pageSize:user_pageSize
		},
		error: function() {alert("失败,请重试!");}, 
		success: function(msg) {
			var html='';
			var role="普通用户";
			$.each(msg.userlist,function(index,row){
				if(row.userrole==1){
					role="系统管理员";
				}else{
					role="普通用户";
				}
				html+='<div class="emocs emlmbg">';
				html+='<div class="e1">'+row.loginid+'</div>';
				html+='<div class="e5">'+row.username+'</div>';
				html+='<div class="e2">'+role+'</div>';
				
				if(row.lastdate==null||row.lastdate==""){
					html+='<div class="e6">未访问</div>';
				}else{
					html+='<div class="e6">'+row.lastdate+'</div>';
				}
				
				html+='<div class="e4"><div class=e4_1><a href="javascript:employ_findCountInfo(\''+row.loginid+'\')">统计信息</a></div></div>';
				html+='</div>';
			});
			
			$("#user_list").html(html);
			
			$("#user_tolpage").html(msg.pageBean.totalPage);//总页数
			user_tolpage=msg.pageBean.totalPage;
		
			$("#user_currPage").html(msg.pageBean.currentPage);//当前页
			user_currpage=msg.pageBean.currentPage;
			$("#tolusernum").html(msg.pageBean.totalRecord);//总用户量
			//跳转
			var selectPage="";
			if(msg.userlist==null||msg.userlist==""){
				selectPage+='<option value="1">1</option>';
			}else{			
				for(var i=1;i<=msg.pageBean.totalPage;i++){//跳转页面
					selectPage+='<option value='+i+' id=user_option'+i+'>'+i+'</option>';
				}
			}		
			$("#user_selectpage").html(selectPage);
			var getid='user_option'+user_currpage;
			$("#"+getid).attr("selected","selected");
			}	
	});	
}


//首页
function user_homepage(){
	user_currpage=1;
	findDomainUser();
}

//下一页
function user_nextpage(){
	if(user_currpage>=user_tolpage){
	}else{
		user_currpage=user_currpage+1;
		findDomainUser();
	}
}

//上一页
function user_uppage(){
	if(user_currpage<=1){
	}else{
		user_currpage=user_currpage-1;
		findDomainUser();
	}
}
//尾页
function user_endpage(){
	user_currpage=user_tolpage;
	findDomainUser();
}


//查询统计信息
function employ_findCountInfo(loginid){
	$.ajax({ 
		type: "post", 
		url: "yxyC_findCountInfo.action", 
		dataType:"json",
		data:{
			loginid:loginid
		},
		async:false,
	 	cache: false,
		error: function() {alert(frontMsg.get("yxy_mail.language_114"));}, 
		beforeSend:function() { 
		},
		complete:function() { 
		},
		success: function(msg) {
			if(msg.yxymaildaycount!=""&&msg.yxymaildaycount!=null){
				//日赋值
				$("#yxy_dayci").html(msg.yxymaildaycount[0].yxy_day_count_ci_num);
				$("#yxy_daytol").html(msg.yxymaildaycount[0].yxy_day_count_tol_num);
				$("#yxy_dayemail").html(msg.yxymaildaycount[0].yxy_day_count_address_num);
			}else{
				$("#yxy_dayci").html(0);
				$("#yxy_daytol").html(0);
				$("#yxy_dayemail").html(0);
			}
			if(msg.yxymailmonthcount!=""&&msg.yxymailmonthcount!=null){
				//月赋值
				$("#yxy_monthci").html(msg.yxymailmonthcount[0].yxy_month_count_ci_num);
				$("#yxy_monthtol").html(msg.yxymailmonthcount[0].yxy_month_count_tol_num);
				$("#yxy_monthemail").html(msg.yxymailmonthcount[0].yxy_month_count_address_num);
			}else{
				$("#yxy_monthci").html(0);
				$("#yxy_monthtol").html(0);
				$("#yxy_monthemail").html(0);
			}
			if(msg.yxymailcount!=""&&msg.yxymailcount!=null){
				//总数赋值
				$("#yxy_tolci").html(msg.yxymailcount.yxy_count_ci_num);
				$("#yxy_tolnum").html(msg.yxymailcount.yxy_count_tol_num);
				$("#yxy_tolemail").html(msg.yxymailcount.yxy_count_email_num);
			}else{
				$("#yxy_tolci").html(0);
				$("#yxy_tolnum").html(0);
				$("#yxy_tolemail").html(0);
			}
			//点击赋值
			$("#yxy_dayclickday").html(msg.countinfo[0]);
			$("#yxy_dayclickmonth").html(msg.countinfo[1]);
			$("#yxy_tolclickTol").html(msg.countinfo[2]);
			
			//退订赋值
			$("#yxy_dayUn").html(msg.countinfo[3]);
			$("#yxy_montheUn").html(msg.countinfo[4]);
			$("#yxy_tolUn").html(msg.countinfo[5]);
			
			//地址赋值
			$("#yxy_dayemail").html(msg.countinfo[6]);
			$("#yxy_monthemail").html(msg.countinfo[7]);
			$("#yxy_tolemail").html(msg.countinfo[8]);
			
			employuser_popTips("用户统计信息","employ_countdiv",500);
		}
	});	
}

//弹出层调用
function employuser_popTips(name,id,dx,mailid,mailuid){
	showTipsWindown(name, id, dx);
}
function showTipsWindown(title,id,width){
		var hdeight2=$("#"+id).height();
	tipsWindown(title,"id:"+id,width,"100%",hdeight2,"true","","true",id);
}