yxyhome.js 5.5 KB

// 程序名称:    时速邮件管理系统(EsMail)
// 程序版本:    V2.0
// 作    者:    深圳市科飞时速网络技术有限公司(0755-88843776)
// 版权所有:    深圳市科飞时速网络技术有限公司
// 技术支持:    Tech@21gmail.com
// 单元名称:    营首页js文件
// 开始时间:    2013.11.1
// 程 序 员:    谢勇
// 最后修改:    2013.11.1
// 备    注:    

var sendTolb=100
var nosendTolb=0;
var tdTolb=0;
var unTolb=0;
$(document).ready(function(){ 
	//加载控制参数
	loadParam();
	//1.查询统计信息
	findCountInfo();
});


//查询统计信息
function findCountInfo(){
	$.ajax({ 
		type: "post", 
		url: "count_findCountHome.action", 
		dataType:"json",
		error: function() {alert("异常");}, 
		success: function(msg) {
			$("#home_yxy_tolnum").html(msg.tolsend);//总量
			$("#yxy_clickTol").html(msg.clicktol);//点击总量
			$("#yxy_NoClickTol").html(msg.noclicktol);//未点击总量
			$("#yxy_unTol").html(msg.untol);//退订量
			$("#yxy_replyTol").html(msg.replytol);//回复量
			var clickBai=parseFloat((msg.clicktol/msg.tolsend));		
			if(msg.clicktol!=0&&msg.tolsend!=0){
				$("#yxy_clickBai").html((clickBai*100).toFixed(2)+"%");//点击百分比
				nosendTolb=parseFloat((clickBai*100).toFixed(2));
			}	
			
			var noClickBai=parseFloat((msg.noclicktol/msg.tolsend));
			if(msg.noclicktol!=0&&msg.tolsend!=0){
				$("#yxy_noClickBai").html((noClickBai*100).toFixed(2)+"%");//未点击百分比
				tdTolb=parseFloat((noClickBai*100).toFixed(2));
			}
			var UnBai=parseFloat(msg.untol/msg.tolsend);
			if(msg.untol!=0&&msg.tolsend!=0){
				$("#yxy_unBai").html((UnBai*100).toFixed(2)+"%");//退订击百分比
				unTolb=parseFloat((UnBai*100).toFixed(2));
			}
			
			zhuzi();
			//已发送
			$("#send_ci").html(msg.tolsend);
			//待发送
			$("#dai_ci").html(msg.daisend);
			//定时发送
			$("#time_ci").html(msg.timesend);
			//草稿
			$("#draft_ci").html(0);
		}
	});	
}

//图形展示
function zhuzi(){
	var pmg=$(window).height();
	$(".yx_con1").css("height",pmg);
 	var colors = Highcharts.getOptions().colors,
        categories = ['发送', '点读', '未读', '回复', '订阅', '退订'],
        data = [{
                y: sendTolb,
                color: colors[7]
            }, {
                y: nosendTolb,
                color: colors[1]
               
            }, {
                y: tdTolb,
                color: colors[2]
               
            }, {
                y: 0,
                color: colors[3]
                
            }, {
                y: 0,
                color: colors[4]
               
            },{
                y: unTolb,
                color: colors[5]
               
            }];

    function setChart(name, categories, data, color) {
	chart.xAxis[0].setCategories(categories, false);
	chart.series[0].remove(false);
	chart.addSeries({
		data: data,
		color: color || 'white'
	}, false);
	chart.redraw();
    }

    var chart = $('#homecom').highcharts({
        chart: {
            type: 'column'
        },
        title: {
            text: null
        },
		credits:{
                enabled:false // 禁用版权信息
         },
        xAxis: {
            categories: categories
        },
        yAxis: {
            title: {
                text: '单位:率百分比统计'
            }
        },
        plotOptions: {
            column: {
                cursor: 'pointer',
                point: {
                    events: {
                        click: function() {
                            var drilldown = this.drilldown;
                            if (drilldown) { // drill down
                                setChart(drilldown.name, drilldown.categories, drilldown.data, drilldown.color);
                            } else { // restore
                                setChart(name, categories, data);
                            }
                        }
                    }
                },
                dataLabels: {
                    enabled: true,
                    color: colors[0],
                    style: {
                        fontWeight: 'bold'
                    },
                    formatter: function() {
                        return this.y +'%';
                    }
                }
            }
        },
		 legend: {
            enabled: false
        },
        tooltip: {
            formatter: function() {
                var point = this.point,
                    s = this.x +':<b>'+ this.y +'% </b><br/>';
              
                return s;
            }
        },
        series: [{
            name: name,
            data: data,
            color: 'white'
        }],
        exporting: {
            enabled: false
        }
    })
    .highcharts();

}

function webserviceTest(){
	
		var	jData = "username###xieyong#####pass###123456"
		
		var url = "http://192.168.8.7:8081/webServiceText/webServices/Text_Service/Rtext";
		$.ajax({
			async:false,
			type:"POST",
			contentType:"application/json;charset=utf-8",
			url: url,
			data: jData,
			dataType: "json",
			success:function(jsonData){
				alert(jsonData);
			},
			error:function(x,e)
			{
				//alert( "向远程服务请求数据时出现未知错误!" );
				if ( fn_err != null )
				{
					fn_err( x );
				}
			}
		});
}

function loadParam(){
	$.ajax({ 
		type:"POST",
		url: "yxyinfo_findUserParamater.action", 
		cache: false, 
		async: false,
		success: function(msg) { 
			usergraph=msg.usergraph;
			domaingraph=msg.domaingraph;
		} 
	}); 
}