0c8759174d76d886d1df24672404a7c47f79b669.svn-base 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  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_line_equiqment_trend.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" selWidth="280" asyncMode="true" multiMode="true"></div>
  35. <h2>电压等级:</h2>
  36. <div class="selectTree" id="levelTree" selWidth="280" multiMode="true" keepDefaultStyle="true"></div>
  37. <h2>状态:</h2>
  38. <ul>
  39. <li><input type="checkbox" name="state" value="PLON_DAOTA" value1="PLON_BIANXING" data="已恢复" checked="checked" >已恢复<br/></li>
  40. <li><input type="checkbox" name="state" value="UNRECOVER" value1="" data="未恢复" >未恢复<br/></li>
  41. </ul>
  42. <h2>开始时间(YYYY-MM-DD hh:mm:ss):</h2>
  43. <input id="startTime" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
  44. <h2>结束时间(YYYY-MM-DD hh:mm:ss):</h2>
  45. <input id="dataTime" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
  46. <h2>间隔时间:</h2>
  47. <select id="selectList" value=""></select><br/>
  48. <h2>X轴数据(个):</h2>
  49. <input id="n" type="text">
  50. <h2 class="_center"><span class="_query_command">查询</span><span class="_rend_command">刷新</span></h2>
  51. </div>
  52. <script type="text/javascript">
  53. /******************************************************查询条件***********************************************************/
  54. var urlParams=resolveUrl();
  55. var rendState=renderState;//状态:1:刷新,0:查看历史
  56. HTitle["fixed"]=urlParams["dept_name"];
  57. HTitle["change"]=urlParams["dept_name"];
  58. var text=HTitle[tState]+equipmentTitleTrend;
  59. var childId="'"+urlParams["dept_id"]+"'";
  60. var comId=urlParams["parentId"];
  61. var startTime=defaultStartTime;
  62. var dateTime=getNowDateTime();
  63. var interval=intervalTime;
  64. var list=intervalList
  65. var n=xn;
  66. var chart;
  67. var categorie=[urlParams["dept_name"]];
  68. var categories= [];
  69. var level=[{name:"500kV",column:500},{name:"200kV",column:200} ,{name:"110kV",column:110}];
  70. var state=[{name:"已恢复",column1:"PLON_DAOTA",column2:"PLON_BIANXING"}/* ,{name:"未恢复",column1:"UNRECOVER"} */]
  71. var series= [];
  72. var deptUrl=deptTreePath;
  73. var zNodes2 ={"treeNodes":equipmentLevel};
  74. function init(){
  75. loadSelect($("#selectList"),list);
  76. // 添加额外属性主要用于最初的初始节点
  77. $("#compTree").attr('params', '{"deptId":"'+urlParams["dept_id"]+'"}');
  78. // 异步加载请求地址
  79. $("#compTree").attr('url', deptUrl);
  80. $.post(deptUrl, {"id" : urlParams["dept_id"]}, function(data) {$("#compTree").data("data", data);$("#compTree").render();}, "json");
  81. $("#levelTree").data("data",zNodes2);
  82. $("#levelTree").render();
  83. $("._rend_command").on("click",rend);
  84. $("._query_command").on("click",query);
  85. }
  86. //获取间隔时间
  87. function getInterval(){
  88. if($("#selectList").data("selectedNode")==""||$("#selectList").data("selectedNode")==undefined)return;
  89. interval=$("#selectList").data("selectedNode").value;
  90. }
  91. //x轴数据个数
  92. function getN(){
  93. n=$("#n").val()==""?n:$("#n").val();
  94. }
  95. //获取电压级别
  96. function getLevel(){
  97. if($("#levelTree").data("selectedNodes")<1)return false;
  98. level=[];
  99. $.each($("#levelTree").data("selectedNodes"),function(index,item){
  100. level.push({name:item.name,column:item.column});
  101. })
  102. return true;
  103. }
  104. //获取部门
  105. function getDepartment(){
  106. if($("#compTree").data("selectedNodes")<1)return false;
  107. HTitle["change"]="";
  108. categorie=[];
  109. childId="";
  110. comId="";
  111. $.each($("#compTree").data("selectedNodes"),function(index,item){
  112. HTitle["change"]+=',"'+item.name+'"';
  113. categorie.push(item.name);
  114. childId+="'"+item.id+"',";
  115. comId=item.parentId;
  116. })
  117. childId=childId.substring(0,childId.lastIndexOf(","));
  118. HTitle["change"]= HTitle["change"].substring(1, HTitle["change"].length);
  119. text=HTitle[tState]+equipmentTitleTrend;
  120. return true;
  121. }
  122. //获取时间
  123. function getTime(){
  124. if(""!=$("#startTime").val())startTime=$("#startTime").val();
  125. dateTime=$("#dataTime").val()==""?getNowDateTime():$("#dataTime").val();
  126. }
  127. //打桩成功
  128. function getState(){
  129. //未选中复选款时退出
  130. if($("input[name=state]:checked").size()<1)return false;
  131. //选中复选框,更新恢复的状态
  132. state=[];
  133. $("input[name=state]:checked").each(function(){
  134. var temp={};
  135. temp.name=$(this).attr("data");
  136. temp.column1=$(this).attr("value");
  137. temp.column2=$(this).attr("value1");
  138. state.push(temp);
  139. });
  140. return true;
  141. }
  142. //获取所有的参数
  143. function getParam(){
  144. getState();//获取恢复状态
  145. getTime();//获取查询时间
  146. getDepartment();//获取查询部门
  147. getLevel();//获取电压
  148. getInterval();//获取间隔时间
  149. getN();
  150. categories=[];
  151. series=[]
  152. }
  153. //刷新
  154. function rend(){
  155. getParam();
  156. rendState=1;
  157. dateTime=getNowDateTime();
  158. //alert("comId="+comId+"===childId="+childId+"===dateTime="+dateTime+"===interval="+interval+"===n="+n+"===rendState="+rendState);
  159. loadChart(comId,childId,getNowDateTime(),interval,n);
  160. console.log(JSON.stringify({categories:categories}));
  161. console.log("categorie_________:"+JSON.stringify({categorie:categorie}));
  162. console.log("level_________:"+JSON.stringify({level:level}));
  163. console.log("childId_________:"+childId);
  164. }
  165. // 查询
  166. function query(){
  167. getTime();//获取查询时间
  168. $.post(path+"ws/ChartDaoServiceImpl/ChartDaoServiceImpl/getHistoryRecords",{startDate:startTime,endDate:dateTime,comId:comId,typeId:"3"},function(result){
  169. console.log(JSON.stringify(result));
  170. if(result.state=="FAILURE") throw new Error("查询失败");
  171. if(result.rows.length<1){
  172. alert("此区间段内尚无历史数据");
  173. return ;
  174. }
  175. var dateStr=getDateStr(result.rows);
  176. loadHistory(dateStr);
  177. /* $.post(path+"ws/ChartDaoServiceImpl/ChartDaoServiceImpl/getHistoryInfos",{dateStr:dateStr,childId:childId,comId:comId,typeId:"1"},function(result){
  178. rendState=0;
  179. alert("历史数据:=="+JSON.stringify(result));
  180. loadData(result);
  181. },"json"); */
  182. },"json");
  183. console.log(JSON.stringify({categories:categories}));
  184. console.log("categorie_________:"+JSON.stringify({categorie:categorie}));
  185. console.log("level_________:"+JSON.stringify({level:level}));
  186. console.log("childId_________:"+childId);
  187. }
  188. function getDateStr(dateArr){
  189. var dateArray=[];
  190. for(var item=0 ;item<dateArr.length; item++){
  191. dateArray.push(dateArr[item]["APPEAR_TIME"])
  192. }
  193. return dateArray.join(",");
  194. }
  195. function getInitParams(){
  196. if(loadState["equipmentStrend"]==0){
  197. loadChart(parentId,childId,dateTime);
  198. }else{
  199. $.post(path+"ws/ChartDaoServiceImpl/ChartDaoServiceImpl/getParentsInfo",{comId:urlParams["dept_id"],count:loadState["equipmentStrend"]},function(result){
  200. categorie=[];
  201. childId="'"+result.rows.childId.join("','")+"'";
  202. categorie=result.rows.childName;
  203. HTitle["change"]='"'+categorie.join('","')+'"';
  204. text=HTitle[tState]+equipmentTitleTrend;
  205. comId=urlParams["dept_id"];
  206. //alert("comId="+comId+"===childId="+childId+"===dateTime="+dateTime+"===interval="+interval+"===n="+n+"===rendState="+rendState);
  207. loadChart(comId,childId,dateTime,interval,n);
  208. },"json");
  209. }
  210. }
  211. //初始化
  212. $(function(){
  213. init();
  214. getInitParams();
  215. })
  216. /*****************************************************************************************************************/
  217. //加载历史
  218. function loadHistory(dateStr){
  219. getParam();
  220. $.post(path+"ws/ChartDaoServiceImpl/ChartDaoServiceImpl/getHistoryInfos",{dateStr:dateStr,childId:childId,comId:comId,typeId:"3"},function(result){
  221. rendState=0;
  222. loadData(result);
  223. },"json");
  224. }
  225. function loadChart(compId,childId,date,timeInterval,n){
  226. $.post(path+"ws/ChartDaoServiceImpl/ChartDaoServiceImpl/getChartInfos",{comId:compId,childId:childId,typeId:"3",date:date,timeInterval:timeInterval,n:n},function(result){
  227. loadData(result);
  228. /* categories=result["xAxisCategories"].substring(result["xAxisCategories"].indexOf("[")+1,result["xAxisCategories"].indexOf("]")).split(",").reverse();
  229. console.log("result====="+JSON.stringify(result));
  230. console.log("resultthleng====="+result.length);
  231. console.log("serieslength====="+series.length);
  232. for(var item in categorie){
  233. for(var index in level){
  234. for(var i in state){
  235. var tem= {name:categorie[item]+level[index]["name"]+state[i].name+"线路" ,color: '#FF3300',type: 'line',data:new Array()};
  236. for(var data=0;data<n;data++){
  237. if(state[i].column1=="PLON_DAOTA"){
  238. console.log("==="+result.data[item*n+data][state[i].column1+"_"+level[index].column]);
  239. console.log(result.data[item*n+data][state[i].column2+"_"+level[index].column]);
  240. console.log("++=="+result.data[item*n+data]["UNRECOVER_"+level[index].column]);
  241. tem.data.push(parseInt(result.data[parseInt(item*result.data.length/n)+parseInt(item)][state[i].column1+"_"+level[index].column])
  242. -parseInt(result.data[parseInt(item*result.data.length/n)+parseInt(item)]["UNRECOVER_"+level[index].column])
  243. );
  244. }else{
  245. tem.data.push(parseInt(result.data[parseInt(item*result.data.length/n)+parseInt(item)][state[i].column1+"_"+level[index].column]));
  246. }
  247. }
  248. series.push(tem);
  249. }
  250. }
  251. }
  252. console.log("categories===="+JSON.stringify({categories:categories}))
  253. console.log("series===="+JSON.stringify({series:series}))
  254. var options={
  255. "title.text":"",
  256. "xAxis.categories":categories,
  257. "yAxis.title.text":"单位:条",
  258. "subtitle.text":"数据:人工填报<br/>时间:"+getNowDateTime(),
  259. series:series
  260. }
  261. $("#container").createChart(options,null); */
  262. },"json");
  263. $("#title").html(text) ;
  264. var chart = $('#container').highcharts();
  265. };
  266. /*****************************************************************************************************************************************************/
  267. function loadData(result){
  268. var colorIndex=0;
  269. categories=[];
  270. series=[];
  271. console.log("result====="+JSON.stringify(result));
  272. console.log("resultthleng====="+result.length);
  273. categories=result["xAxisCategories"].substring(result["xAxisCategories"].indexOf("[")+1,result["xAxisCategories"].indexOf("]")).split(",").reverse();
  274. for(var item in categorie){
  275. for(var index in level){
  276. for(var i in state){
  277. var tem=tem= {name:categorie[item]+level[index]["name"]+state[i].name+"线路" ,color: color[0][colorIndex],type: 'line',data:new Array()};//null;
  278. /* if(state[i].column1=="PLON_DAOTA"){
  279. tem= {name:categorie[item]+level[index]["name"]+state[i].name+"线路" ,color: color[0][colorIndex],type: 'line',data:new Array()};
  280. }else{
  281. tem= {name:categorie[item]+level[index]["name"]+state[i].name+"线路" ,color: color[0][colorIndex],type: 'line',data:new Array()};
  282. } */
  283. colorIndex++;
  284. for(var data=0;data<result.data.length/categorie.length;data++){
  285. if(state[i].column1=="PLON_DAOTA"){
  286. /* console.log("==="+result.data[item*n+data][state[i].column1+"_"+level[index].column]);
  287. console.log(result.data[item*n+data][state[i].column2+"_"+level[index].column]);
  288. console.log("++=="+result.data[item*n+data]["UNRECOVER_"+level[index].column]); */
  289. tem.data.push(changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)][state[i].column1+"_"+level[index].column])
  290. -changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)]["UNRECOVER_"+level[index].column])
  291. );
  292. }else{
  293. tem.data.push(changeQ(result.data[parseInt(data*categorie.length)+changeQ(item)][state[i].column1+"_"+level[index].column]));
  294. }
  295. }
  296. series.push(tem);
  297. }
  298. }
  299. }
  300. console.log("categories===="+JSON.stringify({categories:categories}))
  301. console.log("series===="+JSON.stringify({series:series}))
  302. var options={
  303. "title.text":"",
  304. "xAxis.categories":categories,
  305. "yAxis.title.text":"单位:条",
  306. "subtitle.text":"数据来源:人工填报<br/>时间:"+getNowDateTime(),
  307. series:series
  308. }
  309. $("#container").createChart(options,null);
  310. }
  311. </script>
  312. </body>
  313. </html>