6a506afd2e440c94016f3ec104e2d845eb07ba8b.svn-base 4.4 KB

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

//查询定时邮件
function yxyT_findMasterStatus(page){
	$.ajax({ 
		type: "post", 
		url: "yxyM_findMasterByStatus.action", 
		dataType:"json",
		data:{
			currpage:page,
			status:status,
			pageSize:yxyT_pageNum
		},
		error: function() {alert(frontMsg.get("yxy_mail.language_114"));}, 	
		success: function(msg) {
			var w= new Array();
			$.each(msg.masterList,function(index,row){
				var q= new Array();
				var subjet1=row.subject.split("###")[0];
				var subjet2=row.setsubject.split("###")[0];
				q[0]='';
				q[1]='<span title='+subjet1.replace(/\s/g," ")+'>'+subjet2+'</span>';
				q[2]='<span title='+row.setHHtime+'>'+row.setYYtime+'</span>';
				q[3]='<span>'+row.plans_send_time+'</span>';
				q[4]=row.send_num+"";
				q[5]='<div class="yxy_hb_dd yxy_hb_center yhb1"><a href="javascript:void(0);" onClick="yxyT_doing(\''+row.send_mail_id+'\',\''+row.plans_send_time+'\');">删除</a></div>';
				w[index]=q;
			});
			var joinhtml='<select id=yxyT_skips>';
			for(var p=0;p<msg.pageBean.totalPage;p++){
				if((p+1)==yxyT_currpage){
					joinhtml+='<option selected=selected>'+(p+1)+'</option>';
				}else{
					joinhtml+='<option>'+(p+1)+'</option>';
				}
				
			}
			joinhtml+='</select>';
			var joinhtml1='<select id=yxyT_page>';
			for(var o=50;o<=200;o=o+50){
				if(o==yxyT_pageNum){
					joinhtml1+='<option selected=selected>'+o+'</option>';
				}else{
					joinhtml1+='<option>'+o+'</option>';
				}
			}
			joinhtml1+='</select>';
			
			$("#yxyT_list").lgytable({
				tbinfo:'定时邮件',
				tbtitle:['','主题', '建立时间','定时时间','投递','操作'], 
				tbwidth:['10','400','100', '150','50', '50'],
				tbcon:[{"tbcon":w,"dqpage":msg.pageBean.currentPage,"tolpage":msg.pageBean.totalPage,"tolcount":msg.pageBean.totalRecord}],
				homepage:function(){
					yxyT_findMasterStatus(1);
				},
				prepage:function(){
					yxyT_currpage=msg.pageBean.currentPage;
					if(yxyT_currpage>1){
						yxyT_findMasterStatus(yxyT_currpage-1);
						yxyT_currpage--;
					}
				},
				nextpage:function(){
					yxyT_currpage=msg.pageBean.currentPage;
					if(yxyT_currpage<msg.pageBean.totalPage){
						yxyT_findMasterStatus(yxyT_currpage+1);
						yxyT_currpage++;
					}
				},
				lastpage:function(){
					yxyT_findMasterStatus(msg.pageBean.totalPage);
				},
				tbsetnumtxt:joinhtml1,
				tbsetnum:function(){//每页显示量
					yxyT_pageNum=$("#yxyT_page").val();
					yxyT_findMasterStatus(1);
				},
				tbsetpagetxt:joinhtml,
				tbsetpage:function(){//跳转到某页
					yxyT_currpage=$("#yxyT_skips").val();
					yxyT_findMasterStatus(yxyT_currpage);
				}
			});	
		}	
	});	
}

//删除邮件
function yxyT_doing(mailID,sendTimer){
	//判断两时间的相差量
	$.ajax({ 
		type: "post", 
		url: "yxyM_getTimer.action", 
		dataType:"json",
		data:{
			planSendTimer:sendTimer
		},
		error: function() {alert(frontMsg.get("yxy_mail.language_114"));}, 
		success: function(msg) {
			if(msg==1){
				var a= confirm("你确定删除该定邮件?删除后将无法还原!"); 
				if(a==true){
				$.ajax({ 
				type: "post", 
				url: "yxyM_delMailByID.action", 
				dataType:"json",
				data:{
					mailID:mailID
				},
				error: function() {alert("系统异常");}, 
				success: function(msg) {
					if(msg==1){
						yxyT_findMasterStatus(yxyT_currpage);
					}else{
						alert("删除失败!");
					}
				}	
			});	
	}else{
		return ;
	}
			}else{
				alert("定时邮件已经在发送中无法删除!");
				return;
			}
		}	
	});
}