compareown.jsp 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. <%@ page language="java" contentType="text/html;charset=utf-8"%>
  2. <%@include file="/pages/includes/taglibs.jsp"%>
  3. <head>
  4. <script type="text/javascript"
  5. src="<%=request.getContextPath()%>/resource/js/jquery-1.8.3.js">
  6. </script>
  7. <script type="text/ecmascript"
  8. src="<%=request.getContextPath()%>/resource/plugin/jqgrid/js/jquery.jqGrid.min.js">
  9. </script>
  10. <script type="text/ecmascript"
  11. src="<%=request.getContextPath()%>/resource/plugin/jqgrid/js/i18n/grid.locale-cn.js">
  12. </script>
  13. <script type="text/ecmascript"
  14. src="<%=request.getContextPath()%>/resource/js/system/jqdatagridpage.js">
  15. </script>
  16. <script
  17. src="<%=request.getContextPath()%>/resource/js/datePicker/WdatePicker.js"
  18. type="text/javascript">
  19. </script>
  20. <link rel="stylesheet" type="text/css"
  21. href="<%=request.getContextPath()%>/resource/plugin/jqueryui/css/custom-theme/jquery-ui-1.9.2.custom.css" />
  22. <link rel="stylesheet" type="text/css" media="screen"
  23. href="<%=request.getContextPath()%>/resource/plugin/jqgrid/css/ui.jqgrid.css" />
  24. <link rel="stylesheet"
  25. href="<%=request.getContextPath()%>/resource/css/ztree/zTreeStyle.css"
  26. type="text/css">
  27. <script
  28. src="<%=request.getContextPath()%>/resource/js/ztree/jquery.ztree.all.min.js"
  29. type="text/javascript">
  30. </script>
  31. <script
  32. src="<%=request.getContextPath()%>/resource/js/highcharts/highcharts.src.js"
  33. type="text/javascript">
  34. </script>
  35. <script
  36. src="<%=request.getContextPath()%>/resource/js/highcharts/highcharts-more.js">
  37. </script>
  38. <script type="text/javascript">
  39. var inital=1;
  40. function changeFc(windfarm, windturbineid) {
  41. var url = "../warn/changeFc.action?fcId=" + windfarm;
  42. $.ajax( {
  43. type : "post",
  44. url : url,
  45. dataType : "json",
  46. success : function(data) {
  47. if (data.length != 0) {
  48. eval(data);
  49. $("#windturbineid").empty();
  50. for ( var i = 0; i < data.length; i++) {
  51. $("#windturbineid").append(
  52. "<option value='" + data[i].id + "'>" + data[i].code
  53. + "</option>");
  54. }
  55. $("#windturbineid").val(windturbineid);
  56. } else {
  57. $("#windturbineid").empty();
  58. }
  59. }
  60. });
  61. if(inital!=1)
  62. {
  63. setTimeout(queryData, 1000 );
  64. }else
  65. {
  66. inital++;
  67. }
  68. }
  69. var series;
  70. var options;
  71. var chart;
  72. $(function() {
  73. var wf = '<s:property value="windfarm"/>';
  74. var wt = '<s:property value="windturbineid"/>';
  75. var rd = '<s:property value="recorddate"/>';
  76. $("#recorddate").val(rd);
  77. changeFc(wf, wt);
  78. showJqGrid();
  79. options = {
  80. chart : {
  81. renderTo : 'container',
  82. width:1600,
  83. height:300,
  84. type : 'line'
  85. },
  86. title : {
  87. text : '功率曲线'
  88. },
  89. xAxis : {
  90. categories : [],
  91. labels : {
  92. rotation : -45,
  93. align : 'right',
  94. style : {
  95. fontSize : '13px',
  96. fontFamily : 'Verdana, sans-serif'
  97. }
  98. }
  99. },
  100. yAxis : {
  101. title : {
  102. text : '功率(kW)'
  103. }
  104. },
  105. tooltip : {
  106. headerFormat : '<b>{series.name}</b><br/>',
  107. pointFormat : ' {point.y}MW'
  108. },
  109. plotOptions : {
  110. spline : {
  111. marker : {
  112. enable : false
  113. }
  114. }
  115. },
  116. series : [ {
  117. name : '实际功率',
  118. data : []
  119. }, {
  120. name : '最优拟合功率',
  121. data : []
  122. }, {
  123. name : '保证功率',
  124. data : []
  125. } ]
  126. }
  127. chartAjax();
  128. })
  129. var temp = 0;
  130. function chartAjax() {
  131. var url;
  132. var recorddate = $("#recorddate").val();
  133. var windturbineid = $("#windturbineid").val();
  134. url = "../compareown/comparechatAjax.action?windturbineid=" + windturbineid
  135. + "&recorddate=" + recorddate;
  136. $.ajax( {
  137. url : url,
  138. type : "get",
  139. cache : false,
  140. dataType : "json",
  141. data : {},
  142. ifModified : false,
  143. success : function(result) {
  144. var sj = [];
  145. var zy = [];
  146. var bz = [];
  147. var fu = [];
  148. if (null != result) {
  149. $.each(result, function(m, obj) {
  150. if (obj.value1 != null) {
  151. fu.push(parseFloat(obj.value1));
  152. }
  153. if (obj.value2 != null) {
  154. sj.push(parseFloat(obj.value2));
  155. }
  156. if (obj.value3 != null) {
  157. zy.push(parseFloat(obj.value3));
  158. }
  159. if (obj.value4 != null) {
  160. bz.push(parseFloat(obj.value4));
  161. }
  162. });
  163. }
  164. options.series[0].data = sj;
  165. options.series[1].data = zy;
  166. options.series[2].data = bz;
  167. options.xAxis.categories = fu;
  168. chart = new Highcharts.Chart(options);
  169. //alert(options.xAxis.categories);
  170. }
  171. });
  172. }
  173. function queryData() {
  174. var recorddate = $("#recorddate").val();
  175. var windturbineid = $("#windturbineid").val();
  176. var windfarm = $("#windfarm").val();
  177. if (windfarm == "") {
  178. alert("请选择风场!");
  179. return;
  180. }
  181. if (windturbineid == "") {
  182. alert("请选择风机!");
  183. return;
  184. }
  185. if (recorddate == "") {
  186. alert("请选择日期!");
  187. return;
  188. }
  189. $("#gridTable").jqGrid('GridUnload');
  190. showJqGrid();
  191. chartAjax();
  192. }
  193. function editData(id) {
  194. $("#f1").attr("action", "updateindex.action?wtid=" + id).submit();
  195. }
  196. function toExcel() {
  197. var recorddate = $("#recorddate").val();
  198. var windturbineid = $("#windturbineid").val();
  199. var windfarm = $("#windfarm").val();
  200. if (windfarm == "") {
  201. alert("请选择风场!");
  202. return;
  203. }
  204. if (windturbineid == "") {
  205. alert("请选择风机!");
  206. return;
  207. }
  208. if (recorddate == "") {
  209. alert("请选择日期!");
  210. return;
  211. }
  212. var temp = "compareExcel.action?windfarm=" + windfarm + "&windturbineid="
  213. + windturbineid + "&recorddate=" + recorddate;
  214. var url = encodeURI(encodeURI(temp));
  215. $('#toexcel').attr('href', url);
  216. }
  217. function displaybuttons(cellvalue, options, rawObject) {
  218. var recorddate = $("#recorddate").val();
  219. var detail = "<input type='button' value='修改' onclick=editData('"
  220. + rawObject.id + "','" + recorddate + "')>";
  221. return "&nbsp;&nbsp;&nbsp;\t" + detail;
  222. };
  223. function showJqGrid() {
  224. var recorddate = $("#recorddate").val();
  225. var windturbineid = $("#windturbineid").val();
  226. var windfarm = $("#windfarm").val();
  227. var id = 'gridTable';
  228. var url = '<%=request.getContextPath()%>/compareown/comparelist.action?windfarm='
  229. + windfarm
  230. + "&recorddate="
  231. + recorddate
  232. + "&windturbineid="
  233. + windturbineid;
  234. var datatype = 'json';
  235. var colNames = [ '编号', '风机','编号', '风速', '实际功率', '最优拟合功率', '操作' ];
  236. var colModel = [
  237. {
  238. name : 'id',
  239. index : 'id',
  240. width : 100,
  241. align : 'center',
  242. hidden : true
  243. }, {
  244. name : 'windturbineid',
  245. index : 'windturbineid',
  246. width : 200,
  247. align : 'center',
  248. hidden : true
  249. }, {
  250. name : 'code',
  251. index : 'code',
  252. width : 200,
  253. align : 'center'
  254. }, {
  255. name : 'speed',
  256. index : 'speed',
  257. width : 200,
  258. align : 'center'
  259. }, {
  260. name : 'actualpower',
  261. actualpower : 'modelid',
  262. width : 200,
  263. align : 'center'
  264. }, {
  265. name : 'optimalpower',
  266. index : 'optimalpower',
  267. width : 200,
  268. align : 'center'
  269. }, {
  270. name : 'optimalpower',
  271. index : 'optimalpower',
  272. width : 200,
  273. align : 'center',
  274. formatter : displaybuttons
  275. } ];
  276. var caption = '单机日功率信息列表';
  277. var sortname = 'speed';
  278. var gridPagerID = 'gridPager';
  279. var sortorder = 'asc';
  280. var height='300';
  281. var width='1600';
  282. var rownumbers = true;
  283. var multiselect = false;
  284. myJqGrid(id, url, datatype, colNames, colModel, caption, sortname,
  285. gridPagerID, sortorder, height, width, multiselect, rownumbers);
  286. }
  287. </script>
  288. <style type="text/css">
  289. .a { /* 统一设置所以样式 */
  290. font-family: Arial;
  291. font-size: 12px;
  292. text-align: center;
  293. margin: 3px;
  294. }
  295. .a:link,a:visited { /* 超链接正常状态、被访问过的样式 */
  296. color: #fff;
  297. padding: 4px 10px 4px 10px;
  298. background-color: #083772;
  299. text-decoration: none;
  300. border-top: 1px solid #EEEEEE; /* 边框实现阴影效果 */
  301. border-left: 1px solid #EEEEEE;
  302. border-bottom: 1px solid #717171;
  303. border-right: 1px solid #717171;
  304. }
  305. .a:hover { /* 鼠标指针经过时的超链接 */
  306. color: #fff; /* 改变文字颜色 */
  307. padding: 5px 8px 3px 12px; /* 改变文字位置 */
  308. background-color: #083772; /* 改变背景色 */
  309. border-top: 1px solid #717171; /* 边框变换,实现“按下去”的效果 */
  310. border-left: 1px solid #717171;
  311. border-bottom: 1px solid #EEEEEE;
  312. border-right: 1px solid #EEEEEE;
  313. }
  314. </style>
  315. </head>
  316. <body>
  317. <form action="" method="post" id="f1">
  318. <fieldset style="height: 50px" id="fst">
  319. <legend class="item_Name">
  320. 查询条件
  321. </legend>
  322. <table width="100%" cellpadding="0" cellspacing="0" class="dataform">
  323. <tr>
  324. <th width="5%" class="item_Name">
  325. 风电电场:
  326. </th>
  327. <td width="20%">
  328. <s:if test="u.wpId == null">
  329. <s:select list="wps" cssStyle="width:90%" listKey="id"
  330. listValue="name" id="windfarm" name="windfarm" headerKey=""
  331. headerValue="请选择" onchange="javascript:changeFc(this.value);"></s:select>
  332. </s:if>
  333. <s:else>
  334. <s:select list="wps" cssStyle="width:90%" listKey="id"
  335. listValue="name" id="windfarm" name="windfarm" headerKey=""
  336. headerValue="请选择" onchange="javascript:changeFc(this.value);"></s:select>
  337. </s:else>
  338. </td>
  339. <th width="5%" class="item_Name">
  340. 风机:
  341. </th>
  342. <td width="20%">
  343. <select name="windturbineid" id="windturbineid" style="width: 90%"
  344. onchange="javascript:queryData();">
  345. <option value="">
  346. 请选择
  347. </option>
  348. </select>
  349. </td>
  350. <th width="5%" class="item_Name">
  351. 日期
  352. </th>
  353. <td width="20%" style="text-align: left">
  354. <s:textfield cssClass="Wdate"
  355. onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',isShowWeek:true,readOnly:true})"
  356. id="recorddate" name="recorddate" title="日期"
  357. onchange="javascript:queryData();" />
  358. </td>
  359. </tr>
  360. </table>
  361. </fieldset>
  362. <table id='gridTable'>
  363. </table>
  364. <div id='gridPager'></div>
  365. <div id="container"
  366. style="background-color: '#ffffff'; vertical-align: middle; width: 100%; height: 100%"></div>
  367. </form>
  368. </body>