curve.jsp 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
  2. <%@include file="/pages/includes/taglibs.jsp"%>
  3. <head>
  4. <script type="text/ecmascript" src="<%=request.getContextPath() %>/resource/plugin/jqgrid/js/jquery.jqGrid.min.js"></script>
  5. <script type="text/ecmascript" src="<%=request.getContextPath() %>/resource/plugin/jqgrid/js/i18n/grid.locale-cn.js"></script>
  6. <script type="text/ecmascript" src="<%=request.getContextPath()%>/resource/js/system/jqdatagrid.js"></script>
  7. <script src="<%=request.getContextPath()%>/resource/js/datePicker/WdatePicker.js" type="text/javascript"></script>
  8. <link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/resource/plugin/jqueryui/css/custom-theme/jquery-ui-1.9.2.custom.css" />
  9. <link rel="stylesheet" type="text/css" media="screen" href="<%=request.getContextPath() %>/resource/plugin/jqgrid/css/ui.jqgrid.css" />
  10. <script src="<%=request.getContextPath()%>/resource/js/highcharts/highcharts.src.js" type="text/javascript"></script>
  11. <script src="<%=request.getContextPath()%>/resource/js/highcharts/highcharts-more.js"> </script>
  12. <script src="<%=request.getContextPath()%>/resource/js/highcharts/modules/solid-gauge.src.js"></script>
  13. <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/resource/plugin/highslide/highslide.css" />
  14. <script type="text/javascript" src="<%=request.getContextPath()%>/resource/plugin/highslide/highslide-with-html.js"></script>
  15. <style type="text/css">
  16. a.url { /* 统一设置所以样式 */
  17. font-family:Arial;
  18. font-size:12px;
  19. text-align:center;
  20. margin:3px;
  21. }
  22. a:link.url ,a:visited.url{ /* 超链接正常状态、被访问过的样式 */
  23. color:#000000;
  24. padding:4px 10px 4px 10px;
  25. background-color:#f1f1f1;
  26. text-decoration:none;
  27. border-top:1px solid #EEEEEE; /* 边框实现阴影效果 */
  28. border-left:1px solid #EEEEEE;
  29. border-bottom:1px solid #717171;
  30. border-right:1px solid #717171;
  31. }
  32. a:hover.url{ /* 鼠标指针经过时的超链接 */
  33. color:#821818; /* 改变文字颜色 */
  34. padding:5px 8px 3px 12px; /* 改变文字位置 */
  35. background-color:#e2c4c9; /* 改变背景色 */
  36. border-top:1px solid #717171; /* 边框变换,实现“按下去”的效果 */
  37. border-left:1px solid #717171;
  38. border-bottom:1px solid #EEEEEE;
  39. border-right:1px solid #EEEEEE;
  40. }
  41. fieldset legend {
  42. color:#302A2A;
  43. font: bold 16px/2 Verdana, Geneva, sans-serif;
  44. font-weight: bold;
  45. text-align: left;
  46. text-shadow: 2px 2px 2px rgb(88, 126, 156);
  47. }
  48. </style>
  49. <script type="text/javascript">
  50. hs.graphicsDir = '<%=request.getContextPath()%>/resource/plugin/highslide/graphics/';
  51. hs.outlineType = 'rounded-white';
  52. hs.wrapperClassName = 'draggable-header';
  53. var windfarm = '<s:property value="windfarm"/>'
  54. var options;
  55. var chart;
  56. function thisPage() {
  57. $("#f1").attr("action", "curvedeviationindex.action").submit();
  58. }
  59. function queryClear() {
  60. $("#windfarm").val("");
  61. $("#beginDate").val("");
  62. }
  63. function queryData() {
  64. var windfarm = $("#windfarm").val();
  65. var beginDate = $("#beginDate").val();
  66. if ("" == windfarm) {
  67. alert("请选择风场!");
  68. } else if ("" == beginDate) {
  69. alert("请选择日期!");
  70. } else {
  71. /*var temp = "curvedeviationlist.action?windfarm=" + windfarm + "&beginDate="
  72. + beginDate;
  73. var url = encodeURI(encodeURI(temp));
  74. $("#gridTable").setGridParam({url:url}).trigger("reloadGrid"); */
  75. $("#gridTable").jqGrid('GridUnload');
  76. showJqGrid();
  77. }
  78. }
  79. function toExcel() {
  80. var windfarm = $("#windfarm").val();
  81. var beginDate = $("#beginDate").val();
  82. if ("" == windfarm) {
  83. alert("请选择风场!");
  84. } else if ("" == beginDate) {
  85. alert("请选择日期!");
  86. } else {
  87. var temp = "curveExcel.action?windfarm=" + windfarm + "&beginDate="
  88. + beginDate;
  89. var url = encodeURI(encodeURI(temp));
  90. $('#toexcel').attr('href',url);
  91. }
  92. }
  93. function detail(windturbineid, type) {
  94. chartAjax(windturbineid,type);
  95. }
  96. function showDiv1() {
  97. var hc = $("#container");
  98. // return hs.htmlExpand(obj, {
  99. return hs.htmlExpand(hc[0], {
  100. contentId : 'showDiv2',
  101. width : 1370,
  102. height : 500,
  103. align : 'center',
  104. headingText : '曲线偏差率排行'
  105. });
  106. }
  107. $(document).ready(function () {
  108. showJqGrid();
  109. options = {
  110. chart : {
  111. renderTo : 'container',
  112. type : 'spline'
  113. },
  114. title : {
  115. text : '日曲线偏差率排行'
  116. },
  117. xAxis : {
  118. categories : [],
  119. labels : {
  120. rotation : -45,
  121. align : 'right',
  122. style : {
  123. fontSize : '13px',
  124. fontFamily : 'Verdana, sans-serif'
  125. }
  126. }
  127. },
  128. yAxis : {
  129. title : {
  130. text : '功率(MW)'
  131. }
  132. },
  133. tooltip : {
  134. headerFormat : '<b>{series.name}</b><br/>',
  135. pointFormat : ' {point.y}MW'
  136. },
  137. plotOptions : {
  138. spline : {
  139. marker : {
  140. enable : false
  141. }
  142. }
  143. },
  144. series: [{
  145. name: '',
  146. data: []
  147. }, {
  148. name: '',
  149. data: []
  150. }]
  151. }
  152. });
  153. function showJqGrid() {
  154. var windfarm = $("#windfarm").val();
  155. var beginDate = $("#beginDate").val();
  156. var temp = "curvedeviationlist.action?windfarm=" + windfarm + "&beginDate="
  157. + beginDate;
  158. var url = encodeURI(encodeURI(temp));
  159. var id = 'gridTable';
  160. var datatype = 'json';
  161. var colNames = ['风机', '实际/保证(%)','实际/最优(%)','最优/保证(%)','环比','同比','比标杆风机'];
  162. var colModel = [
  163. { name: 'windturbineid', index: 'windturbineid', width: 200, align: 'center'},
  164. { name: 'deviationrate2', index: 'deviationrate2', width: 200, align: 'center'},
  165. { name: 'deviationrate1', index: 'deviationrate1', width: 200, align: 'center'},
  166. { name: 'deviationrate3', index: 'deviationrate3', width: 200, align: 'center'},
  167. { name: 'monthdeviationrate', index: 'monthdeviationrate', width: 200, align: 'center'},
  168. { name: 'yeardeviationrate', index: 'yeardeviationrate', width: 200, align: 'center'},
  169. { name: 'standarddeviationrate', index: 'standarddeviationrate', width: 200, align: 'center'}
  170. ];
  171. var caption = '日曲线偏差率排行榜';
  172. var sortname = 'deviationrate2';
  173. var gridPagerID ='gridPager';
  174. var sortorder='desc';
  175. var height='auto';
  176. var width='auto';
  177. var rownumbers=true;
  178. var multiselect=false;
  179. myJqGrid(id, url, datatype, colNames, colModel, caption, sortname, gridPagerID,sortorder,height,width,
  180. multiselect,rownumbers);
  181. }
  182. function chartAjax(windturbineid,type) {
  183. var beginDate = $("#beginDate").val();
  184. var url = "";
  185. if (type == 'tb') {
  186. url = "curvechatAjaxtb.action?windturbineid=" + windturbineid
  187. + "&beginDate=" + beginDate + "&type=" + type;
  188. } else if (type == 'hb') {
  189. url = "curvechatAjaxhb.action?windturbineid=" + windturbineid
  190. + "&beginDate=" + beginDate + "&type=" + type;
  191. } else if (type == 'bg') {
  192. url = "curvechatAjaxbg.action?windturbineid=" + windturbineid
  193. + "&beginDate=" + beginDate + "&type=" + type;
  194. } else {
  195. url = "curvechatAjax.action?windturbineid=" + windturbineid
  196. + "&beginDate=" + beginDate + "&type=" + type;
  197. }
  198. $.ajax( {
  199. url : url,
  200. type : "post",
  201. cache : false,
  202. dataType : "json",
  203. data : {},
  204. ifModified : false,
  205. success : function(result) {
  206. var sj = [];
  207. var zy = [];
  208. var fu = [];
  209. var name1=result["name1"];
  210. var name2=result["name2"];
  211. $.each(result["datas"], function(m, obj) {
  212. if (obj.value1 != null) {
  213. fu.push(parseFloat(obj.value1));
  214. }
  215. if (obj.value2 != null) {
  216. sj.push(parseFloat(obj.value2));
  217. }
  218. if (obj.value3 != null) {
  219. zy.push(parseFloat(obj.value3));
  220. }
  221. });
  222. options.series[0].data = sj;
  223. options.series[0].name = name1;
  224. options.series[1].data = zy;
  225. options.series[1].name = name2;
  226. options.xAxis.categories = fu;
  227. chart = new Highcharts.Chart(options);
  228. //alert(options.xAxis.categories);
  229. }
  230. });
  231. showDiv1();
  232. }
  233. </script>
  234. </head>
  235. <body>
  236. <form action="curveindex.action" method="post" id="f1">
  237. <br/>
  238. <fieldset style="height: 50px" id="fst">
  239. <legend class="item_Name">查询条件</legend>
  240. <table width="1000px" cellpadding="0" cellspacing="0" class="dataform">
  241. <tr>
  242. <th width="5%" class="item_Name">
  243. 风场:
  244. </th>
  245. <td width="20%">
  246. <s:select list="wps" listKey="id" cssStyle="width:150px"
  247. listValue="name" id="windfarm" name="windfarm" onchange="queryData()"></s:select>
  248. </td>
  249. <th width="5%" class="item_Name" align="left">
  250. 日期:
  251. </th>
  252. <td width="20%" style="text-align: left" align="left">
  253. <s:textfield cssClass="Wdate" cssStyle="width:150px"
  254. onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',isShowWeek:true,readOnly:true})"
  255. id="beginDate" name="beginDate" title="日期" onchange="queryData()"/>
  256. </td>
  257. <td width="200px" style="text-align: right">
  258. <a href="#" onclick="javascript:toExcel();" id="toexcel" class="url" >导出</a>
  259. </td>
  260. </tr>
  261. </table>
  262. </fieldset>
  263. <br/>
  264. <table id='gridTable' >
  265. </table>
  266. <div id='gridPager'></div>
  267. <div class="highslide-html-content" id="showDiv2" style="height: 800">
  268. <div class="highslide-header">
  269. <ul>
  270. <li class="highslide-move">
  271. <a href="#" onclick="return false">Move</a>
  272. </li>
  273. <li class="highslide-close">
  274. <a href="#" onclick="return hs.close(this)"></a>
  275. </li>
  276. </ul>
  277. </div>
  278. <div id="container"
  279. style="background-color: '#ffffff'; vertical-align: middle; width: 100%; height: 100%"></div>
  280. </div>
  281. </form>
  282. </body>