aac4441f36c06e39b671b3e8abe181b007659644.svn-base 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  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. <link rel="stylesheet" type="text/css" href="/nwyj/page/cockpit/chartPage.css">
  24. <script type="text/javascript" src="/nwyj/page/cockpit/echarts-2.2.7/build/dist/echarts-all.js"></script>
  25. <script type="text/javascript" src="/nwyj/page/cockpit/echarts-2.2.7/build/dist/chart/bar.js"></script>
  26. <script type="text/javascript" src=" /nwyj/page/cockpit/cockpit_echart.js"></script>
  27. <script type="text/javascript" src="/nwyj/page/cockpit/laydate/laydate.js"></script>
  28. <script type="text/javascript" src="/nwyj/page/cockpit/webgis/util.js"></script>
  29. <link rel="stylesheet" type="text/css" href="/nwyj/css/cockpit/charTitle.css">
  30. </head>
  31. <body>
  32. <div id="title" class="jsc_chartitle"></div>
  33. <div id="container"></div>
  34. <div id="choose_content">
  35. <h2>单位:</h2>
  36. <div id="compTree" class="selectTree _left_margin" selWidth="280" asyncMode="true" multiMode="true"></div></br>
  37. <h2>电压等级:</h2>
  38. <div class="selectTree _left_margin" id="levelTree" selWidth="280" multiMode="true" keepDefaultStyle="true"></div></br>
  39. <h2>数据源:</h2>
  40. <div id="from">
  41. <input type="radio" class="_left_margin" name="from" value="sys" >系统数据源
  42. <input type="radio" class="_left_margin" name="from" value="peo" checked="checked">人工数据源
  43. </div>
  44. <h2>间隔时间:</h2>
  45. <select id="selectList" value=""></select><br/>
  46. <div class="_startTime _hide">
  47. <h2>起始时间(YYYY-MM-DD HH:mm:ss):</h2>
  48. <input id="startTime" class="_left_margin" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
  49. </div>
  50. <div class="_endTime">
  51. <h2>时间(YYYY-MM-DD HH:mm:ss):</h2>
  52. <input id="dataTime" class="_left_margin" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
  53. </div>
  54. <h2 class="_center"><span class="_query_command">查询</span><span class="_rend_command">刷新</span></h2>
  55. </div>
  56. </div>
  57. <script type="text/javascript">
  58. /******************************************************查询条件***********************************************************/
  59. //图表用参数
  60. // dept_id//user_id//user_name//dept_name
  61. var customMadeTool=["search","render","list","enlarge","resource"];//父页面显示的工具栏
  62. var interval=null;//定时器
  63. var dataFrom="peo";//数据源的状态
  64. var n=intervalTime;//初始化默认刷新时间
  65. var list=intervalList//刷新时间list列表
  66. var urlParams=resolveUrl();//主页面传递参数
  67. HTitle["fixed"]=urlParams["dept_name"];//固定标题
  68. HTitle["change"]=urlParams["dept_name"];//可变标题
  69. var text=HTitle[tState]+stationTitleChart;//图表标题
  70. var childId="'"+urlParams["dept_id"]+"'";//该部门的ID
  71. var bindChildId=childId.split(",");//绑定点击事件查询id
  72. var parentId=urlParams["parentId"];//该部门父部门的ID
  73. var dateTime=getNowDateTime();//获取现在的时间
  74. var chart=null;//图表对象
  75. var categorie=[urlParams["dept_name"]];//部门名称
  76. var level=defaultSubstationLevel;
  77. var state=substationState;//系统默认显示的状态
  78. //查询条件配置参数
  79. var deptUrl=deptTreePath;
  80. var zNodes2 ={"treeNodes":substationLevel};
  81. function init(){
  82. loadSelect($("#selectList"),list);
  83. // 添加额外属性主要用于最初的初始节点
  84. $("#compTree").attr('params', '{"deptId":"'+urlParams["dept_id"]+'"}');
  85. // 异步加载请求地址
  86. $("#compTree").attr('url', deptUrl);
  87. $.post(deptUrl, {"id" : urlParams["dept_id"]}, function(data) {$("#compTree").data("data", data);$("#compTree").render();}, "json");
  88. //电压等级
  89. $("#levelTree").data("data",zNodes2);
  90. $("#levelTree").render();
  91. //查询
  92. $("._query_command").on("click",query);
  93. //刷新
  94. $("._rend_command").on("click",rend);
  95. $("#from").on("click",function(){
  96. changeDataSource();
  97. });
  98. }
  99. //切换数据源
  100. function changeDataSource(){
  101. dataFrom=$("#from input[name='from']:checked").val();
  102. if(dataFrom=="sys"){
  103. $("._startTime").removeClass("_hide");
  104. $("._endTime").find("h2").eq(0).text("截止时间:");
  105. }else{
  106. $("._startTime").addClass("_hide");
  107. $("._endTime").find("h2").eq(0).text("起始时间:");
  108. }
  109. }
  110. /**
  111. *时时数据刷新
  112. */
  113. function rend(){
  114. //移除定时器
  115. interval=removeRendChart(interval);
  116. //获取刷新间隔时间
  117. n=getInterval($("#selectList"),n);
  118. //获取部门Id
  119. getDepartment($("#compTree"),stationTitleChart);
  120. //获取电压等级信息
  121. level=getLevel($("#levelTree"),level);
  122. //检查查询条件参数
  123. //alert("parentId="+parentId+";childId="+childId+";n="+n+";")
  124. //alert(JSON.stringify({level:level}));
  125. //加载表格
  126. rendChart();
  127. interval=outoRendChart(interval,n,rendChart);
  128. }
  129. /**
  130. *查询历史
  131. */
  132. function query(){
  133. //移除定时器
  134. interval=removeRendChart(interval);
  135. //获取部门
  136. getDepartment($("#compTree"),stationTitleChart);
  137. //获取电压等级信息
  138. level=getLevel($("#levelTree"),level);
  139. //获取时间
  140. dateTime=getTimeChart($("#dataTime"));
  141. //加载
  142. //检查查询条件的参数
  143. //alert("parentId="+parentId+";childId="+childId+";dateTime="+dateTime+";")
  144. //alert(JSON.stringify({level:level}));
  145. loadChart(parentId,childId,dateTime,"2");
  146. }
  147. /**
  148. *初始化加载图表,
  149. *根据系统配置参数判断初始化加载本部门的数据还是直辖部门的数据
  150. *如果是直辖部门,根据配置初始化加载的部门数量选择加载该配置量的部门
  151. */
  152. function getInitParams(){
  153. //当oadState["lineChart"]==0时,加载本部门的数据
  154. //否则加载直辖loadState["lineChart"]数量的部门,
  155. //如果直辖部门大于loadState["lineChart"]数量,则显示该数量部门
  156. //否则显示实际部门数量
  157. if(loadState["stationChart"]==0){
  158. rendChart();
  159. }else{
  160. $.post(path+"ws/ChartDaoServiceImpl/ChartDaoServiceImpl/getParentsInfo",{comId:urlParams["dept_id"],count:loadState["stationChart"]},function(result){
  161. categorie=[];
  162. HTitle["change"]="";
  163. childId="'"+result.rows.childId.join("','")+"'";
  164. bindChildId=childId.split(",");
  165. categorie=result.rows.childName;
  166. HTitle["change"]='"'+categorie.join('","')+'"';
  167. text=HTitle[tState]+stationTitleChart;
  168. //alert("parentId="+parentId+";childId="+childId+";dateTime="+dateTime);
  169. parentId=urlParams["dept_id"];
  170. rendChart();
  171. interval=outoRendChart(interval,n,rendChart);
  172. },"json");
  173. }
  174. }
  175. //初始化
  176. $(function(){
  177. //初始化界面
  178. init();
  179. getInitParams();
  180. });
  181. function rendChart(){
  182. loadChart(parentId,childId,getNowDateTime(),"2");
  183. }
  184. /*****************************************************************************************************************/
  185. function loadChart(compId,childId,date,typeId){
  186. $.post(path+"ws/ChartDaoServiceImpl/ChartDaoServiceImpl/getChartInfo",{comId:compId,typeId:typeId,childId:childId,date:date},function(result){
  187. var leArr=[];//图例数组
  188. var xArr=[];//x轴数组
  189. var sArr=[];//主数据
  190. var opParams=null;
  191. /*
  192. *如果有数据,拼接数据
  193. *如果没有数据,则默认给一组空数据,echart自动进入没有数据画面,显示没有数据
  194. */
  195. if(result.length>0){
  196. //拼接数据
  197. opParams=loadData(leArr,xArr,sArr,result,date);
  198. }else{
  199. opParams={
  200. title:"",//标题
  201. unit:"单位:条",//单位
  202. leArr:leArr,//图例
  203. xArr:xArr,//x轴
  204. sArr:sArr//主数据
  205. };
  206. }
  207. //创建图表并加载图表数据
  208. chart=getEchart($("#container"),getOption,opParams,chart);
  209. //监听窗口大小变化
  210. $(window).resize(function(){
  211. chart.resize();
  212. })
  213. },"json");
  214. $("#title").html(text) ;
  215. }
  216. //拼接echart图表的数据
  217. function loadData(leArr,xArr,sArr,result,date){
  218. //遍历电压
  219. for(var index in level){
  220. //遍历状态
  221. for(var i in state){
  222. var temp={name:level[index]["name"]+state[i]["name"],
  223. type:'bar',
  224. data:[]
  225. };
  226. //压入图例
  227. leArr.push(temp.name);
  228. //遍历部门
  229. for(var item in categorie){
  230. //x轴坐标
  231. if(index==0&&i==0){
  232. //压入x轴坐标
  233. xArr.push(categorie[item]);
  234. }
  235. //判断堆叠
  236. if(0==item){
  237. temp.stack=categorie[item]+level[index]["column"];
  238. }
  239. //获取主数据
  240. if(state[i].column=="PRESSURE_LOSS"){
  241. temp.data.push({
  242. //图表数据
  243. value:changeQ(result[changeQ(item)][state[i].column+"_"+level[index].column])
  244. -changeQ(result[changeQ(item)]["NO_RECOVER_"+level[index].column])});
  245. }else{
  246. temp.data.push({
  247. //图表数据
  248. value:changeQ(result[changeQ(item)][state[i].column+"_"+level[index].column])});
  249. }
  250. }
  251. //压入主数据
  252. sArr.push(temp);
  253. }
  254. }
  255. return {
  256. title:"",//标题
  257. unit:"单位:条",//单位
  258. leArr:leArr,//图例
  259. xArr:xArr,//x轴
  260. sArr:sArr//主数据
  261. };
  262. }
  263. </script>
  264. </body>
  265. </html>