ContingencyPlanHuiZongZtNew.js 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. var pageParam={};
  2. var chart=null;
  3. var utils=new Util();
  4. /***
  5. * 初始化方法里填写标题,当前单位名称:广东电网 暂时写死。
  6. * 可以通过下面方法获取到当前单位名称,上系统时请改成下面这种写法:
  7. * var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames();
  8. * **/
  9. $(function(){
  10. pageParam.style=utils.resolveUrl()["style"]||"style3";
  11. pageParam.title=utils.resolveUrl()["title"]||"广东电网公司应急预案统计";//pageParam.title=utils.resolveUrl()["title"]||deptName + "预案修编统计";
  12. pageParam.number=utils.resolveUrl()["number"]||warnningnumber;
  13. init();
  14. });
  15. /**
  16. *初始化方法
  17. */
  18. function init(){
  19. loadChart(pageParam);
  20. // getTreeValue();
  21. }
  22. var deptId = "11";
  23. //重新打开一个窗口展示下级单位的预案修编数据
  24. function getNewCompId(){
  25. var type = $('#WRITE_DEPT_365').attr("relvalue");
  26. //var pathStr=url["http_path"]+"page/cockpit/echart_maticView/amResource/ContingencyPlanHuiZongZtNew1.html?"+type;
  27. window.open("/nwyj/page/cockpit/echart_maticView/amResource/ContingencyPlanHuiZongZtNew1.html?"+type);
  28. //utils.openIframe(pathStr);
  29. }
  30. function loadChart(jsonParam){
  31. /**
  32. * param :id;
  33. * 备注:由于不在系统框架内,获取不到登录人单位的ID,现在传入的单位ID写死。上线的时候请更改过来。
  34. * 用这个方法取当前登录人单位ID:
  35. * var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  36. *
  37. * **/
  38. $.post("/nwyj/ws/PlanHuiZong/ContingencyPlanHuiZong/getPlanInfo",{id : deptId},function(result){
  39. //alert(JSON.stringify(result));
  40. var length = result.rows.length;
  41. var zongti = result.rows[length-1].ztPlan;
  42. var zhuanxiang = result.rows[length-1].zxPlan;
  43. var xianchang = result.rows[length-1].xcczPlan;
  44. var bumen = result.rows[length-1].bmhj;
  45. $('#shaq').html("111111");
  46. var sArr=[
  47. {
  48. type:"tree",
  49. stack:"zTotal",
  50. name:"预案数量",
  51. data:[],
  52. orient: 'horizontal', // vertical horizontal
  53. rootLocation: {x: 200,y: 150}, // 根节点位置 {x: 100, y: 'center'}
  54. nodePadding: 20,
  55. layerPadding: 500,
  56. hoverable: false,
  57. roam: true,
  58. symbolSize: 30,
  59. itemStyle: {
  60. normal: {
  61. color: '#4883b4',
  62. label: {
  63. show: true,
  64. position: 'right',
  65. formatter: "{a}",
  66. textStyle: {
  67. color: '#fff',
  68. fontSize: 25
  69. }
  70. },
  71. lineStyle: {
  72. color: '#ccc',
  73. type: 'broken' // 'curve'|'broken'|'solid'|'dotted'|'dashed'
  74. }
  75. },
  76. emphasis: {
  77. color: '#4883b4',
  78. label: {
  79. show: false
  80. },
  81. borderWidth: 0
  82. }
  83. }
  84. }
  85. ];
  86. var xAxis=[];
  87. //var data=result.rows[0];
  88. //初始化总数量,默认值为:0.
  89. var sumTotle=0;
  90. /**
  91. * 下面的循环:index<len-1
  92. * 因为后台返回的数据中最后有一行:总合计。
  93. * 不需要在柱形图里显示,所以用获取到的对象长度减一。
  94. *
  95. * ***/
  96. for(var index=0,len=result.rows.length;index<1;index++){
  97. var item=result.rows[index];
  98. var sum=utils.changeQ(item["zTotal"]);
  99. if(sum!=0){
  100. //deptId 为初始值的ID。
  101. var time = "2016-03-18";
  102. sArr[0].data.push(
  103. {
  104. "name": "广东省",
  105. "children": [
  106. {
  107. "name": "总体预案: " + item["ztPlan"] + "(个)",
  108. "name1": "plan_type=|102|",
  109. },
  110. {
  111. "name": "专项预案: " + item["zxPlan"]+ "(个)",
  112. "name1": "plan_type=|103|",
  113. },
  114. {
  115. "name": "现场处置方案: "+ item["xcczPlan"]+ "(个)",
  116. "name1": "plan_type=|104|",
  117. },
  118. {
  119. "name": "部门预案: "+ item["bmhj"]+ "(个)",
  120. "name1": "plan_type=|105|",
  121. }
  122. ]
  123. }
  124. );
  125. //每次循环取每一行数据中的合计数进行累加,形成修编总数。
  126. /*sumTotle = sumTotle + sum;
  127. xAxis.push(item["name"]);*/
  128. }
  129. }
  130. //将获取到的总数量转化为字符形式。
  131. //sumTotle = sumTotle + "";
  132. /**
  133. * 设置标题
  134. * 获取系统时间:(由于不在系统框架内,无法获取系统时间,上线时可用下面函数获取系统时间)
  135. * var currDate = getNowFormatDate(); YYYY-MM-DD HH:MM:SS
  136. *
  137. */
  138. pageParam.opParams={
  139. title:"\n\n\n\n广东电网+19个地市局共有:\n\n总体预案:"+zongti+"\n\n专项预案:" +zhuanxiang + "\n\n部门预案:" + bumen + "\n\n现场处置方案:"+xianchang,//标题
  140. //subtext:"当前修编个数:" + sumTotle,
  141. unit:"个",//单位
  142. leArr:["预案修编数量"],//图例
  143. xAxis:xAxis,//x轴
  144. sArr:sArr//主数据
  145. };
  146. //setTitle(data,"(条)")
  147. chart=getEchart($("#i_page_chart"),getOption,pageParam.opParams,null);
  148. //var condition = "IS_DEL='0' and (PLAN_STAT='1' or PLAN_STAT1='1' or REMARK1='"+ getUser_id +"') and UNITS='"+parent_id+"'";
  149. bindEvent();
  150. },"json");
  151. //设置标题的名称
  152. $("#i_page_head_title").empty();
  153. $("#i_page_head_title").append("<h2>"+pageParam.title+"</h2>");
  154. }
  155. /**
  156. * 绑定事件
  157. */
  158. function bindEvent(){
  159. /***
  160. * 点击事件
  161. * URL:page/cockpit/echart_maticView/amResource/ContingencyPlanHuiZong.html(饼图)
  162. *
  163. * url是链接到饼图的链接。
  164. * 如有别的链接需求,需要另外配置。
  165. *
  166. * **/
  167. //页面跳转到预案的主页面,传入condition
  168. chart.on("click",function(params){
  169. var id =JSON.stringify(params.data.name1);
  170. id = id.substring(1,id.length-1);
  171. var pathStr=url["http_path"]+"page/cockpit/echart_maticView/amResource/ContingencyPlanXiubian.html?"+id;
  172. utils.openIframe(pathStr);
  173. });
  174. //自适应
  175. $(window).resize(function(){
  176. chart.resize();
  177. });
  178. }