395be555cb596a3610087b0db565b436d1e91115.svn-base 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>台区停电统计图</title>
  5. <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <script type="text/javascript" src="/nwyj/page/cockpit/context.js"></script>
  8. <!--框架必需start-->
  9. <script type="text/javascript" src="/nwyj/scripts/qui/libs/js/jquery.js"></script>
  10. <script type="text/javascript" src="/nwyj/scripts/qui/libs/js/language/cn.js"></script>
  11. <script type="text/javascript" src="/nwyj/scripts/qui/libs/js/main.js"></script>
  12. <script type="text/javascript" src="/nwyj/scripts/qui/libs/js/framework.js"></script>
  13. <link href="/nwyj/scripts/qui/libs/css/import_basic.css" rel="stylesheet" type="text/css"/>
  14. <link rel="stylesheet" type="text/css" id="skin" prePath="/nwyj/scripts/qui/" scrollerY="false"/>
  15. <link rel="stylesheet" type="text/css" id="customSkin"/>
  16. <!--框架必需end-->
  17. <!--树组件start-->
  18. <link rel="stylesheet" type="text/css" href="/nwyj/scripts/qui/libs/js/tree/ztree/ztree.css" />
  19. <script type="text/javascript" src="/nwyj/scripts/qui/libs/js/tree/ztree/ztree.js"></script>
  20. <script type="text/javascript" src="/nwyj/scripts/qui/libs/js/form/selectTree.js"></script>
  21. <script type="text/javascript" src="/nwyj/scripts/qui/libs/js/form/listerTree.js"></script>
  22. <!--树组件end-->
  23. <script type="text/javascript" src="/nwyj/scripts/highcharts/highcharts.js"></script>
  24. <script type="text/javascript" src="/nwyj/page/cockpit/chart_pie.js"></script>
  25. <link rel="stylesheet" type="text/css" href="/nwyj/page/cockpit/chartPage.css">
  26. <script type="text/javascript" src="/nwyj/page/cockpit/laydate/laydate.js"></script>
  27. <script type="text/javascript" src="/nwyj/page/cockpit/webgis/util.js"></script>
  28. </head>
  29. <body>
  30. <div id="title" style="background-color:#144E52; width:100%; height:35px; line-height:35px; color:#ffc000; text-align:center; font-weight:bold; font-size:26px; "></div>
  31. <div id="container"></div>
  32. <div id="choose_content">
  33. <h2>单位:</h2>
  34. <div id="compTree" class="selectTree _left_margin" selWidth="280" asyncMode="true" multiMode="true"></div></br>
  35. <h2>数据源:</h2>
  36. <div id="from">
  37. <input type="radio" class="_left_margin" name="from" value="sys" >系统数据源
  38. <input type="radio" class="_left_margin" name="from" value="peo" checked="checked">人工数据源
  39. </div>
  40. <h2 >间隔时间(/s(秒)):</h2>
  41. <input id="interval" class="_left_margin" type="text" val="5">
  42. <div class="_startTime _hide">
  43. <h2>起始时间(YYYY-MM-DD HH:mm:ss):</h2>
  44. <input id="startTime" class="_left_margin" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
  45. </div>
  46. <div class="_endTime">
  47. <h2>时间(YYYY-MM-DD HH:mm:ss):</h2>
  48. <input id="dataTime" class="_left_margin" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
  49. </div>
  50. <h2 class="_center"><span class="_query_command">查询</span><span class="_rend_command">刷新</span></h2>
  51. </div>
  52. <script type="text/javascript">
  53. /******************************************************查询条件***********************************************************/
  54. // dept_id//user_id//user_name//dept_name
  55. var interval=null;//定时器
  56. var dataFrom="peo";//数据源的状态
  57. var n=5;//初始化默认刷新时间
  58. var list=intervalList
  59. var urlParams=resolveUrl();
  60. HTitle["fixed"]=urlParams["dept_name"];
  61. HTitle["change"]=urlParams["dept_name"];
  62. var text=HTitle[tState]+taiQuTitleChart;
  63. var childId="'"+urlParams["dept_id"]+"'";
  64. var bindChildId=childId.split(",");
  65. var parentId=urlParams["parentId"];
  66. var dateTime=getNowDateTime();
  67. var chart;
  68. var categorie=[urlParams["dept_name"]];
  69. var categories= [];
  70. var state=[ {name:"已恢复",column:"TD_COUNT" } ,
  71. {name:"未恢复",column:"UNRECOVERED"}];
  72. var series= [
  73. {name: '电量损失',color: '#FF3300', size: '60%',type: 'pie',data:[],
  74. dataLabels: {formatter: function () { return this.y > 5 ? this.point.name : null; },color: 'white',distance: -20}
  75. },
  76. {name: '电量损失',color: '#FF3300', size: '100%', innerSize: '60%',type: 'pie',data:[] },
  77. ];
  78. var deptUrl=path+"ws/orgInDeptService/OrgInDeptService/getDeptRootById";
  79. function init(){
  80. loadSelect($("#selectList"),list);
  81. // 添加额外属性主要用于最初的初始节点
  82. $("#compTree").attr('params', '{"deptId":"'+urlParams["dept_id"]+'"}');
  83. // 异步加载请求地址
  84. $("#compTree").attr('url', deptUrl);
  85. $.post(deptUrl, {"id" : urlParams["dept_id"]}, function(data) {$("#compTree").data("data", data);$("#compTree").render();}, "json");
  86. $("._query_command").on("click",query);
  87. $("._rend_command").on("click",function(){
  88. rendChart(dateTime);
  89. });
  90. $("._rend_command").on("click",function(){
  91. getInterval();
  92. removeRendChart();
  93. outoRendChart();
  94. getDepartment();
  95. rendChart(getNowDateTime());
  96. });
  97. $("#from").on("click",function(){
  98. changeDataSource();
  99. });
  100. }
  101. //切换数据源
  102. function changeDataSource(){
  103. dataFrom=$("#from input[name='from']:checked").val();
  104. if(dataFrom=="sys"){
  105. $("._startTime").removeClass("_hide");
  106. $("._endTime").find("h2").eq(0).text("截止时间(YYYY-MM-DD HH:mm:ss):");
  107. }else{
  108. $("._startTime").addClass("_hide");
  109. $("._endTime").find("h2").eq(0).text("时间(YYYY-MM-DD HH:mm:ss):");
  110. }
  111. }
  112. //更改查询条件
  113. function query(){
  114. removeRendChart();
  115. categories=[];
  116. series= [
  117. {name: '电量损失',color: '#FF3300', size: '60%',type: 'pie',data:[],
  118. dataLabels: {formatter: function () { return this.y > 5 ? this.point.name : null; },color: 'white',distance: -20}
  119. },
  120. {name: '电量损失',color: '#FF3300', size: '100%', innerSize: '60%',type: 'pie',data:[] },
  121. ];
  122. //获取部门
  123. getDepartment();
  124. //获取时间
  125. getTime();
  126. loadChart(parentId,childId,dateTime);
  127. console.log(JSON.stringify({categories:categories}));
  128. console.log("categorie_________:"+JSON.stringify({categorie:categorie}));
  129. //console.log("level_________:"+JSON.stringify({level:level}));
  130. console.log("childId_________:"+childId);
  131. }
  132. //获取间隔时间
  133. function getInterval(){
  134. //********************************************************************************************************====校验正整数
  135. if($("#selectList").data("selectedNode")==""||$("#selectList").data("selectedNode")==undefined)return;
  136. n=$("#selectList").data("selectedNode").value;
  137. }
  138. //获取时间
  139. function getTime(){
  140. //********************************************************************************************************====校验日期格式
  141. dateTime=$("#dataTime").val()==""?getNowDateTime():$("#dataTime").val();
  142. }
  143. //获取部门相关信息
  144. function getDepartment(){
  145. if($("#compTree").data("selectedNodes").length>0){
  146. HTitle["change"]="";
  147. categorie=[];
  148. childId="";
  149. bindChildId=[];
  150. $.each($("#compTree").data("selectedNodes"),function(index,item){
  151. HTitle["change"]+=',"'+item.name+'"';
  152. categorie.push(item.name)
  153. childId+="'"+item.id+"',"
  154. parentId=item.parentId;
  155. });
  156. childId=childId.substring(0,childId.lastIndexOf(","));
  157. bindChildId=childId.split(",");
  158. HTitle["change"]=HTitle["change"].substring(1,HTitle["change"].length);
  159. text=HTitle[tState]+taiQuTitleChart;
  160. }
  161. return false;
  162. }
  163. function getInitParams(){
  164. if(loadState["taiquChart"]==0){
  165. loadChart(parentId,childId,dateTime);
  166. }else{
  167. $.post(path+"ws/ChartDaoServiceImpl/ChartDaoServiceImpl/getParentsInfo",{comId:urlParams["dept_id"],count:loadState["taiquChart"]},function(result){
  168. // alert(JSON.stringify(result));
  169. categorie=[];
  170. childId="'"+result.rows.childId.join("','")+"'";
  171. bindChildId=childId.split(",");
  172. categorie=result.rows.childName;
  173. HTitle["change"]='"'+categorie.join('","')+'"';
  174. text=HTitle[tState]+taiQuTitleChart;
  175. parentId=urlParams["dept_id"];
  176. loadChart(parentId,childId,dateTime);
  177. outoRendChart();
  178. },"json");
  179. }
  180. }
  181. //初始化
  182. $(function(){
  183. init();
  184. getInitParams();
  185. /* loadChart(parentId,childId,dateTime);
  186. outoRendChart(); */
  187. })
  188. //接触自动刷新
  189. function removeRendChart(){
  190. clearInterval(interval)
  191. }
  192. //自动自动刷星表
  193. function outoRendChart(){
  194. interval=setInterval(function(){
  195. rendChart(dateTime);
  196. },n*1000);
  197. }
  198. //刷新表格
  199. function rendChart(datetime){
  200. categories=[];
  201. loadChart(parentId,childId,datetime);
  202. }
  203. /********************************************************************************************************************/
  204. [
  205. {name:'访问来源',type:'pie',selectedMode: 'single',radius : [30, 70],
  206. x: '20%', width: '40%',funnelAlign: 'right',max: 1548,
  207. itemStyle : {
  208. normal:{
  209. label : {position : 'inner'},
  210. labelLine : {show : false}
  211. }
  212. },
  213. data:[
  214. {value:335, name:'直达'},
  215. {value:679, name:'营销广告'},
  216. {value:1548, name:'搜索引擎'}
  217. ]
  218. },
  219. {
  220. name:'访问来源',type:'pie',radius : [100, 140],x: '60%',
  221. width: '35%',funnelAlign: 'left',max: 1048,
  222. data:[]
  223. }
  224. ]
  225. /*****************************************************************************************************************/
  226. function loadChart(compId,childId,date){
  227. series= [
  228. {name: '电量损失',color: '#FF3300', size: '60%',type: 'pie',data:[],
  229. dataLabels: {formatter: function () { return this.y > 5 ? this.point.name : null; },color: 'white',distance: -20}
  230. },
  231. {name: '电量损失',color: '#FF3300', size: '100%', innerSize: '60%',type: 'pie',data:[] },
  232. ];
  233. $.post(path+"ws/ChartDaoServiceImpl/ChartDaoServiceImpl/getChartInfo",{comId:compId,childId:childId,typeId:"5",date:date},function(result){
  234. //非结构性代码,模拟数据
  235. console.log(JSON.stringify(result));
  236. console.log("aa"+categories.length);
  237. for(var index=0,len=result.length;index<len;index++){
  238. series[0].data.push({data:{url:path+"page/cockpit/power_loss/taiwan_area_blackout_grid.html",comId:compId,childId:bindChildId[index/bindChildId.length],typeId:"5",date:date},
  239. name:categorie[index],
  240. color:color[0][index],
  241. y:changeQ(result[index]["TQ_TD_COUNT"])});
  242. series[1].data.push({data:{url:path+"page/cockpit/power_loss/taiwan_area_blackout_grid.html",
  243. comId:compId,
  244. childId:bindChildId[index],
  245. typeId:"5",
  246. date:date,
  247. deptName:categorie[index]},
  248. name:categorie[index]+"以恢复",
  249. color:restorColor[colorStyle],
  250. y:changeQ(result[index]["TQ_TD_COUNT"])-parseInt(result[index]["TQ_UNRECOVERED"])});
  251. series[1].data.push({data:{url:path+"page/cockpit/power_loss/taiwan_area_blackout_grid.html",
  252. comId:compId,
  253. childId:bindChildId[index],
  254. typeId:"5",
  255. date:date,
  256. deptName:categorie[index]},
  257. name:categorie[index]+"未恢复",
  258. color:recoveColor[colorStyle],
  259. y:changeQ(result[index]["TQ_UNRECOVERED"])
  260. });
  261. }
  262. console.log(JSON.stringify({bb:series}))
  263. console.log(JSON.stringify({AA:categories}))
  264. var options={
  265. "title.text":"",
  266. "xAxis.categories":categorie,
  267. "yAxis.title.text":"单位:条",
  268. "subtitle.text":"数据:人工填报<br/>时间:"+getNowDateTime(),
  269. series:series
  270. }
  271. $("#container").createChart(options,null);
  272. },"json");
  273. $("#title").html(text) ;
  274. };
  275. </script>
  276. </body>
  277. </html>