compareAmount.jsp 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  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. changeFc(wf, wt);
  76. showJqGrid();
  77. options = {
  78. chart : {
  79. renderTo : 'container',
  80. width:1600,
  81. height:300,
  82. type : 'line'
  83. },
  84. title : {
  85. text : '功率曲线'
  86. },
  87. xAxis : {
  88. categories : [],
  89. labels : {
  90. rotation : -45,
  91. align : 'right',
  92. style : {
  93. fontSize : '13px',
  94. fontFamily : 'Verdana, sans-serif'
  95. }
  96. }
  97. },
  98. yAxis : {
  99. title : {
  100. text : '功率(kW)'
  101. }
  102. },
  103. tooltip : {
  104. headerFormat : '<b>{series.name}</b><br/>',
  105. pointFormat : ' {point.y}MW'
  106. },
  107. plotOptions : {
  108. spline : {
  109. marker : {
  110. enable : false
  111. }
  112. }
  113. },
  114. series : [ {
  115. name : '实际功率',
  116. data : []
  117. }, {
  118. name : '最优拟合功率',
  119. data : []
  120. }, {
  121. name : '保证功率',
  122. data : []
  123. } ]
  124. }
  125. chartAjax();
  126. })
  127. var temp = 0;
  128. function chartAjax() {
  129. var url;
  130. var windturbineid = $("#windturbineid").val();
  131. url = "../compareown/compareAmountchatAjax.action?windturbineid=" + windturbineid;
  132. $.ajax( {
  133. url : url,
  134. type : "get",
  135. cache : false,
  136. dataType : "json",
  137. data : {},
  138. ifModified : false,
  139. success : function(result) {
  140. var sj = [];
  141. var zy = [];
  142. var bz = [];
  143. var fu = [];
  144. if (null != result) {
  145. $.each(result, function(m, obj) {
  146. if (obj.value1 != null) {
  147. fu.push(parseFloat(obj.value1));
  148. }
  149. if (obj.value2 != null) {
  150. sj.push(parseFloat(obj.value2));
  151. }
  152. if (obj.value3 != null) {
  153. zy.push(parseFloat(obj.value3));
  154. }
  155. if (obj.value4 != null) {
  156. bz.push(parseFloat(obj.value4));
  157. }
  158. });
  159. }
  160. options.series[0].data = sj;
  161. options.series[1].data = zy;
  162. options.series[2].data = bz;
  163. options.xAxis.categories = fu;
  164. chart = new Highcharts.Chart(options);
  165. //alert(options.xAxis.categories);
  166. }
  167. });
  168. }
  169. function queryData() {
  170. var windturbineid = $("#windturbineid").val();
  171. var windfarm = $("#windfarm").val();
  172. if (windfarm == "") {
  173. alert("请选择风场!");
  174. return;
  175. }
  176. if (windturbineid == "") {
  177. alert("请选择风机!");
  178. return;
  179. }
  180. $("#gridTable").jqGrid('GridUnload');
  181. showJqGrid();
  182. chartAjax();
  183. }
  184. function editData(id) {
  185. $("#f1").attr("action", "updateindex.action?wtid=" + id).submit();
  186. }
  187. function toExcel() {
  188. var windturbineid = $("#windturbineid").val();
  189. var windfarm = $("#windfarm").val();
  190. if (windfarm == "") {
  191. alert("请选择风场!");
  192. return;
  193. }
  194. var temp = "compareExcel.action?windfarm=" + windfarm + "&windturbineid="
  195. + windturbineid ;
  196. var url = encodeURI(encodeURI(temp));
  197. $('#toexcel').attr('href', url);
  198. }
  199. function displaybuttons(cellvalue, options, rawObject) {
  200. var detail = "<input type='button' value='修改' onclick=editData('"
  201. + rawObject.id + "')>";
  202. return "&nbsp;&nbsp;&nbsp;\t" + detail;
  203. };
  204. function showJqGrid() {
  205. var windturbineid = $("#windturbineid").val();
  206. var windfarm = $("#windfarm").val();
  207. var id = 'gridTable';
  208. var url = '<%=request.getContextPath()%>/compareown/compareAmountlist.action?windfarm='
  209. + windfarm
  210. + "&windturbineid="
  211. + windturbineid;
  212. var datatype = 'json';
  213. var colNames = [ '编号', '风机','编码', '风速', '实际功率', '最优拟合功率' ];
  214. var colModel = [
  215. {
  216. name : 'id',
  217. index : 'id',
  218. width : 100,
  219. align : 'center',
  220. hidden : true
  221. }, {
  222. name : 'windturbineid',
  223. index : 'windturbineid',
  224. width : 200,
  225. align : 'center',
  226. hidden : true
  227. }, {
  228. name : 'code',
  229. index : 'code',
  230. width : 200,
  231. align : 'center'
  232. }, {
  233. name : 'speed',
  234. index : 'speed',
  235. width : 200,
  236. align : 'center'
  237. }, {
  238. name : 'actualpower',
  239. actualpower : 'modelid',
  240. width : 200,
  241. align : 'center'
  242. }, {
  243. name : 'optimalpower',
  244. index : 'optimalpower',
  245. width : 200,
  246. align : 'center'
  247. } ];
  248. var caption = '单机总功率信息列表';
  249. var sortname = 'speed';
  250. var gridPagerID = 'gridPager';
  251. var sortorder = 'asc';
  252. var height='300';
  253. var width='1600';
  254. var rownumbers = true;
  255. var multiselect = false;
  256. myJqGrid(id, url, datatype, colNames, colModel, caption, sortname,
  257. gridPagerID, sortorder, height, width, multiselect, rownumbers);
  258. }
  259. </script>
  260. <style type="text/css">
  261. .a { /* 统一设置所以样式 */
  262. font-family: Arial;
  263. font-size: 12px;
  264. text-align: center;
  265. margin: 3px;
  266. }
  267. .a:link,a:visited { /* 超链接正常状态、被访问过的样式 */
  268. color: #fff;
  269. padding: 4px 10px 4px 10px;
  270. background-color: #083772;
  271. text-decoration: none;
  272. border-top: 1px solid #EEEEEE; /* 边框实现阴影效果 */
  273. border-left: 1px solid #EEEEEE;
  274. border-bottom: 1px solid #717171;
  275. border-right: 1px solid #717171;
  276. }
  277. .a:hover { /* 鼠标指针经过时的超链接 */
  278. color: #fff; /* 改变文字颜色 */
  279. padding: 5px 8px 3px 12px; /* 改变文字位置 */
  280. background-color: #083772; /* 改变背景色 */
  281. border-top: 1px solid #717171; /* 边框变换,实现“按下去”的效果 */
  282. border-left: 1px solid #717171;
  283. border-bottom: 1px solid #EEEEEE;
  284. border-right: 1px solid #EEEEEE;
  285. }
  286. </style>
  287. </head>
  288. <body>
  289. <form action="" method="post" id="f1">
  290. <fieldset style="height: 50px" id="fst">
  291. <legend class="item_Name">
  292. 查询条件
  293. </legend>
  294. <table width="100%" cellpadding="0" cellspacing="0" class="dataform">
  295. <tr>
  296. <th width="5%" class="item_Name">
  297. 风电电场:
  298. </th>
  299. <td width="20%">
  300. <s:if test="u.wpId == null">
  301. <s:select list="wps" cssStyle="width:90%" listKey="id"
  302. listValue="name" id="windfarm" name="windfarm" headerKey=""
  303. headerValue="请选择" onchange="javascript:changeFc(this.value);"></s:select>
  304. </s:if>
  305. <s:else>
  306. <s:select list="wps" cssStyle="width:90%" listKey="id"
  307. listValue="name" id="windfarm" name="windfarm" headerKey=""
  308. headerValue="请选择" onchange="javascript:changeFc(this.value);"></s:select>
  309. </s:else>
  310. </td>
  311. <th width="5%" class="item_Name">
  312. 风机:
  313. </th>
  314. <td width="20%">
  315. <select name="windturbineid" id="windturbineid" style="width: 90%"
  316. onchange="javascript:queryData();">
  317. <option value="">
  318. 请选择
  319. </option>
  320. </select>
  321. </td>
  322. </tr>
  323. </table>
  324. </fieldset>
  325. <table id='gridTable'>
  326. </table>
  327. <div id='gridPager'></div>
  328. <div id="container"
  329. style="background-color: '#ffffff'; vertical-align: middle; width: 100%; height: 100%"></div>
  330. </form>
  331. </body>