253c02200445197d88ec07f1c6af385780ce0616.svn-base 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  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. var deptId = "";
  10. $(function(){
  11. var dataTemp = (window.location.href).split('?')[1];
  12. deptId = dataTemp;
  13. var deptUrl = '/nwyj/ws/dept/DeptService/getDepartTree';
  14. $.post(deptUrl,{id:deptId,name:''},function(data){
  15. dataTemp = data;
  16. $("#WRITE_DEPT_365").data("data",data);
  17. $("#WRITE_DEPT_365").render();
  18. }, "json");
  19. pageParam.style=utils.resolveUrl()["style"]||"style3";
  20. pageParam.title=utils.resolveUrl()["title"]||"广东电网公司应急预案修编统计";//pageParam.title=utils.resolveUrl()["title"]||deptName + "预案修编统计";
  21. pageParam.number=utils.resolveUrl()["number"]||warnningnumber;
  22. init();
  23. });
  24. /**
  25. *初始化方法
  26. */
  27. function init(){
  28. loadChart(pageParam);
  29. // getTreeValue();
  30. }
  31. //重新打开一个窗口展示下级单位的预案修编数据
  32. function getNewCompId(){
  33. var type = $('#WRITE_DEPT_365').attr("relvalue");
  34. //var pathStr=url["http_path"]+"page/cockpit/echart_maticView/amResource/ContingencyPlanHuiZongZtNew1.html?"+type;
  35. window.open("/nwyj/page/cockpit/echart_maticView/amResource/ContingencyPlanHuiZongZtNew1.html?"+type);
  36. //utils.openIframe(pathStr);
  37. }
  38. function loadChart(jsonParam){
  39. /**
  40. * param :id;
  41. * 备注:由于不在系统框架内,获取不到登录人单位的ID,现在传入的单位ID写死。上线的时候请更改过来。
  42. * 用这个方法取当前登录人单位ID:
  43. * var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  44. *
  45. * **/
  46. $.post("/nwyj/ws/PlanHuiZong/ContingencyPlanHuiZong/getPlanInfo2",{id : deptId},function(result){
  47. var sArr=[
  48. {
  49. type:"tree",
  50. stack:"zTotal",
  51. name:"预案修编数量",
  52. data:[],
  53. orient: 'horizontal', // vertical horizontal
  54. rootLocation: {x: 100,y: 420}, // 根节点位置 {x: 100, y: 'center'}
  55. nodePadding: 20,
  56. layerPadding: 500,
  57. hoverable: false,
  58. roam: true,
  59. symbolSize: 30,
  60. itemStyle: {
  61. normal: {
  62. color: '#4883b4',
  63. label: {
  64. show: true,
  65. position: 'right',
  66. formatter: "{a}",
  67. textStyle: {
  68. color: '#000',
  69. fontSize: 15
  70. }
  71. },
  72. lineStyle: {
  73. color: '#ccc',
  74. type: 'broken' // 'curve'|'broken'|'solid'|'dotted'|'dashed'
  75. }
  76. },
  77. emphasis: {
  78. color: '#4883b4',
  79. label: {
  80. show: false
  81. },
  82. borderWidth: 0
  83. }
  84. }
  85. }
  86. ];
  87. var xAxis=[];
  88. //var data=result.rows[0];
  89. //初始化总数量,默认值为:0.
  90. var sumTotle=0;
  91. /**
  92. * 下面的循环:index<len-1
  93. * 因为后台返回的数据中最后有一行:总合计。
  94. * 不需要在柱形图里显示,所以用获取到的对象长度减一。
  95. *
  96. * ***/
  97. for(var index=0,len=result.rows.length;index<1;index++){
  98. var item=result.rows[index];
  99. var sum=utils.changeQ(item["zTotal"]);
  100. if(sum!=0){
  101. //deptId 为初始值的ID。
  102. var time = "2016-03-18";
  103. sArr[0].data.push(
  104. {
  105. "name": "广东电网公司预案统计",
  106. "children": [
  107. {
  108. "name": "总体预案: " + item["ztPlan"] + "(个)",
  109. "name1": "plan_type=|102|",
  110. },
  111. {
  112. "name": "专项预案: " + item["zxPlan"]+ "(个)",
  113. "name1": "plan_type=|103|",
  114. "children": [
  115. {
  116. "name": "自然灾害: "+ item["zrzh"]+ "(个)",
  117. "name1": "plan_type=|103|!and!BYSUNESS_TYPE=|105|",
  118. },
  119. {
  120. "name": "事故灾难: "+ item["sgzh"]+ "(个)",
  121. "name1": "plan_type=|103|!and!BYSUNESS_TYPE=|106|",
  122. },
  123. {
  124. "name": "公共卫生事件: "+ item["ggws"]+ "(个)",
  125. "name1": "plan_type=|103|!and!BYSUNESS_TYPE =|107|",
  126. },
  127. {
  128. "name": "社会安全事件: "+ item["shaq"]+ "(个)",
  129. "name1": "plan_type=|103|!and!BYSUNESS_TYPE=|108|",
  130. }
  131. ]
  132. },
  133. {
  134. "name": "现场处置方案: "+ item["xcczPlan"]+ "(个)",
  135. "name1": "plan_type=|104|",
  136. "children": [
  137. {
  138. "name": "自然灾害: "+ item["zrzhxc"]+ "(个)",
  139. "name1": "plan_type=|104|!and!BYSUNESS_TYPE=|105|",
  140. },
  141. {
  142. "name": "事故灾难: "+ item["sgzhxc"]+ "(个)",
  143. "name1": "plan_type=|104|!and!BYSUNESS_TYPE=|106|",
  144. },
  145. {
  146. "name": "公共卫生事件: "+ item["ggwsxc"]+ "(个)",
  147. "name1": "plan_type=|104|!and!BYSUNESS_TYPE=|107|",
  148. },
  149. {
  150. "name": "社会安全事件: "+ item["shaqxc"]+ "(个)",
  151. "name1": "plan_type=|104|!and!BYSUNESS_TYPE=|108|",
  152. }
  153. ]
  154. },
  155. {
  156. "name": "部门预案: "+ item["bmhj"]+ "(个)",
  157. "name1": "plan_type=|105|",
  158. "children": [
  159. {
  160. "name": "安全监管部: "+ item["aqjcb"]+ "(个)",
  161. "name1": "plan_type=|105|!and!INS_UNITS=|112|",
  162. },
  163. {
  164. "name": "系统运行部: "+ item["xtyxb"]+ "(个)",
  165. "name1": "plan_type=|105|!and!INS_UNITS=|113|",
  166. },
  167. {
  168. "name": "国际部: "+ item["gjb"]+ "(个)",
  169. "name1": "plan_type=|105|!and!INS_UNITS=|114|",
  170. },
  171. {
  172. "name": "设备管理部: "+ item["scsbglb"]+ "(个)",
  173. "name1": "plan_type=|105|!and!INS_UNITS=|115|",
  174. },{
  175. "name": "市场营销部: "+ item["scsbglb"]+ "(个)",
  176. "name1": "plan_type=|105|!and!INS_UNITS=|117|",
  177. },{
  178. "name": "信息部: "+ item["xxb"]+ "(个)",
  179. "name1": "plan_type=|105|!and!INS_UNITS=|116|",
  180. }
  181. ]
  182. },
  183. {
  184. "name": "政府预案: "+ item["zhengfu"]+ "(个)",
  185. "name1": "plan_type=|106|",
  186. }
  187. ]
  188. }
  189. );
  190. //每次循环取每一行数据中的合计数进行累加,形成修编总数。
  191. /*sumTotle = sumTotle + sum;
  192. xAxis.push(item["name"]);*/
  193. }
  194. }
  195. //将获取到的总数量转化为字符形式。
  196. //sumTotle = sumTotle + "";
  197. /**
  198. * 设置标题
  199. * 获取系统时间:(由于不在系统框架内,无法获取系统时间,上线时可用下面函数获取系统时间)
  200. * var currDate = getNowFormatDate(); YYYY-MM-DD HH:MM:SS
  201. *
  202. */
  203. pageParam.opParams={
  204. //title:"截止时间:"+data["APPEAR_TIME"],//标题
  205. title:"截止时间:"+"2016-03-07 11:23:00",//标题
  206. //subtext:"当前修编个数:" + sumTotle,
  207. unit:"个",//单位
  208. leArr:["预案修编数量"],//图例
  209. xAxis:xAxis,//x轴
  210. sArr:sArr//主数据
  211. };
  212. //setTitle(data,"(条)")
  213. chart=getEchart($("#i_page_chart"),getOption,pageParam.opParams,null);
  214. //var condition = "IS_DEL='0' and (PLAN_STAT='1' or PLAN_STAT1='1' or REMARK1='"+ getUser_id +"') and UNITS='"+parent_id+"'";
  215. bindEvent();
  216. },"json");
  217. //设置标题的名称
  218. $("#i_page_head_title").empty();
  219. $("#i_page_head_title").append("<h2>"+pageParam.title+"</h2>");
  220. }
  221. /**
  222. * 绑定事件
  223. */
  224. function bindEvent(){
  225. /***
  226. * 点击事件
  227. * URL:page/cockpit/echart_maticView/amResource/ContingencyPlanHuiZong.html(饼图)
  228. *
  229. * url是链接到饼图的链接。
  230. * 如有别的链接需求,需要另外配置。
  231. *
  232. * **/
  233. //页面跳转到预案的主页面,传入condition
  234. chart.on("click",function(params){
  235. var id =JSON.stringify(params.data.name1);
  236. id = id.substring(1,id.length-1);
  237. var pathStr=url["http_path"]+"page/cockpit/echart_maticView/amResource/ContingencyPlanXiubian.html?"+id;
  238. utils.openIframe(pathStr);
  239. });
  240. //自适应
  241. $(window).resize(function(){
  242. chart.resize();
  243. });
  244. }