dbe172661694c8e881971403fd214405f05f41b1.svn-base 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. /**
  2. * 应急发电机统计
  3. */
  4. var pageParam={};
  5. var chart=null;
  6. var utils=new Util();
  7. var searchUtil = new SearchUtil();
  8. var subTitle = {};
  9. $(function(){
  10. pageParam.style=utils.resolveUrl()["style"]||"style1";
  11. pageParam.title=utils.resolveUrl()["title"]||"广东电网";
  12. pageParam.number=utils.resolveUrl()["number"]||warnningnumber;
  13. pageParam.compId=utils.resolveUrl()["dept_id"]||"11";
  14. pageParam.startTime=start;
  15. pageParam.endTime=end;
  16. init();
  17. });
  18. function init(){
  19. loadChart(pageParam);
  20. };
  21. function loadChart(jsonParam){
  22. pageParam.isalert=null;
  23. if(pageParam.number.split("|")[0]=="预警"){
  24. pageParam.isalert="0";
  25. }else{
  26. pageParam.isalert="1";
  27. };
  28. pageParam.number=pageParam.number.split("|")[1];
  29. setTitle();
  30. $.post("/nwyj/ws/charts/CockpitChartsService/czYingjiziyuan",
  31. {dept_id:jsonParam.compId, number:jsonParam.number },function(result){
  32. if(result==null){
  33. zeroChart();
  34. return;
  35. };
  36. var res = result.rows;
  37. res.sort(function(a,b){
  38. return a.SORT - b.SORT;
  39. });
  40. veriColor(); //根据首页的传值判断样式
  41. removeNoData();
  42. var sArr=[{type:"bar",name:"本地",data:[], barMaxWidth:40,
  43. itemStyle: {
  44. normal: {borderWidth: 1,
  45. borderColor:"tomato",
  46. color: pageStyle[jsonParam.style]["chartColor"][0],
  47. label : { show : true, position:"top",
  48. textStyle: {
  49. color: "rgb(255, 255, 255)",
  50. fontSize: 14,
  51. fontStyle: "normal",
  52. fontWeight: "bold"
  53. }
  54. }
  55. }
  56. }
  57. },
  58. {type:"bar",name:"跨区",data:[], barMaxWidth:40,
  59. itemStyle: { normal: {borderWidth: 1, borderColor:"tomato",
  60. color: pageStyle[jsonParam.style]["chartColor"][1],
  61. label : { show : true, position:"top",
  62. textStyle: {
  63. color: "rgb(255, 255, 255)",
  64. fontSize: 14,
  65. fontStyle: "normal",
  66. fontWeight: "bold"
  67. }
  68. }
  69. }
  70. }
  71. }];
  72. var xAxis=[];
  73. var data=result.rows[0];
  74. var total_bd=0;
  75. var total_kq=0;
  76. var max=0;
  77. var flag = true;
  78. for(var index=0,len=result.rows.length;index<len;index++){
  79. var item = result.rows[index];
  80. if(item["COMP_ID"]==jsonParam.compId){
  81. subTitle.count_bd = utils.changeQ(item["FADIAN_JI_BD"]);
  82. subTitle.count_kq = utils.changeQ(item["FADIAN_JI_KQ"]);
  83. subTitle.dept_name = item["DEPT_NAME"];
  84. continue;
  85. };
  86. flag = false;
  87. var fdj_bd = utils.changeQ(item["FADIAN_JI_BD"]);
  88. var fdj_kq = utils.changeQ(item["FADIAN_JI_KQ"]);
  89. max = max > fdj_bd ? max : fdj_bd;
  90. max = max > fdj_kq ? max : fdj_kq;
  91. total_bd += fdj_bd;
  92. total_kq += fdj_kq;
  93. sArr[0].data.push({value:fdj_bd,data:{fdj_bd:fdj_bd,text:item["DEPT_NAME"],style:jsonParam.style,time:data["APPEAR_TIME"]}});
  94. sArr[1].data.push({value:fdj_kq,data:{fdj_kq:fdj_kq,text:item["DEPT_NAME"],style:jsonParam.style,time:data["APPEAR_TIME"]}});
  95. xAxis.push({value:subStrDept(item["DEPT_NAME"]),number:jsonParam.number,compId:item["COMP_ID"]});
  96. };
  97. if(flag){
  98. subDeptZeroChart("下属单位没有填报数据", subTitle.dept_name + "投入应急发电机(本地):"+subTitle.count_bd+"(辆) 投入应急发电机(跨区):"+subTitle.count_kq+"(辆)");
  99. return;
  100. };
  101. max=(parseInt(max/10)+1)*10;
  102. pageParam.opParams={
  103. title:"起始:"+data["SEND_TIME"]+" 截止:"+data["APPEAR_TIME"],//标题
  104. // subtext:"投入应急发电机(本地):"+total_bd+"(台) 投入应急发电机(跨区):"+total_kq+"(台)",
  105. subtext:"投入应急发电机(本地):"+subTitle.count_bd+"(台) 投入应急发电机(跨区):"+subTitle.count_kq+"(台)",
  106. saveName:$("#i_page_head_title").find("h2").html()+searchUtil.getNowFormatDateTime(new Date),
  107. unit:"台",//单位
  108. leArr:["本地","跨区"],//图例
  109. xAxis:xAxis,//x轴
  110. sArr:sArr,//主数据
  111. legendColor:legendC, //图例字体颜色
  112. xAxisColor:xAxisC, //X轴字体颜色
  113. yAxisColor:yAxisC, //Y轴字体颜色
  114. min:0,
  115. max:max,
  116. isVertical:true,
  117. fold:1
  118. };
  119. chart=getEchart($("#i_page_chart"),getOption,pageParam.opParams,null);
  120. // bindEvent();
  121. },"json");
  122. }
  123. $(window).resize(function(){
  124. chart.resize();
  125. });
  126. function setTitle(){
  127. $("#i_page_head_title").find("h2").remove();
  128. if(pageParam.title=="广东电网有限责任公司"){
  129. pageParam.title="广东电网公司";
  130. }
  131. $("#i_page_head_title").append("<h2>"+pageParam.title+"应急发电机统计</h2>");
  132. };
  133. function bindEvent(){
  134. chart.on("click",function(params){
  135. var pathStr=url["http_path"]+"page/cockpit/echart_maticView/emergercy_source/alert_pie_chart.html?"+encodeURI($.param(params.data.data));
  136. utils.openIframe(pathStr);
  137. });
  138. $(window).resize(function(){
  139. chart.resize();
  140. });
  141. };
  142. /*dwr推送方法 */
  143. function dwrData(number){
  144. if(number== pageParam.number){
  145. loadChart(pageParam);
  146. }
  147. }
  148. function subStrDept(str){
  149. str=str.replace("供电局","");
  150. str=str.replace("供电所","");
  151. return str;
  152. }