<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <%@include file="/pages/includes/taglibs.jsp"%> <head> <script type="text/javascript" src="<%=request.getContextPath()%>/resource/js/jquery-1.8.3.js"> </script> <script src="<%=request.getContextPath()%>/resource/plugin/jqueryui/js/jquery-ui-1.9.2.custom.js" type="text/javascript"> </script> <script type="text/ecmascript" src="<%=request.getContextPath()%>/resource/plugin/jqgrid/js/jquery.jqGrid.min.js"> </script> <script type="text/ecmascript" src="<%=request.getContextPath()%>/resource/plugin/jqgrid/js/i18n/grid.locale-cn.js"> </script> <script type="text/ecmascript" src="<%=request.getContextPath()%>/resource/js/system/jqdatagridpage.js"> </script> <script src="<%=request.getContextPath()%>/resource/js/datePicker/WdatePicker.js" type="text/javascript"> </script> <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/resource/plugin/jqueryui/css/custom-theme/jquery-ui-1.9.2.custom.css" /> <link rel="stylesheet" type="text/css" media="screen" href="<%=request.getContextPath()%>/resource/plugin/jqgrid/css/ui.jqgrid.css" /> <link rel="stylesheet" href="<%=request.getContextPath()%>/resource/css/ztree/zTreeStyle.css" type="text/css" /> <script src="<%=request.getContextPath()%>/resource/js/ztree/jquery.ztree.all.min.js" type="text/javascript"> </script> <link rel="stylesheet" href="<%=request.getContextPath()%>/resource/js/showloading/showLoading.css" type="text/css" /> <script src="<%=request.getContextPath()%>/resource/js/showloading/jquery.showLoading.js" type="text/javascript"> </script> <script type="text/javascript"> var queryType = "fc"; var setting = { check : { enable : true, chkStyle : "radio" }, view : { dblClickExpand : false }, data : { simpleData : { enable : true } }, callback : { beforeClick : beforeClickWindfarm, onCheck : selectWindfarm }, async : { enable : true, url : "/power/windfarmAjax.action", dataType : "json" } }; function beforeClickWindfarm(treeId, treeNode) { var zTree = $.fn.zTree.getZTreeObj(treeId); zTree.checkNode(treeNode, !treeNode.checked, null, true); return false; } function showWindfarm() { var cityObj = $("#windpowerstationid"); var cityOffset = $("#windpowerstationid").offset(); $("#menuWindfarm").css( { left : cityOffset.left + "px", top : cityOffset.top + cityObj.outerHeight() + "px" }).slideDown("fast"); $("body").bind("mousedown", onBodyDown); } function showProject() { if (wpids == "") { alert("请选择风场!"); return; } var setting3 = { check : { enable : true, chkStyle : "checkbox" }, view : { dblClickExpand : false }, data : { simpleData : { enable : true } }, callback : { beforeClick : beforeClickWindfarm, onCheck : selectPj }, async : { enable : true, url : "/power/projectAjax.action?wpIds=" + wpids, dataType : "json" } }; $.fn.zTree.init($("#treePj"), setting3); var cityObj = $("#project"); var cityOffset = $("#project").offset(); $("#menuPj").css( { left : cityOffset.left + "px", top : cityOffset.top + cityObj.outerHeight() + "px" }).slideDown("fast"); $("body").bind("mousedown", onBodyDown); pjIds = ''; $("#project").val(""); } function hideMenuWindfarm() { $("#menuWindfarm").fadeOut("fast"); } var wpids = ""; function selectWindfarm(e, treeId, treeNode) { var zTree = $.fn.zTree.getZTreeObj("treeWindfarm"), nodes = zTree .getCheckedNodes(true); v = ""; d = ""; for ( var i = 0, l = nodes.length; i < l; i++) { v += nodes[i].name + ","; d += nodes[i].id + ","; } if (v.length > 0) v = v.substring(0, v.length - 1); if (d.length > 0) d = d.substring(0, d.length - 1); wpids = d; var cityObj = $("#windpowerstationid"); cityObj.attr("value", v); lineIds = ''; pjIds = ''; $("#project").val(""); $("#line").val(""); getdatalength(); //$("#menuWindfarm").fadeOut("fast"); } var pjIds; function selectPj(e, treeId, treeNode) { var zTree = $.fn.zTree.getZTreeObj("treePj"), nodes = zTree .getCheckedNodes(true); v = ""; d = ""; for ( var i = 0, l = nodes.length; i < l; i++) { v += nodes[i].name + ","; d += nodes[i].id + ","; } if (v.length > 0) v = v.substring(0, v.length - 1); if (d.length > 0) d = d.substring(0, d.length - 1); pjIds = d; var cityObj = $("#project"); cityObj.attr("value", v); getdatalength(); //$("#menuXl").fadeOut("fast"); } function hideMenuPj() { $("#menuPj").fadeOut("fast"); } function queryData() { if ("" == $("#beginDate").val()) { alert("请选择查询开始日期!"); } else if ("" == $("#endDate").val()) { alert("请选择查询结束日期!"); } else { var wpId = wpids; var pjId = pjIds; var beginDate = $("#beginDate").val(); var endDate = $("#endDate").val(); var url = '<%=request.getContextPath()%>/downloadinfo/downLoadWtlist.action?wpId=' + wpId + "&pjId=" + pjId + "&beginDate=" + beginDate + "&endDate=" + endDate; $("#gridTable").setGridParam( { url : url }).trigger("reloadGrid"); } $('#createzip').css('display', ''); } function toExcel() { if ("" == $("#beginDate").val()) { alert("请选择查询开始日期!"); } else if ("" == $("#endDate").val()) { alert("请选择查询结束日期!"); } else { var wpId = wpids; var pjId = pjIds; var beginDate = $("#beginDate").val(); var endDate = $("#endDate").val(); var url = '<%=request.getContextPath()%>/downloadinfo/downLoadWtExcel.action?wpId=' + wpId + "&pjId=" + pjId + "&beginDate=" + beginDate + "&endDate=" + endDate; $('#toexcel').attr('href', url); } } var dalength; var steps = 0; var resultvalue = 0; var resultview = 0; function getdatalength() { var wpId = wpids; var pjId = pjIds; var beginDate = $("#beginDate").val(); var endDate = $("#endDate").val(); var url = '<%=request.getContextPath()%>/downloadinfo/findWtlist.action?wpId=' + wpId + "&pjId=" + pjId; $.ajax( { url : url, type : "post", cache : false, dataType : "json", success : function(data) { if (data.length != 0) { dalength = data.length; steps = 100 / dalength; resultvalue = 0; resultview = 0; } } }); } function createCsv() { if (wpids == "") { alert("选择风电场!"); }else if ("" == $("#beginDate").val()) { alert("请选择查询开始日期!"); } else if ("" == $("#endDate").val()) { alert("请选择查询结束日期!"); } else { $("#fst").showLoading(); var wpId = wpids; var pjId = pjIds; var beginDate = $("#beginDate").val(); var endDate = $("#endDate").val(); var url = '<%=request.getContextPath()%>/downloadinfo/findWt.action?wpId=' + wpId + "&pjId=" + pjId; $.ajax( { url : url, type : "post", cache : false, dataType : "json", success : function(data) { if (data.length != 0) { $("#progressbar").progressbar( { value : 0 }); $("#progressbar").css("display", ""); $(".progress-label").css("display", ""); createWt(data); } } }); } } function createCsv2() { var url = '<%=request.getContextPath()%>/downloadinfo/findWt.action'; $.ajax( { url : url, type : "post", cache : false, dataType : "json", success : function(data) { if (data.length != 0) { createWt(data); } } }); } function createWt(wtid) { var wpId = wpids; var pjId = pjIds; var beginDate = $("#beginDate").val(); var endDate = $("#endDate").val(); var url = "<%=request.getContextPath()%>/downloadinfo/crateExcel.action?wtId=" + wtid + "&beginDate=" + beginDate + "&endDate=" + endDate + "&wpId=" + wpId + "&pjId=" + pjId; $.ajax( { url : url, type : "post", cache : false, success : function(obj) { resultvalue = resultvalue + steps; resultview = Math.round(resultvalue * 100) / 100 if (resultvalue >= 100) { $("#progressbar").progressbar( { value : 100 }); } else { $("#progressbar").progressbar( { value : resultview }); } createCsv2(); } }); } function createZip() { var progressLabel = $(".progress-label"); var beginDate = $("#beginDate").val(); var endDate = $("#endDate").val(); var wpId = wpids; var pjId = pjIds; var url = "<%=request.getContextPath()%>/downloadinfo/createZipIndex.action?beginDate=" + beginDate + "&endDate=" + endDate + "&wpId=" + wpId + "&pjId=" + pjId; $.ajax( { url : url, type : "post", cache : false, data : {}, success : function(obj) { if (obj.length != 0) { progressLabel.text("压缩文件生成完毕,可以进行下载操作!"); $("#fst").hideLoading(); } } }); } $(document).ready(function() { $.fn.zTree.init($("#treeWindfarm"), setting); var progressbar = $("#progressbar"), progressLabel = $(".progress-label"); progressbar.css("display", "none"); progressLabel.css("display", "none"); progressbar.progressbar( { value : false, change : function() { progressLabel.text(progressbar.progressbar("value") + "%"); }, complete : function() { $("#progressbar").progressbar( { value : 0 }); getdatalength(); progressLabel.text("文件生成完毕,正在进行文件压缩!"); createZip(); } }); }); function onBodyDown(event) { if ((event.target.id != "windpowerstationid" && event.target.id != "menuWindfarm" && $(event.target).parents( "#menuWindfarm").length <= 0)) { hideMenuWindfarm(); } if (!(event.target.id == "project" || event.target.id == "menuPj" || $( event.target).parents("#menuPj").length > 0)) { hideMenuPj(); } } function showJqGrid() { var wpId = wpids; var pjId = pjIds; var beginDate = $("#beginDate").val(); var endDate = $("#endDate").val(); var id = 'gridTable'; var url = '<%=request.getContextPath()%>/downloadinfo/downLoadWtlist.action?wpId=' + wpId + "&pjId=" + pjId + "&beginDate=" + beginDate + "&endDate=" + endDate; var datatype = 'json'; var colNames = [ '风机', '时间', '风速', '功率', '发电机转速', '叶片角度', '发电量' ]; var colModel = [ { name : 'windturbineid', index : 'windturbineid', width : 200, align : 'center' }, { name : 'recorddate', index : 'recorddate', width : 200, align : 'center' }, { name : 'speed', index : 'speed', width : 250, align : 'center' }, { name : 'power', index : 'power', width : 250, align : 'center' }, { name : 'generatorrpm', index : 'generatorrpm', width : 200, align : 'center' }, { name : 'ppa', index : 'ppa', width : 200, align : 'center' }, { name : 'generatingcapacity', index : 'generatingcapacity', width : 200, align : 'center' } ]; var caption = '风机十分钟数据'; var sortname = 'windturbineid'; var gridPagerID = 'gridPager'; var sortorder = 'desc'; var height = '670'; var width = '1610'; var rownumbers = true; var multiselect = false; myJqGrid(id, url, datatype, colNames, colModel, caption, sortname, gridPagerID, sortorder, height, width, multiselect, rownumbers); } </script> <style type="text/css"> .ui-progressbar { position: relative; } .progress-label { position: absolute; left: 50%; top: 4px; font-weight: bold; text-shadow: 1px 1px 0 #fff; } .normal { border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-style: solid; border-top-color: #ffffff; border-left-color: #f1f1f1; border-right-color: #f1f1f1; border-bottom-color: #f1f1f1; border-width: 1px; width: 100px; height: 28px; float: left; margin-top: -1px; cursor: pointer; text-align: center; line-height: 28px; overflow: hidden; font-weight: bold; font-size: 12px; font-family: tahoma, arial, verdana, sans-serif; } .disable { border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-style: solid; border-top-color: #f1f1f1; border-left-color: #f1f1f1; border-right-color: #f1f1f1; border-bottom-color: #f1f1f1; border-width: 1px; width: 100px; height: 25px; float: left; margin-top: -1px; cursor: pointer; text-align: center; background-color: #e1e1e1; line-height: 25px; overflow: hidden; font-weight: bold; font-size: 12px; font-family: tahoma, arial, verdana, sans-serif; } .panelcontainer { width: 100%; height: 70px; border-style: solid; border-color: #f1f1f1; border-width: 1px; } .panelquery { width: 100%; height: 25px; background-color: #f1f1f1; line-height: 25px; } .panelquerytext { margin-left: 3px; font-weight: bold; font-size: 12px; font-family: tahoma, arial, verdana, sans-serif; } .querycondcontainer { line-height: 39px; padding: 3px; float: left; font-size: 12px; } a { /* 统一设置所以样式 */ font-family: Arial; font-size: 12px; text-align: center; margin: 3px; } a:link,a:visited { /* 超链接正常状态、被访问过的样式 */ color: #000000; padding: 4px 10px 4px 10px; background-color: #f1f1f1; text-decoration: none; border-top: 1px solid #EEEEEE; /* 边框实现阴影效果 */ border-left: 1px solid #EEEEEE; border-bottom: 1px solid #717171; border-right: 1px solid #717171; } a:hover { /* 鼠标指针经过时的超链接 */ color: #821818; /* 改变文字颜色 */ padding: 5px 8px 3px 12px; /* 改变文字位置 */ background-color: #e2c4c9; /* 改变背景色 */ border-top: 1px solid #717171; /* 边框变换,实现“按下去”的效果 */ border-left: 1px solid #717171; border-bottom: 1px solid #EEEEEE; border-right: 1px solid #EEEEEE; } fieldset legend { color: #302A2A; font: bold 16px/ 2 Verdana, Geneva, sans-serif; font-weight: bold; text-align: left; text-shadow: 2px 2px 2px rgb(88, 126, 156); } </style> </head> <body> <form action="fittingtopindex.action" method="post" id="f1"> <fieldset style="height: 90px" id="fst"> <legend> 查询条件 </legend> <div class="panelcontainer" style="width: 1620px; height: 40px;"> <div class="querycondcontainer"> 风场: <input id="windpowerstationid" type="text" readonly value="" style="width: 150px;" onclick="showWindfarm();" /> </div> <div id="pjpanel" class="querycondcontainer"> 项目: <input id="project" type="text" readonly value="" style="width: 150px;" onclick="showProject();" /> </div> <div id="timepanel" class="querycondcontainer"> 开始日期: <s:textfield cssClass="Wdate" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',isShowWeek:true,readOnly:true})" id="beginDate" name="beginDate" title="开始日期" /> </div> <div id="timepane2" class="querycondcontainer"> 结束日期: <s:textfield cssClass="Wdate" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',isShowWeek:true,readOnly:true})" id="endDate" name="endDate" title="结束日期" /> </div> <div id="panel" class="querycondcontainer"> <a href="#" onclick="javascript:createCsv();" id="createzip">生成文件</a> <a href="#" onclick="javascript:toExcel();" id="toexcel">导出</a> </div> </div> </fieldset> <br /> <div id="menuWindfarm" class="menuContent" style="overflow-y: scroll; overflow-x: auto; z-index: 9999; border: 1px solid #617775; background: #f0f6e4; display: none; position: absolute;"> <ul id="treeWindfarm" class="ztree" style="margin-top: 0; width: 180px; height: 300px;"></ul> </div> <div id="menuPj" class="menuContent" style="overflow-y: scroll; overflow-x: auto; z-index: 9999; border: 1px solid #617775; background: #f0f6e4; display: none; position: absolute;"> <ul id="treePj" class="ztree" style="margin-top: 0; width: 180px; height: 300px;"></ul> </div> <div id="progressbar"> <div class="progress-label"> 加载... </div> </div> </form> </body>