123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- /**
- * 应急发电机统计
- */
- var pageParam={};
- var chart=null;
- var utils=new Util();
- var searchUtil = new SearchUtil();
- var subTitle = {};
- $(function(){
- pageParam.style=utils.resolveUrl()["style"]||"style1";
- pageParam.title=utils.resolveUrl()["title"]||"广东电网";
- pageParam.number=utils.resolveUrl()["number"]||warnningnumber;
- pageParam.compId=utils.resolveUrl()["dept_id"]||"11";
- pageParam.startTime=start;
- pageParam.endTime=end;
- init();
- });
- function init(){
- loadChart(pageParam);
- };
- function loadChart(jsonParam){
- pageParam.isalert=null;
- if(pageParam.number.split("|")[0]=="预警"){
- pageParam.isalert="0";
- }else{
- pageParam.isalert="1";
- };
- pageParam.number=pageParam.number.split("|")[1];
- setTitle();
- $.post("/nwyj/ws/charts/CockpitChartsService/czYingjiziyuan",
- {dept_id:jsonParam.compId, number:jsonParam.number },function(result){
-
- if(result==null){
- zeroChart();
- return;
- };
- var res = result.rows;
- res.sort(function(a,b){
- return a.SORT - b.SORT;
- });
- veriColor(); //根据首页的传值判断样式
- removeNoData();
- var sArr=[{type:"bar",name:"本地",data:[], barMaxWidth:40,
- itemStyle: {
- normal: {borderWidth: 1,
- borderColor:"tomato",
- color: pageStyle[jsonParam.style]["chartColor"][0],
- label : { show : true, position:"top",
- textStyle: {
- color: "rgb(255, 255, 255)",
- fontSize: 14,
- fontStyle: "normal",
- fontWeight: "bold"
- }
- }
- }
- }
- },
- {type:"bar",name:"跨区",data:[], barMaxWidth:40,
- itemStyle: { normal: {borderWidth: 1, borderColor:"tomato",
- color: pageStyle[jsonParam.style]["chartColor"][1],
- label : { show : true, position:"top",
- textStyle: {
- color: "rgb(255, 255, 255)",
- fontSize: 14,
- fontStyle: "normal",
- fontWeight: "bold"
- }
- }
- }
- }
- }];
- var xAxis=[];
- var data=result.rows[0];
- var total_bd=0;
- var total_kq=0;
- var max=0;
- var flag = true;
- for(var index=0,len=result.rows.length;index<len;index++){
- var item = result.rows[index];
- if(item["COMP_ID"]==jsonParam.compId){
- subTitle.count_bd = utils.changeQ(item["FADIAN_JI_BD"]);
- subTitle.count_kq = utils.changeQ(item["FADIAN_JI_KQ"]);
- subTitle.dept_name = item["DEPT_NAME"];
- continue;
- };
- flag = false;
- var fdj_bd = utils.changeQ(item["FADIAN_JI_BD"]);
- var fdj_kq = utils.changeQ(item["FADIAN_JI_KQ"]);
- max = max > fdj_bd ? max : fdj_bd;
- max = max > fdj_kq ? max : fdj_kq;
- total_bd += fdj_bd;
- total_kq += fdj_kq;
- sArr[0].data.push({value:fdj_bd,data:{fdj_bd:fdj_bd,text:item["DEPT_NAME"],style:jsonParam.style,time:data["APPEAR_TIME"]}});
- sArr[1].data.push({value:fdj_kq,data:{fdj_kq:fdj_kq,text:item["DEPT_NAME"],style:jsonParam.style,time:data["APPEAR_TIME"]}});
- xAxis.push({value:subStrDept(item["DEPT_NAME"]),number:jsonParam.number,compId:item["COMP_ID"]});
-
- };
- if(flag){
- subDeptZeroChart("下属单位没有填报数据", subTitle.dept_name + "投入应急发电机(本地):"+subTitle.count_bd+"(辆) 投入应急发电机(跨区):"+subTitle.count_kq+"(辆)");
- return;
- };
- max=(parseInt(max/10)+1)*10;
- pageParam.opParams={
- title:"起始:"+data["SEND_TIME"]+" 截止:"+data["APPEAR_TIME"],//标题
- // subtext:"投入应急发电机(本地):"+total_bd+"(台) 投入应急发电机(跨区):"+total_kq+"(台)",
- subtext:"投入应急发电机(本地):"+subTitle.count_bd+"(台) 投入应急发电机(跨区):"+subTitle.count_kq+"(台)",
- saveName:$("#i_page_head_title").find("h2").html()+searchUtil.getNowFormatDateTime(new Date),
- unit:"台",//单位
- leArr:["本地","跨区"],//图例
- xAxis:xAxis,//x轴
- sArr:sArr,//主数据
- legendColor:legendC, //图例字体颜色
- xAxisColor:xAxisC, //X轴字体颜色
- yAxisColor:yAxisC, //Y轴字体颜色
- min:0,
- max:max,
- isVertical:true,
- fold:1
- };
- chart=getEchart($("#i_page_chart"),getOption,pageParam.opParams,null);
-
- // bindEvent();
- },"json");
- }
- $(window).resize(function(){
- chart.resize();
- });
- function setTitle(){
- $("#i_page_head_title").find("h2").remove();
- if(pageParam.title=="广东电网有限责任公司"){
- pageParam.title="广东电网公司";
- }
- $("#i_page_head_title").append("<h2>"+pageParam.title+"应急发电机统计</h2>");
- };
- function bindEvent(){
- chart.on("click",function(params){
- var pathStr=url["http_path"]+"page/cockpit/echart_maticView/emergercy_source/alert_pie_chart.html?"+encodeURI($.param(params.data.data));
- utils.openIframe(pathStr);
- });
- $(window).resize(function(){
- chart.resize();
- });
- };
- /*dwr推送方法 */
- function dwrData(number){
- if(number== pageParam.number){
- loadChart(pageParam);
- }
- }
- function subStrDept(str){
- str=str.replace("供电局","");
- str=str.replace("供电所","");
- return str;
- }
|