curve.jsp 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  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/jqdatagridpagenum.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',hidden : true},
  164. { name: 'code', index: 'code', width: 80, align: 'center'},
  165. { name: 'deviationrate2', index: 'deviationrate2', width: 200, align: 'center'},
  166. { name: 'deviationrate1', index: 'deviationrate1', width: 200, align: 'center'},
  167. { name: 'deviationrate3', index: 'deviationrate3', width: 200, align: 'center'},
  168. { name: 'monthdeviationrate', index: 'monthdeviationrate', width: 200, align: 'center'},
  169. { name: 'yeardeviationrate', index: 'yeardeviationrate', width: 200, align: 'center'},
  170. { name: 'standarddeviationrate', index: 'standarddeviationrate', width: 200, align: 'center'}
  171. ];
  172. var caption = '日曲线偏差率排行榜';
  173. var sortname = 'deviationrate2';
  174. var gridPagerID ='gridPager';
  175. var sortorder='desc';
  176. var height='auto';
  177. var width='auto';
  178. var rownumbers=true;
  179. var multiselect=false;
  180. myJqGrid(id, url, datatype, colNames, colModel, caption, sortname, gridPagerID,sortorder,height,width,
  181. multiselect,rownumbers);
  182. }
  183. function chartAjax(windturbineid,type) {
  184. var beginDate = $("#beginDate").val();
  185. var url = "";
  186. if (type == 'tb') {
  187. url = "curvechatAjaxtb.action?windturbineid=" + windturbineid
  188. + "&beginDate=" + beginDate + "&type=" + type;
  189. } else if (type == 'hb') {
  190. url = "curvechatAjaxhb.action?windturbineid=" + windturbineid
  191. + "&beginDate=" + beginDate + "&type=" + type;
  192. } else if (type == 'bg') {
  193. url = "curvechatAjaxbg.action?windturbineid=" + windturbineid
  194. + "&beginDate=" + beginDate + "&type=" + type;
  195. } else {
  196. url = "curvechatAjax.action?windturbineid=" + windturbineid
  197. + "&beginDate=" + beginDate + "&type=" + type;
  198. }
  199. $.ajax( {
  200. url : url,
  201. type : "post",
  202. cache : false,
  203. dataType : "json",
  204. data : {},
  205. ifModified : false,
  206. success : function(result) {
  207. var sj = [];
  208. var zy = [];
  209. var fu = [];
  210. var name1=result["name1"];
  211. var name2=result["name2"];
  212. $.each(result["datas"], function(m, obj) {
  213. if (obj.value1 != null) {
  214. fu.push(parseFloat(obj.value1));
  215. }
  216. if (obj.value2 != null) {
  217. sj.push(parseFloat(obj.value2));
  218. }
  219. if (obj.value3 != null) {
  220. zy.push(parseFloat(obj.value3));
  221. }
  222. });
  223. options.series[0].data = sj;
  224. options.series[0].name = name1;
  225. options.series[1].data = zy;
  226. options.series[1].name = name2;
  227. options.xAxis.categories = fu;
  228. chart = new Highcharts.Chart(options);
  229. //alert(options.xAxis.categories);
  230. }
  231. });
  232. showDiv1();
  233. }
  234. </script>
  235. </head>
  236. <body>
  237. <form action="curveindex.action" method="post" id="f1">
  238. <br/>
  239. <fieldset style="height: 50px" id="fst">
  240. <legend class="item_Name">查询条件</legend>
  241. <table width="1000px" cellpadding="0" cellspacing="0" class="dataform">
  242. <tr>
  243. <th width="5%" class="item_Name">
  244. 风场:
  245. </th>
  246. <td width="20%">
  247. <s:select list="wps" listKey="id" cssStyle="width:150px"
  248. listValue="name" id="windfarm" name="windfarm" onchange="queryData()"></s:select>
  249. </td>
  250. <th width="5%" class="item_Name" align="left">
  251. 日期:
  252. </th>
  253. <td width="20%" style="text-align: left" align="left">
  254. <s:textfield cssClass="Wdate" cssStyle="width:150px"
  255. onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',isShowWeek:true,readOnly:true})"
  256. id="beginDate" name="beginDate" title="日期" onchange="queryData()"/>
  257. </td>
  258. <td width="200px" style="text-align: right">
  259. <a href="#" onclick="javascript:toExcel();" id="toexcel" class="url" >导出</a>
  260. </td>
  261. </tr>
  262. </table>
  263. </fieldset>
  264. <br/>
  265. <table id='gridTable' >
  266. </table>
  267. <div id='gridPager'></div>
  268. <div class="highslide-html-content" id="showDiv2" style="height: 800">
  269. <div class="highslide-header">
  270. <ul>
  271. <li class="highslide-move">
  272. <a href="#" onclick="return false">Move</a>
  273. </li>
  274. <li class="highslide-close">
  275. <a href="#" onclick="return hs.close(this)"></a>
  276. </li>
  277. </ul>
  278. </div>
  279. <div id="container"
  280. style="background-color: '#ffffff'; vertical-align: middle; width: 100%; height: 100%"></div>
  281. </div>
  282. </form>
  283. </body>