76df999183317aa5480a8bfe5f25246992c4819e.svn-base 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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. function loadChart(jsonParam){
  24. /**
  25. * param :id;
  26. * 备注:由于不在系统框架内,获取不到登录人单位的ID,现在传入的单位ID写死。上线的时候请更改过来。
  27. * 用这个方法取当前登录人单位ID:
  28. * var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  29. *
  30. * **/
  31. $.post("/nwyj/ws/DrillCount/DrillCountService/getDrillInfo",{id : "11"},function(result){
  32. var sArr=[
  33. {
  34. type:"tree",
  35. stack:"zTotal",
  36. name:"演练计划数量",
  37. data:[],
  38. orient: 'horizontal', // vertical horizontal
  39. rootLocation: {x: 100,y: 420}, // 根节点位置 {x: 100, y: 'center'}
  40. nodePadding: 20,
  41. layerPadding: 500,
  42. hoverable: false,
  43. roam: true,
  44. symbolSize: 30,
  45. itemStyle: {
  46. normal: {
  47. color: '#4883b4',
  48. label: {
  49. show: true,
  50. position: 'right',
  51. formatter: "{a}",
  52. textStyle: {
  53. color: '#000',
  54. fontSize: 15
  55. }
  56. },
  57. lineStyle: {
  58. color: '#ccc',
  59. type: 'broken' // 'curve'|'broken'|'solid'|'dotted'|'dashed'
  60. }
  61. },
  62. emphasis: {
  63. color: '#4883b4',
  64. label: {
  65. show: false
  66. },
  67. borderWidth: 0
  68. }
  69. }
  70. }
  71. ];
  72. var xAxis=[];
  73. //var data=result.rows[0];
  74. //初始化总数量,默认值为:0.
  75. var sumTotle=0;
  76. /**
  77. * 下面的循环:index<len-1
  78. * 因为后台返回的数据中最后有一行:总合计。
  79. * 不需要在柱形图里显示,所以用获取到的对象长度减一。
  80. *
  81. * ***/
  82. for(var index=0,len=result.rows.length;index<1;index++){
  83. var item=result.rows[index];
  84. var sum=utils.changeQ(item["zTotal"]);
  85. if(sum!=0){
  86. //deptId 为初始值的ID。
  87. var time = "2016-03-18";
  88. sArr[0].data.push(
  89. {
  90. "name": "广东电网公司演练计划",
  91. "children": [
  92. {
  93. "name": "完成情况",
  94. "name1": "plan_type=|102|",
  95. "children": [
  96. {
  97. "name": "已完成: "+ item["Done_num"]+ "(个)",
  98. "name1": "plan_type=|103|!and!BYSUNESS_TYPE=|105|",
  99. },
  100. {
  101. "name": "未完成: "+ item["Undo_num"]+ "(个)",
  102. "name1": "plan_type=|103|!and!BYSUNESS_TYPE=|106|",
  103. },
  104. ]
  105. },
  106. {
  107. "name": "演练形式",
  108. "name1": "plan_type=|103|",
  109. "children": [
  110. {
  111. "name": "现场演练: "+ item["locale"]+ "(个)",
  112. "name1": "plan_type=|103|!and!BYSUNESS_TYPE=|105|",
  113. },
  114. {
  115. "name": "桌面演练: "+ item["desktop"]+ "(个)",
  116. "name1": "plan_type=|103|!and!BYSUNESS_TYPE=|106|",
  117. },
  118. {
  119. "name": "现场双盲: "+ item["sm_locale"]+ "(个)",
  120. "name1": "plan_type=|103|!and!BYSUNESS_TYPE =|107|",
  121. },
  122. {
  123. "name": "桌面双盲: "+ item["sm_desktop"]+ "(个)",
  124. "name1": "plan_type=|103|!and!BYSUNESS_TYPE=|108|",
  125. }
  126. ]
  127. },
  128. {
  129. "name": "演练类别",
  130. "name1": "plan_type=|104|",
  131. "children": [
  132. {
  133. "name": "综合演练: "+ item["Drill_param"]+ "(个)",
  134. "name1": "plan_type=|104|!and!BYSUNESS_TYPE=|105|",
  135. },
  136. {
  137. "name": "专项演练: "+ item["Drill_test"]+ "(个)",
  138. "name1": "plan_type=|104|!and!BYSUNESS_TYPE=|106|",
  139. },
  140. ]
  141. },
  142. ]
  143. }
  144. );
  145. //每次循环取每一行数据中的合计数进行累加,形成修编总数。
  146. /*sumTotle = sumTotle + sum;
  147. xAxis.push(item["name"]);*/
  148. }
  149. }
  150. //将获取到的总数量转化为字符形式。
  151. //sumTotle = sumTotle + "";
  152. /**
  153. * 设置标题
  154. * 获取系统时间:(由于不在系统框架内,无法获取系统时间,上线时可用下面函数获取系统时间)
  155. * var currDate = getNowFormatDate(); YYYY-MM-DD HH:MM:SS
  156. *
  157. */
  158. pageParam.opParams={
  159. //title:"截止时间:"+data["APPEAR_TIME"],//标题
  160. title:"截止时间:"+"2016-03-07 11:23:00",//标题
  161. //subtext:"当前修编个数:" + sumTotle,
  162. unit:"个",//单位
  163. leArr:["演练计划数量"],//图例
  164. xAxis:xAxis,//x轴
  165. sArr:sArr//主数据
  166. };
  167. //setTitle(data,"(条)")
  168. chart=getEchart($("#i_page_chart"),getOption,pageParam.opParams,null);
  169. //var condition = "IS_DEL='0' and (PLAN_STAT='1' or PLAN_STAT1='1' or REMARK1='"+ getUser_id +"') and UNITS='"+parent_id+"'";
  170. bindEvent();
  171. },"json");
  172. //设置标题的名称
  173. $("#i_page_head_title").empty();
  174. $("#i_page_head_title").append("<h2>"+pageParam.title+"</h2>");
  175. }
  176. /**
  177. * 绑定事件
  178. */
  179. function bindEvent(){
  180. /***
  181. * 点击事件
  182. * URL:page/cockpit/echart_maticView/amResource/ContingencyPlanHuiZong.html(饼图)
  183. *
  184. * url是链接到饼图的链接。
  185. * 如有别的链接需求,需要另外配置。
  186. *
  187. * **/
  188. //页面跳转到预案的主页面,传入condition
  189. chart.on("click",function(params){
  190. var id =JSON.stringify(params.data.name1);
  191. id = id.substring(1,id.length-1);
  192. var pathStr=url["http_path"]+"page/cockpit/echart_maticView/amResource/ContingencyPlanXiubian.html?"+id;
  193. utils.openIframe(pathStr);
  194. });
  195. //自适应
  196. $(window).resize(function(){
  197. chart.resize();
  198. });
  199. }