d21464470fb0f95d7d1400b3e637b3f007babfa3.svn-base 11.1 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408
// 程序名称:    时速邮件管理系统(EsMail)
// 程序版本:    V2.0
// 作    者:    深圳市科飞时速网络技术有限公司(0755-88843776)
// 版权所有:    深圳市科飞时速网络技术有限公司
// 技术支持:    Tech@21gmail.com
// 单元名称:    营销邮件统计js文件
// 开始时间:    2013.11.1
// 程 序 员:    谢勇
// 最后修改:    2013.11.1
// 备    注:    

$(document).ready(function(){
	//获取当前年份默认选中当前年
	var d = new Date();
	var vYear = d.getFullYear();
	$("#yxy_yearcheck").val(vYear);
	//$(parent.document).find("#ldt").show();
	//查询页头统计
	findpageCountInfo();
	//1.查询统计信息
	findCountInfo(0);
	//按年查看统计信息
	$("#yxy_yearcheck").change(function(){						
		findCountInfo($("#yxy_yearcheck").val());
	});
	
});

//查询统计信息
function findCountInfo(year){
	$.ajax({ 
		type: "post", 
		url: "yxyC_findCountByMonth.action", 
		dataType:"json",
		data:{
			findyear:year,
			isdomain:0
		},
		async:false,
	 	cache: false,
		error: function() {alert(frontMsg.get("yxy_mail.language_114"));}, 
		success: function(msg) {
			//矩形图赋值
			zhuxingValue(msg);
			//趋势图赋值
			qushiValue(msg);
		}
	});	
}

//矩形图赋值
function zhuxingValue(msg){
	
	var sendArry=new Array();//月发送数组
	sendArry[0]=0;sendArry[1]=0;sendArry[2]=0;sendArry[3]=0;sendArry[4]=0;sendArry[5]=0;sendArry[6]=0;sendArry[7]=0;sendArry[8]=0;sendArry[9]=0;sendArry[10]=0;sendArry[11]=0;
	$.each(msg.yxymailmonthcount,function(index,row){
		//获取月分
		var month=row.yxy_month_count_date.split("-")[1];
		if(month==01||month==1){
			sendArry[0]=row.yxy_month_count_tol_num;
		}else if(month==02||month==2){
			sendArry[1]=row.yxy_month_count_tol_num;
		}else if(month==03||month==3){
			sendArry[2]=row.yxy_month_count_tol_num;
		}else if(month==04||month==4){
			sendArry[3]=row.yxy_month_count_tol_num;
		}else if(month==05||month==5){
			sendArry[4]=row.yxy_month_count_tol_num;
		}else if(month==06||month==6){
			sendArry[5]=row.yxy_month_count_tol_num;
		}else if(month==07||month==7){
			sendArry[6]=row.yxy_month_count_tol_num;
		}else if(month==08||month==8){
			sendArry[7]=row.yxy_month_count_tol_num;
		}else if(month==09||month==9){
			sendArry[8]=row.yxy_month_count_tol_num;
		}else if(month==10){
			sendArry[9]=row.yxy_month_count_tol_num;
		}else if(month==11){
			sendArry[10]=row.yxy_month_count_tol_num;
		}else if(month==12){
			sendArry[11]=row.yxy_month_count_tol_num;
		}
	});
	
	var unArry=new Array();//月退订数组
	unArry[0]=0;unArry[1]=0;unArry[2]=0;unArry[3]=0;unArry[4]=0;unArry[5]=0;unArry[6]=0;unArry[7]=0;unArry[8]=0;unArry[9]=0;unArry[10]=0;unArry[11]=0;
	$.each(msg.unmonth,function(index,row){
		//获取月分
		var month=row.month;
		if(month==01||month==1){
			unArry[0]=row.monthnum;
		}else if(month==02||month==2){
			unArry[1]=row.monthnum;
		}else if(month==03||month==3){
			unArry[2]=row.monthnum;
		}else if(month==04||month==4){
			unArry[3]=row.monthnum;
		}else if(month==05||month==5){
			unArry[4]=row.monthnum;
		}else if(month==06||month==6){
			unArry[5]=row.monthnum;
		}else if(month==07||month==7){
			unArry[6]=row.monthnum;
		}else if(month==08||month==8){
			unArry[7]=row.monthnum;
		}else if(month==09||month==9){
			unArry[8]=row.monthnum;
		}else if(month==10){
			unArry[9]=row.monthnum;
		}else if(month==11){
			unArry[10]=row.monthnum;
		}else if(month==12){
			unArry[11]=row.monthnum;
		}
	});
	
	var clickArry=new Array();//月点击数组
	clickArry[0]=0;clickArry[1]=0;clickArry[2]=0;clickArry[3]=0;clickArry[4]=0;clickArry[5]=0;clickArry[6]=0;clickArry[7]=0;clickArry[8]=0;clickArry[9]=0;clickArry[10]=0;clickArry[11]=0;
	$.each(msg.clickmonth,function(index,row){
		//获取月分
		var month=row[0];
		if(month==01||month==1){
			clickArry[0]=row[1];
		}else if(month==02||month==2){
			clickArry[1]=row[1];
		}else if(month==03||month==3){
			clickArry[2]=row[1];
		}else if(month==04||month==4){
			clickArry[3]=row[1];
		}else if(month==05||month==5){
			clickArry[4]=row[1];
		}else if(month==06||month==6){
			clickArry[5]=row[1];
		}else if(month==07||month==7){
			clickArry[6]=row[1];
		}else if(month==08||month==8){
			clickArry[7]=row[1];
		}else if(month==09||month==9){
			clickArry[8]=row[1];
		}else if(month==10){
			clickArry[9]=row[1];
		}else if(month==11){
			clickArry[10]=row[1];
		}else if(month==12){
			clickArry[11]=row[1];
		}
	});
	
	var replyArry=new Array();//月回复数组
	replyArry[0]=0;replyArry[1]=0;replyArry[2]=0;replyArry[3]=0;replyArry[4]=0;replyArry[5]=0;replyArry[6]=0;replyArry[7]=0;replyArry[8]=0;replyArry[9]=0;replyArry[10]=0;replyArry[11]=0;
	$.each(msg.replaymonth,function(index,row){
		//获取月分
		var month=row[0];
		if(month==01||month==1){
			replyArry[0]=row[1];
		}else if(month==02||month==2){
			replyArry[1]=row[1];
		}else if(month==03||month==3){
			replyArry[2]=row[1];
		}else if(month==04||month==4){
			replyArry[3]=row[1];
		}else if(month==05||month==5){
			replyArry[4]=row[1];
		}else if(month==06||month==6){
			replyArry[5]=row[1];
		}else if(month==07||month==7){
			replyArry[6]=row[1];
		}else if(month==08||month==8){
			replyArry[7]=row[1];
		}else if(month==09||month==9){
			replyArry[8]=row[1];
		}else if(month==10){
			replyArry[9]=row[1];
		}else if(month==11){
			replyArry[10]=row[1];
		}else if(month==12){
			replyArry[11]=row[1];
		}
	});
	
	$('#container').highcharts({
		chart: {
			type: 'column'
		},
		title: {
			text: '月统计图'
		},
		
		xAxis: {
			categories: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
		},
		yAxis: {
			min: 0,
			title: {
				text: '数量'
			}
		},
		
		exporting: {
			enabled: false
		},
		tooltip: {
			headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
			pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
				'<td style="padding:0"><b>{point.y:.1f} </b></td></tr>',
			footerFormat: '</table>',
			shared: true,
			useHTML: true
		},
		plotOptions: {
			column: {
				pointPadding: 0.2,
				borderWidth: 0
			}
		},
		series: [{
			name: '月发送量',
			data: sendArry//[49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]

		}, {
			name: '月点击总量',
			data: clickArry//[83.6, 78.8, 98.5, 93.4, 106.0, 84.5, 105.0, 104.3, 91.2, 83.5, 106.6, 92.3]

		}, {
			name: '月回复总量',
			data: replyArry//[48.9, 38.8, 39.3, 41.4, 47.0, 48.3, 59.0, 59.6, 52.4, 65.2, 59.3, 51.2]

		}, {
			name: '月退订总量',
			data: unArry//[42.4, 33.2, 34.5, 39.7, 52.6, 75.5, 57.4, 60.4, 47.6, 39.1, 46.8, 51.1]

		}]
	});
}

//趋势图赋值
function qushiValue(msg){
	var clickArry=new Array();//月点击数组
	clickArry[0]=0;clickArry[1]=0;clickArry[2]=0;clickArry[3]=0;clickArry[4]=0;clickArry[5]=0;clickArry[6]=0;clickArry[7]=0;clickArry[8]=0;clickArry[9]=0;clickArry[10]=0;clickArry[11]=0;
	$.each(msg.clickZmonth,function(index,row){
		//获取月分
		var month=row[0];
		if(month==01||month==1){
			clickArry[0]=row[1];
		}else if(month==02||month==2){
			clickArry[1]=row[1];
		}else if(month==03||month==3){
			clickArry[2]=row[1];
		}else if(month==04||month==4){
			clickArry[3]=row[1];
		}else if(month==05||month==5){
			clickArry[4]=row[1];
		}else if(month==06||month==6){
			clickArry[5]=row[1];
		}else if(month==07||month==7){
			clickArry[6]=row[1];
		}else if(month==08||month==8){
			clickArry[7]=row[1];
		}else if(month==09||month==9){
			clickArry[8]=row[1];
		}else if(month==10){
			clickArry[9]=row[1];
		}else if(month==11){
			clickArry[10]=row[1];
		}else if(month==12){
			clickArry[11]=row[1];
		}
	});
	
	
	var unZArry=new Array();//月退订数组
	unZArry[0]=0;unZArry[1]=0;unZArry[2]=0;unZArry[3]=0;unZArry[4]=0;unZArry[5]=0;unZArry[6]=0;unZArry[7]=0;unZArry[8]=0;unZArry[9]=0;unZArry[10]=0;unZArry[11]=0;
	$.each(msg.unZmonth,function(index,row){
		//获取月分
		var month=row[0];
		if(month==01||month==1){
			unZArry[0]=row[1];
		}else if(month==02||month==2){
			unZArry[1]=row[1];
		}else if(month==03||month==3){
			unZArry[2]=row[1];
		}else if(month==04||month==4){
			unZArry[3]=row[1];
		}else if(month==05||month==5){
			unZArry[4]=row[1];
		}else if(month==06||month==6){
			unZArry[5]=row[1];
		}else if(month==07||month==7){
			unZArry[6]=row[1];
		}else if(month==08||month==8){
			unZArry[7]=row[1];
		}else if(month==09||month==9){
			unZArry[8]=row[1];
		}else if(month==10){
			unZArry[9]=row[1];
		}else if(month==11){
			unZArry[10]=row[1];
		}else if(month==12){
			unZArry[11]=row[1];
		}
	});
	
	var replyZArry=new Array();//月回复订数组
	replyZArry[0]=0;replyZArry[1]=0;replyZArry[2]=0;replyZArry[3]=0;replyZArry[4]=0;replyZArry[5]=0;replyZArry[6]=0;replyZArry[7]=0;replyZArry[8]=0;replyZArry[9]=0;replyZArry[10]=0;replyZArry[11]=0;
	$.each(msg.replyZmonth,function(index,row){
		//获取月分
		var month=row[0];
		if(month==01||month==1){
			replyZArry[0]=row[1];
		}else if(month==02||month==2){
			replyZArry[1]=row[1];
		}else if(month==03||month==3){
			replyZArry[2]=row[1];
		}else if(month==04||month==4){
			replyZArry[3]=row[1];
		}else if(month==05||month==5){
			replyZArry[4]=row[1];
		}else if(month==06||month==6){
			replyZArry[5]=row[1];
		}else if(month==07||month==7){
			replyZArry[6]=row[1];
		}else if(month==08||month==8){
			replyZArry[7]=row[1];
		}else if(month==09||month==9){
			replyZArry[8]=row[1];
		}else if(month==10){
			replyZArry[9]=row[1];
		}else if(month==11){
			replyZArry[10]=row[1];
		}else if(month==12){
			replyZArry[11]=row[1];
		}
	});
	$('#container1').highcharts({			
        chart: {
            type: 'line'
        },
        title: {
            text: '月统计走势图'
        },
        
        xAxis: {
            categories: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
        },
        yAxis: {
            title: {
                text: '百分比率(%)'
            }
        },
		
		exporting: {
            enabled: false
        },
        tooltip: {
            enabled: false,
            formatter: function() {
                return '<b>'+ this.series.name +'</b><br/>'+this.x +': '+ this.y +'°C';
            }
        },
        plotOptions: {
            line: {
                dataLabels: {
                    enabled: true
                },
                enableMouseTracking: false
            }
        },
        series: [{
            name: '退订',
            data: unZArry
        },{
            name: '点击',
            data: clickArry
        },{
            name: '回复',
            data: replyZArry
        }]
		
    });
}

//查询页头统计
function findpageCountInfo(){
	$.ajax({ 
		type: "post", 
		url: "yxyC_findCountPage.action", 
		dataType:"json",
		async:false,
	 cache: false,

		error: function() {alert(frontMsg.get("yxy_mail.language_114"));}, 
		success: function(msg) {
			//日发上限
			$("#yxyM_daysendmax").html(msg[0]);			
			//月发上限
			$("#yxyM_monthsendmax").html(msg[1]);			
			//日已发量
			$("#yxyM_daysendover").html(msg[2]);
			//月已发量
			$("#yxyM_monthsendover").html(msg[3]);
			//当日剩余量
			$("#yxyM_dayhavesend").html(msg[0]-msg[2]);
			//当月剩余量
			$("#yxyM_monthhavesend").html(msg[1]-msg[3]);
		}
	});	
}