downLoadWtEdos.jsp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709
  1. <%@ page language="java" import="java.util.*" pageEncoding="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
  8. src="<%=request.getContextPath()%>/resource/plugin/jqueryui/js/jquery-ui-1.9.2.custom.js"
  9. type="text/javascript">
  10. </script>
  11. <script type="text/ecmascript"
  12. src="<%=request.getContextPath()%>/resource/plugin/jqgrid/js/jquery.jqGrid.min.js">
  13. </script>
  14. <script type="text/ecmascript"
  15. src="<%=request.getContextPath()%>/resource/plugin/jqgrid/js/i18n/grid.locale-cn.js">
  16. </script>
  17. <script type="text/ecmascript"
  18. src="<%=request.getContextPath()%>/resource/js/system/jqdatagridpage.js">
  19. </script>
  20. <script
  21. src="<%=request.getContextPath()%>/resource/js/datePicker/WdatePicker.js"
  22. type="text/javascript">
  23. </script>
  24. <link rel="stylesheet" type="text/css"
  25. href="<%=request.getContextPath()%>/resource/plugin/jqueryui/css/custom-theme/jquery-ui-1.9.2.custom.css" />
  26. <link rel="stylesheet" type="text/css" media="screen"
  27. href="<%=request.getContextPath()%>/resource/plugin/jqgrid/css/ui.jqgrid.css" />
  28. <link rel="stylesheet"
  29. href="<%=request.getContextPath()%>/resource/css/ztree/zTreeStyle.css"
  30. type="text/css" />
  31. <script
  32. src="<%=request.getContextPath()%>/resource/js/ztree/jquery.ztree.all.min.js"
  33. type="text/javascript">
  34. </script>
  35. <link rel="stylesheet"
  36. href="<%=request.getContextPath()%>/resource/js/showloading/showLoading.css"
  37. type="text/css" />
  38. <script
  39. src="<%=request.getContextPath()%>/resource/js/showloading/jquery.showLoading.js"
  40. type="text/javascript">
  41. </script>
  42. <script type="text/javascript">
  43. var queryType = "fc";
  44. var setting = {
  45. check : {
  46. enable : true,
  47. chkStyle : "radio"
  48. },
  49. view : {
  50. dblClickExpand : false
  51. },
  52. data : {
  53. simpleData : {
  54. enable : true
  55. }
  56. },
  57. callback : {
  58. beforeClick : beforeClickWindfarm,
  59. onCheck : selectWindfarm
  60. },
  61. async : {
  62. enable : true,
  63. url : "/power/windfarmAjax.action",
  64. dataType : "json"
  65. }
  66. };
  67. function beforeClickWindfarm(treeId, treeNode) {
  68. var zTree = $.fn.zTree.getZTreeObj(treeId);
  69. zTree.checkNode(treeNode, !treeNode.checked, null, true);
  70. return false;
  71. }
  72. function showWindfarm() {
  73. var cityObj = $("#windpowerstationid");
  74. var cityOffset = $("#windpowerstationid").offset();
  75. $("#menuWindfarm").css( {
  76. left : cityOffset.left + "px",
  77. top : cityOffset.top + cityObj.outerHeight() + "px"
  78. }).slideDown("fast");
  79. $("body").bind("mousedown", onBodyDown);
  80. }
  81. function showProject() {
  82. if (wpids == "") {
  83. alert("请选择风场!");
  84. return;
  85. }
  86. var setting3 = {
  87. check : {
  88. enable : true,
  89. chkStyle : "checkbox"
  90. },
  91. view : {
  92. dblClickExpand : false
  93. },
  94. data : {
  95. simpleData : {
  96. enable : true
  97. }
  98. },
  99. callback : {
  100. beforeClick : beforeClickWindfarm,
  101. onCheck : selectPj
  102. },
  103. async : {
  104. enable : true,
  105. url : "/power/projectAjax.action?wpIds=" + wpids,
  106. dataType : "json"
  107. }
  108. };
  109. $.fn.zTree.init($("#treePj"), setting3);
  110. var cityObj = $("#project");
  111. var cityOffset = $("#project").offset();
  112. $("#menuPj").css( {
  113. left : cityOffset.left + "px",
  114. top : cityOffset.top + cityObj.outerHeight() + "px"
  115. }).slideDown("fast");
  116. $("body").bind("mousedown", onBodyDown);
  117. pjIds = '';
  118. $("#project").val("");
  119. }
  120. function hideMenuWindfarm() {
  121. $("#menuWindfarm").fadeOut("fast");
  122. }
  123. var wpids = "";
  124. function selectWindfarm(e, treeId, treeNode) {
  125. var zTree = $.fn.zTree.getZTreeObj("treeWindfarm"), nodes = zTree
  126. .getCheckedNodes(true);
  127. v = "";
  128. d = "";
  129. for ( var i = 0, l = nodes.length; i < l; i++) {
  130. v += nodes[i].name + ",";
  131. d += nodes[i].id + ",";
  132. }
  133. if (v.length > 0)
  134. v = v.substring(0, v.length - 1);
  135. if (d.length > 0)
  136. d = d.substring(0, d.length - 1);
  137. wpids = d;
  138. var cityObj = $("#windpowerstationid");
  139. cityObj.attr("value", v);
  140. lineIds = '';
  141. pjIds = '';
  142. $("#project").val("");
  143. $("#line").val("");
  144. getdatalength();
  145. //$("#menuWindfarm").fadeOut("fast");
  146. }
  147. var pjIds;
  148. function selectPj(e, treeId, treeNode) {
  149. var zTree = $.fn.zTree.getZTreeObj("treePj"), nodes = zTree
  150. .getCheckedNodes(true);
  151. v = "";
  152. d = "";
  153. for ( var i = 0, l = nodes.length; i < l; i++) {
  154. v += nodes[i].name + ",";
  155. d += nodes[i].id + ",";
  156. }
  157. if (v.length > 0)
  158. v = v.substring(0, v.length - 1);
  159. if (d.length > 0)
  160. d = d.substring(0, d.length - 1);
  161. pjIds = d;
  162. var cityObj = $("#project");
  163. cityObj.attr("value", v);
  164. getdatalength();
  165. //$("#menuXl").fadeOut("fast");
  166. }
  167. function hideMenuPj() {
  168. $("#menuPj").fadeOut("fast");
  169. }
  170. function queryData() {
  171. if ("" == $("#beginDate").val()) {
  172. alert("请选择查询开始日期!");
  173. } else if ("" == $("#endDate").val()) {
  174. alert("请选择查询结束日期!");
  175. } else {
  176. var wpId = wpids;
  177. var pjId = pjIds;
  178. var beginDate = $("#beginDate").val();
  179. var endDate = $("#endDate").val();
  180. var url = '<%=request.getContextPath()%>/downloadinfo/downLoadWtlist.action?wpId='
  181. + wpId
  182. + "&pjId="
  183. + pjId
  184. + "&beginDate="
  185. + beginDate
  186. + "&endDate=" + endDate;
  187. $("#gridTable").setGridParam( {
  188. url : url
  189. }).trigger("reloadGrid");
  190. }
  191. $('#createzip').css('display', '');
  192. }
  193. function toExcel() {
  194. if ("" == $("#beginDate").val()) {
  195. alert("请选择查询开始日期!");
  196. } else if ("" == $("#endDate").val()) {
  197. alert("请选择查询结束日期!");
  198. } else {
  199. var wpId = wpids;
  200. var pjId = pjIds;
  201. var beginDate = $("#beginDate").val();
  202. var endDate = $("#endDate").val();
  203. var url = '<%=request.getContextPath()%>/downloadinfo/downLoadWtExcel.action?wpId='
  204. + wpId
  205. + "&pjId="
  206. + pjId
  207. + "&beginDate="
  208. + beginDate
  209. + "&endDate=" + endDate;
  210. $('#toexcel').attr('href', url);
  211. }
  212. }
  213. var dalength;
  214. var steps = 0;
  215. var resultvalue = 0;
  216. var resultview = 0;
  217. function getdatalength() {
  218. var wpId = wpids;
  219. var pjId = pjIds;
  220. var beginDate = $("#beginDate").val();
  221. var endDate = $("#endDate").val();
  222. var url = '<%=request.getContextPath()%>/downloadinfo/findWtlist.action?wpId='
  223. + wpId + "&pjId=" + pjId;
  224. $.ajax( {
  225. url : url,
  226. type : "post",
  227. cache : false,
  228. dataType : "json",
  229. success : function(data) {
  230. if (data.length != 0) {
  231. dalength = data.length;
  232. steps = 100 / dalength;
  233. resultvalue = 0;
  234. resultview = 0;
  235. }
  236. }
  237. });
  238. }
  239. function createCsv() {
  240. if (wpids == "") {
  241. alert("选择风电场!");
  242. }else if ("" == $("#beginDate").val()) {
  243. alert("请选择查询开始日期!");
  244. } else if ("" == $("#endDate").val()) {
  245. alert("请选择查询结束日期!");
  246. } else {
  247. $("#fst").showLoading();
  248. var wpId = wpids;
  249. var pjId = pjIds;
  250. var beginDate = $("#beginDate").val();
  251. var endDate = $("#endDate").val();
  252. var url = '<%=request.getContextPath()%>/downloadinfo/findWt.action?wpId='
  253. + wpId + "&pjId=" + pjId;
  254. $.ajax( {
  255. url : url,
  256. type : "post",
  257. cache : false,
  258. dataType : "json",
  259. success : function(data) {
  260. if (data.length != 0) {
  261. $("#progressbar").progressbar( {
  262. value : 0
  263. });
  264. $("#progressbar").css("display", "");
  265. $(".progress-label").css("display", "");
  266. createWt(data);
  267. }
  268. }
  269. });
  270. }
  271. }
  272. function createCsv2() {
  273. var url = '<%=request.getContextPath()%>/downloadinfo/findWt.action';
  274. $.ajax( {
  275. url : url,
  276. type : "post",
  277. cache : false,
  278. dataType : "json",
  279. success : function(data) {
  280. if (data.length != 0) {
  281. createWt(data);
  282. }
  283. }
  284. });
  285. }
  286. function createWt(wtid) {
  287. var wpId = wpids;
  288. var pjId = pjIds;
  289. var beginDate = $("#beginDate").val();
  290. var endDate = $("#endDate").val();
  291. var url = "<%=request.getContextPath()%>/downloadinfo/crateExcel.action?wtId="
  292. + wtid
  293. + "&beginDate="
  294. + beginDate
  295. + "&endDate="
  296. + endDate
  297. + "&wpId=" + wpId + "&pjId=" + pjId;
  298. $.ajax( {
  299. url : url,
  300. type : "post",
  301. cache : false,
  302. success : function(obj) {
  303. resultvalue = resultvalue + steps;
  304. resultview = Math.round(resultvalue * 100) / 100
  305. if (resultvalue >= 100) {
  306. $("#progressbar").progressbar( {
  307. value : 100
  308. });
  309. } else {
  310. $("#progressbar").progressbar( {
  311. value : resultview
  312. });
  313. }
  314. createCsv2();
  315. }
  316. });
  317. }
  318. function createZip() {
  319. var progressLabel = $(".progress-label");
  320. var beginDate = $("#beginDate").val();
  321. var endDate = $("#endDate").val();
  322. var wpId = wpids;
  323. var pjId = pjIds;
  324. var url = "<%=request.getContextPath()%>/downloadinfo/createZipIndex.action?beginDate="
  325. + beginDate
  326. + "&endDate="
  327. + endDate
  328. + "&wpId="
  329. + wpId
  330. + "&pjId="
  331. + pjId;
  332. $.ajax( {
  333. url : url,
  334. type : "post",
  335. cache : false,
  336. data : {},
  337. success : function(obj) {
  338. if (obj.length != 0) {
  339. progressLabel.text("压缩文件生成完毕,可以进行下载操作!");
  340. $("#fst").hideLoading();
  341. }
  342. }
  343. });
  344. }
  345. $(document).ready(function() {
  346. $.fn.zTree.init($("#treeWindfarm"), setting);
  347. var progressbar = $("#progressbar"), progressLabel = $(".progress-label");
  348. progressbar.css("display", "none");
  349. progressLabel.css("display", "none");
  350. progressbar.progressbar( {
  351. value : false,
  352. change : function() {
  353. progressLabel.text(progressbar.progressbar("value") + "%");
  354. },
  355. complete : function() {
  356. $("#progressbar").progressbar( {
  357. value : 0
  358. });
  359. getdatalength();
  360. progressLabel.text("文件生成完毕,正在进行文件压缩!");
  361. createZip();
  362. }
  363. });
  364. });
  365. function onBodyDown(event) {
  366. if ((event.target.id != "windpowerstationid"
  367. && event.target.id != "menuWindfarm" && $(event.target).parents(
  368. "#menuWindfarm").length <= 0)) {
  369. hideMenuWindfarm();
  370. }
  371. if (!(event.target.id == "project" || event.target.id == "menuPj" || $(
  372. event.target).parents("#menuPj").length > 0)) {
  373. hideMenuPj();
  374. }
  375. }
  376. function showJqGrid() {
  377. var wpId = wpids;
  378. var pjId = pjIds;
  379. var beginDate = $("#beginDate").val();
  380. var endDate = $("#endDate").val();
  381. var id = 'gridTable';
  382. var url = '<%=request.getContextPath()%>/downloadinfo/downLoadWtlist.action?wpId='
  383. + wpId
  384. + "&pjId="
  385. + pjId
  386. + "&beginDate="
  387. + beginDate
  388. + "&endDate="
  389. + endDate;
  390. var datatype = 'json';
  391. var colNames = [ '风机', '时间', '风速', '功率', '发电机转速', '叶片角度', '发电量' ];
  392. var colModel = [
  393. {
  394. name : 'windturbineid',
  395. index : 'windturbineid',
  396. width : 200,
  397. align : 'center'
  398. }, {
  399. name : 'recorddate',
  400. index : 'recorddate',
  401. width : 200,
  402. align : 'center'
  403. }, {
  404. name : 'speed',
  405. index : 'speed',
  406. width : 250,
  407. align : 'center'
  408. }, {
  409. name : 'power',
  410. index : 'power',
  411. width : 250,
  412. align : 'center'
  413. }, {
  414. name : 'generatorrpm',
  415. index : 'generatorrpm',
  416. width : 200,
  417. align : 'center'
  418. }, {
  419. name : 'ppa',
  420. index : 'ppa',
  421. width : 200,
  422. align : 'center'
  423. }, {
  424. name : 'generatingcapacity',
  425. index : 'generatingcapacity',
  426. width : 200,
  427. align : 'center'
  428. } ];
  429. var caption = '风机十分钟数据';
  430. var sortname = 'windturbineid';
  431. var gridPagerID = 'gridPager';
  432. var sortorder = 'desc';
  433. var height = '670';
  434. var width = '1610';
  435. var rownumbers = true;
  436. var multiselect = false;
  437. myJqGrid(id, url, datatype, colNames, colModel, caption, sortname,
  438. gridPagerID, sortorder, height, width, multiselect, rownumbers);
  439. }
  440. </script>
  441. <style type="text/css">
  442. .ui-progressbar {
  443. position: relative;
  444. }
  445. .progress-label {
  446. position: absolute;
  447. left: 50%;
  448. top: 4px;
  449. font-weight: bold;
  450. text-shadow: 1px 1px 0 #fff;
  451. }
  452. .normal {
  453. border-right-style: solid;
  454. border-bottom-style: solid;
  455. border-left-style: solid;
  456. border-top-style: solid;
  457. border-top-color: #ffffff;
  458. border-left-color: #f1f1f1;
  459. border-right-color: #f1f1f1;
  460. border-bottom-color: #f1f1f1;
  461. border-width: 1px;
  462. width: 100px;
  463. height: 28px;
  464. float: left;
  465. margin-top: -1px;
  466. cursor: pointer;
  467. text-align: center;
  468. line-height: 28px;
  469. overflow: hidden;
  470. font-weight: bold;
  471. font-size: 12px;
  472. font-family: tahoma, arial, verdana, sans-serif;
  473. }
  474. .disable {
  475. border-right-style: solid;
  476. border-bottom-style: solid;
  477. border-left-style: solid;
  478. border-top-style: solid;
  479. border-top-color: #f1f1f1;
  480. border-left-color: #f1f1f1;
  481. border-right-color: #f1f1f1;
  482. border-bottom-color: #f1f1f1;
  483. border-width: 1px;
  484. width: 100px;
  485. height: 25px;
  486. float: left;
  487. margin-top: -1px;
  488. cursor: pointer;
  489. text-align: center;
  490. background-color: #e1e1e1;
  491. line-height: 25px;
  492. overflow: hidden;
  493. font-weight: bold;
  494. font-size: 12px;
  495. font-family: tahoma, arial, verdana, sans-serif;
  496. }
  497. .panelcontainer {
  498. width: 100%;
  499. height: 70px;
  500. border-style: solid;
  501. border-color: #f1f1f1;
  502. border-width: 1px;
  503. }
  504. .panelquery {
  505. width: 100%;
  506. height: 25px;
  507. background-color: #f1f1f1;
  508. line-height: 25px;
  509. }
  510. .panelquerytext {
  511. margin-left: 3px;
  512. font-weight: bold;
  513. font-size: 12px;
  514. font-family: tahoma, arial, verdana, sans-serif;
  515. }
  516. .querycondcontainer {
  517. line-height: 39px;
  518. padding: 3px;
  519. float: left;
  520. font-size: 12px;
  521. }
  522. a { /* 统一设置所以样式 */
  523. font-family: Arial;
  524. font-size: 12px;
  525. text-align: center;
  526. margin: 3px;
  527. }
  528. a:link,a:visited { /* 超链接正常状态、被访问过的样式 */
  529. color: #000000;
  530. padding: 4px 10px 4px 10px;
  531. background-color: #f1f1f1;
  532. text-decoration: none;
  533. border-top: 1px solid #EEEEEE; /* 边框实现阴影效果 */
  534. border-left: 1px solid #EEEEEE;
  535. border-bottom: 1px solid #717171;
  536. border-right: 1px solid #717171;
  537. }
  538. a:hover { /* 鼠标指针经过时的超链接 */
  539. color: #821818; /* 改变文字颜色 */
  540. padding: 5px 8px 3px 12px; /* 改变文字位置 */
  541. background-color: #e2c4c9; /* 改变背景色 */
  542. border-top: 1px solid #717171; /* 边框变换,实现“按下去”的效果 */
  543. border-left: 1px solid #717171;
  544. border-bottom: 1px solid #EEEEEE;
  545. border-right: 1px solid #EEEEEE;
  546. }
  547. fieldset legend {
  548. color: #302A2A;
  549. font: bold 16px/ 2 Verdana, Geneva, sans-serif;
  550. font-weight: bold;
  551. text-align: left;
  552. text-shadow: 2px 2px 2px rgb(88, 126, 156);
  553. }
  554. </style>
  555. </head>
  556. <body>
  557. <form action="fittingtopindex.action" method="post" id="f1">
  558. <fieldset style="height: 90px" id="fst">
  559. <legend>
  560. 查询条件
  561. </legend>
  562. <div class="panelcontainer" style="width: 1620px; height: 40px;">
  563. <div class="querycondcontainer">
  564. 风场:
  565. <input id="windpowerstationid" type="text" readonly value=""
  566. style="width: 150px;" onclick="showWindfarm();" />
  567. </div>
  568. <div id="pjpanel" class="querycondcontainer">
  569. 项目:
  570. <input id="project" type="text" readonly value=""
  571. style="width: 150px;" onclick="showProject();" />
  572. </div>
  573. <div id="timepanel" class="querycondcontainer">
  574. 开始日期:
  575. <s:textfield cssClass="Wdate"
  576. onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',isShowWeek:true,readOnly:true})"
  577. id="beginDate" name="beginDate" title="开始日期" />
  578. </div>
  579. <div id="timepane2" class="querycondcontainer">
  580. 结束日期:
  581. <s:textfield cssClass="Wdate"
  582. onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',isShowWeek:true,readOnly:true})"
  583. id="endDate" name="endDate" title="结束日期" />
  584. </div>
  585. <div id="panel" class="querycondcontainer">
  586. <a href="#" onclick="javascript:createCsv();" id="createzip">生成文件</a>
  587. <a href="#" onclick="javascript:toExcel();" id="toexcel">导出</a>
  588. </div>
  589. </div>
  590. </fieldset>
  591. <br />
  592. <div id="menuWindfarm" class="menuContent"
  593. style="overflow-y: scroll; overflow-x: auto; z-index: 9999; border: 1px solid #617775; background: #f0f6e4; display: none; position: absolute;">
  594. <ul id="treeWindfarm" class="ztree"
  595. style="margin-top: 0; width: 180px; height: 300px;"></ul>
  596. </div>
  597. <div id="menuPj" class="menuContent"
  598. style="overflow-y: scroll; overflow-x: auto; z-index: 9999; border: 1px solid #617775; background: #f0f6e4; display: none; position: absolute;">
  599. <ul id="treePj" class="ztree"
  600. style="margin-top: 0; width: 180px; height: 300px;"></ul>
  601. </div>
  602. <div id="progressbar">
  603. <div class="progress-label">
  604. 加载...
  605. </div>
  606. </div>
  607. </form>
  608. </body>