123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555 |
- //数据表格使用
- var g;
- // 公司名称数组--X轴数据
- var compIds = "";
- var series = "";
- var gridData = "";
- var oneCols = [ {
- display : '特级用户',
- name : 'tjcustomerNum',
- width : "15%",
- align : 'center'
- },{
- display : '一级用户',
- name : 'yjcustomerNum',
- width : "15%",
- align : 'center'
- },{
- display : '二级用户',
- name : 'erjicustomerNum',
- width : "15%",
- align : 'center'
- },{
- display : '合计',
- name : 'zyyhNum',
- width : "15%",
- align : 'center'
- } ];
-
- //单位ID
- var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
- //柱状图
- var option = {
- title : {
- text: '重要用户信息统计图',
- subtext: '/人'
- },
- tooltip : {
- trigger: 'axis'
- },
- legend: {
- y : 'bottom',
- data:['特级用户','一级用户','二级用户']
- },
- toolbox: {
- show : true,
- feature : {
- mark : {show: true},
- dataView : {show: true, readOnly: false},
- magicType : {show: true, type: ['line', 'bar']},
- restore : {show: true},
- saveAsImage : {show: true}
- }
- },
- calculable : true,
- xAxis : [
- {
- type : 'category',
- data : ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月']
- }
- ],
- yAxis : [
- {
- type : 'value'
- }
- ],
- series : [
- {
- name:'特级用户',
- type:'bar',
- data:[2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]
- },
- {
- name:'一级用户',
- type:'bar',
- data:[2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]
- },
- {
- name:'二级用户',
- type:'bar',
- data:[2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]
- }
- ]
- };
- function changeBarOption(data){
- var legendData=[];
- var seriesData=[];
- var data1=[];
- var data2=[];
- var data3=[];
- for(var i=0;i<data.rows.length-1;i++){
- //alert(data.rows[i].name);
- legendData[i]=data.rows[i].name;
- data1[i]=data.rows[i].tjcustomerNum;
- data2[i]=data.rows[i].yjcustomerNum;
- data3[i]=data.rows[i].erjicustomerNum;
- }
- var series1={ name:'特级用户',
- type:'bar',
- data:data1
- };
- var series2={ name:'一级用户',
- type:'bar',
- data:data2
- };
- var series3={ name:'二级用户',
- type:'bar',
- data:data3
- };
- seriesData=[series1,series2,series3];
- option.xAxis[0].data=legendData;
- option.series=seriesData;
- }
- function changeBarOption2(data){
- var legendData=[];
- var seriesData=[];
- var data1=[];
- var data2=[];
- var data3=[];
- var data4=[];
- for(var i=0;i<data.rows.length-1;i++){
- //alert(data.rows[i].name);
- legendData[i]=data.rows[i].name;
- data1[i]=data.rows[i].national;
- data2[i]=data.rows[i].occupation;
- data3[i]=data.rows[i].provincial;
- data4[i]=data.rows[i].international;
- }
- var series1={ name:'国家标准',
- type:'bar',
- data:data1
- };
- var series2={ name:'行业标准',
- type:'bar',
- data:data2
- };
- var series3={ name:'地方标准',
- type:'bar',
- data:data3
- };
- var series4={ name:'国际标准',
- type:'bar',
- data:data4
- };
- //seriesData=[series1,series2,series3,series4,series5];
- option.legend.data=$("#CLASSES_242").attr("relText").split(",");
- var getInput=$("#CLASSES_242").attr("relText").split(",");
- var j=0;
- if($.inArray('国家标准',getInput)!=-1){
- seriesData[j]=series1;
- j++;
- }
- if($.inArray('行业标准',getInput)!=-1){
- seriesData[j]=series2;
- j++;
- }
- if($.inArray('地方标准',getInput)!=-1){
- seriesData[j]=series3;
- j++;
- }
- if($.inArray('国际标准',getInput)!=-1){
- seriesData[j]=series4;
- j++;
- }
- option.xAxis[0].data=legendData;
- option.series=seriesData;
- }
- //折线图option1
- var option1 = {
- title : {
- text: '重要用户信息统计图',
- subtext: '/人'
- },
- tooltip : {
- trigger: 'axis'
- },
- legend: {
- y:'bottom',
- data:['特级用户','一级用户','二级用户']
- },
- toolbox: {
- show : true,
- feature : {
- mark : {show: true},
- dataView : {show: true, readOnly: false},
- magicType : {show: true, type: ['line', 'bar']},
- restore : {show: true},
- saveAsImage : {show: true}
- }
- },
- calculable : true,
- xAxis : [
- {
- type : 'category',
- boundaryGap : false,
- data : ['特级用户','一级用户','二级用户']
- }
- ],
- yAxis : [
- {
- type : 'value'
- }
- ],
- series : [
- {
- name:'国家标准',
- type:'line',
-
- data:[20, 30, 50,40]
- },
- {
- name:'行业标准',
- type:'line',
-
- data:[10, 18, 19, 24]
- },
- {
- name:'地方标准',
- type:'line',
-
- data:[15, 22, 20, 15]
- }
- ]
- };
- function changeLineOption(data){
- var legendData=[];
- var seriesData=[];
- var data1=[];
- var data2=[];
- var data3=[];
- for(var i=0;i<data.rows.length-1;i++){
- //alert(data.rows[i].name);
- legendData[i]=data.rows[i].name;
- data1[i]=data.rows[i].tjcustomerNum;
- data2[i]=data.rows[i].yjcustomerNum;
- data3[i]=data.rows[i].erjicustomerNum;
- }
- var series1={ name:'特级用户',
- type:'line',
- data:data1
- };
- var series2={ name:'一级用户',
- type:'line',
- data:data2
- };
- var series3={ name:'二级用户',
- type:'line',
- data:data3
- };
-
-
- seriesData=[series1,series2,series3];
- option1.xAxis[0].data=legendData;
- option1.series=seriesData;
- }
- function changeLineOption2(data){
- var legendData=[];
- var seriesData=[];
- var data1=[];
- var data2=[];
- var data3=[];
- var data4=[];
- for(var i=0;i<data.rows.length-1;i++){
- //alert(data.rows[i].name);
- legendData[i]=data.rows[i].name;
- data1[i]=data.rows[i].national;
- data2[i]=data.rows[i].occupation;
- data3[i]=data.rows[i].provincial;
- data4[i]=data.rows[i].international;
- }
- var series1={ name:'国家标准',
- type:'line',
- data:data1
- };
- var series2={ name:'行业标准',
- type:'line',
- data:data2
- };
- var series3={ name:'地方标准',
- type:'line',
- data:data3
- };
- var series4={ name:'国际标准',
- type:'line',
- data:data4
- };
-
-
- option1.legend.data=$("#CLASSES_242").attr("relText").split(",");
- var getInput=$("#CLASSES_242").attr("relText").split(",");
- var j=0;
- if($.inArray('国家标准',getInput)!=-1){
- seriesData[j]=series1;
- j++;
- }
- if($.inArray('行业标准',getInput)!=-1){
- seriesData[j]=series2;
- j++;
- }
- if($.inArray('地方标准',getInput)!=-1){
- seriesData[j]=series3;
- j++;
- }
- if($.inArray('国际标准',getInput)!=-1){
- seriesData[j]=series4;
- j++;
- }
- //seriesData=[series1,series2,series3,series4,series5];
- option1.xAxis[0].data=legendData;
- option1.series=seriesData;
- }
- //饼图option2
- var option2 = {
- title : {
- text: '重要用户信息统计图',
- subtext: '/人'
- },
- tooltip : {
- trigger: 'item',
- formatter: "{a} <br/>{b} : {c} ({d}%)"
- },
- legend: {
- y : 'bottom',
- data:['特级用户','一级用户','二级用户']
- },
- toolbox: {
- show : true,
- feature : {
- mark : {show: true},
- dataView : {show: true, readOnly: false},
- magicType : {
- show: true,
- type: ['pie', 'funnel'],
- option: {
- funnel: {
- x: '25%',
- width: '50%',
- funnelAlign: 'left',
- max: 1548
- }
- }
- },
- restore : {show: true},
- saveAsImage : {show: true}
- }
- },
- calculable : true,
- series : [
- {
- name:'重要用户信息',
- type:'pie',
- radius : '55%',
- center: ['50%', '55%'],
- data:[
- {value:335, name:'特级用户'},
- {value:310, name:'一级用户'},
- {value:234, name:'二级用户'}
- ]
- }
- ]
- };
- function changePieOption2(data){
- /*************************************************** 初始化解析饼图数据 start**********************************************************/
- //option2.legend.data=['总体预案','专项预案','现场处置方案','部门预案'];
- var index=data.rows.length-1;
- var seriesJson=[];
- var j=0;
- if(data.rows[index]["tjcustomerNum"]!=undefined){
- var json={value:data.rows[index]["tjcustomerNum"],name:'特级用户'};
- seriesJson[j]=json;
- j++;
- }
- if(data.rows[index]["yjcustomerNum"]!=undefined){
- var json={value:data.rows[index]["yjcustomerNum"],name:'一级用户'};
- seriesJson[j]=json;
- j++;
- }
- if(data.rows[index]["erjicustomerNum"]!=undefined){
- var json={value:data.rows[index]["erjicustomerNum"],name:'二级用户'};
- seriesJson[j]=json;
- j++;
- }
-
-
- option2.series[0].data=seriesJson;
-
- /*************************************************** 初始化解析饼图数据 end **********************************************************/
- }
-
-
- // 表格的初始化
- function initComplete() {//gridData
- $("body").eq(0).showLoading();
- $.ajax({
- url : $.pathname()+ "/ws/customerHuiZong/customerHuiZongService/getCustomerInfo",
- type : 'post',
- timeout : 60000,
- data : {id : deptName},
- dataType : 'json',
- success : function(data){
- g = $("#maingrid").quiGrid({
- columns : [ {
-
- display : '所属单位',
- "name" : 'name',
- id : 'name',
- width : "15%",
- dept_id:'dept_id',
- align : 'center',
- },
- {
- display : '重要用户数量',
- columns : oneCols,
- width : "60%",
- }, {
- display : '重点关注用户',
- name : 'zdgzcustomerNum',
- width : "15%",
- align : 'center'
- },
- {
- display : '总合计',
- name : 'zTotal',
- align : 'center',
- width : "10%",
- }],
- //url :$.pathname()+ "/ws/customerHuiZong/customerHuiZongService/getCustomerInfo",
- //params : {id : deptName},
- data:data,
- rownumbers : true,
- /*height : 600,*/
- width : "100%",
- usePager : false,
- autoCheckChildren : true,
- tree : {
- columnId : 'name'
- }
- // treeAjax : true,
- // treeChildDataPath : $.pathname()
- // + '/ws/customerHuiZong/customerHuiZongService/getPlanInfoList?deptId=',
- // treeAutoParam:"dept_id"
- });
-
- $("body").eq(0).hideLoading();
-
- changeBarOption(data);
- changeLineOption(data);
- changePieOption2(data);
- var myChart1 = echarts.init(document.getElementById('main1'));
- myChart1.setOption(option);
- $(".basicTab").bind('actived',function(e,i){
- if(i==0){
- /***************************************** 加载柱状图 *********************************************************/
- var myChart1 = echarts.init(document.getElementById('main1'));
- myChart1.setOption(option);
- // initmyGraphic(data);
- }else if(i == 1){
- /***************************************** 加载折线图 *********************************************************/
- var myChart5 = echarts.init(document.getElementById('main2'));
- myChart5.setOption(option1);
- }else if(i==2){
- /***************************************** 加载饼图 *********************************************************/
- var myChart2 = echarts.init(document.getElementById('main3'));
- myChart2.setOption(option2);
- }
- });
-
-
- },
- error : function(e){
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
-
-
- }
-
- //返回事件
- function goBack() {
- var url = "/nwyj/page/business/am/customer/"+"customer-focus.jsp";
- parent.document.getElementById("frmright").setAttribute("src", ""+encodeURI(url));
- }
- // 图形初始化
- //function initGraphic() {
- // $('#container')
- // .highcharts(
- // {
- // chart : {
- // type : 'column'
- // },
- // title : {
- // text : '演练统计'
- // },
- // xAxis : {
- // categories : compIds
- // },
- // yAxis : {
- // min : 0,
- // title : {
- // text : '次数'
- // },
- // stackLabels : {
- // enabled : true,
- // style : {
- // fontWeight : 'bold',
- // color : (Highcharts.theme && Highcharts.theme.textColor)
- // || 'gray'
- // }
- // }
- // },
- // legend : {
- // align : 'right',
- // x : -70,
- // verticalAlign : 'top',
- // y : 20,
- // floating : true,
- // backgroundColor : (Highcharts.theme && Highcharts.theme.legendBackgroundColorSolid)
- // || 'white',
- // borderColor : '#CCC',
- // borderWidth : 1,
- // shadow : false
- // },
- // tooltip : {
- // formatter : function() {
- // return '<b>' + this.x + '</b><br/>'
- // + this.series.name + ': ' + this.y
- // + '<br/>' + '总量: '
- // + this.point.stackTotal;
- // }
- // },
- // plotOptions : {
- // column : {
- // stacking : 'normal',
- // dataLabels : {
- // enabled : true,
- // color : (Highcharts.theme && Highcharts.theme.dataLabelsColor)
- // || 'white'
- // }
- // }
- // },
- // series : series
- // });
- //}
|