brownouts.jsp 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
  2. <%@include file="/pages/includes/taglibs.jsp" %>
  3. <head>
  4. <script type="text/javascript" src="<%=request.getContextPath() %>/resource/js/jquery-1.8.3.js"></script>
  5. <script type="text/ecmascript" src="<%=request.getContextPath() %>/resource/plugin/jqgrid/js/jquery.jqGrid.min.js"></script>
  6. <script type="text/ecmascript" src="<%=request.getContextPath() %>/resource/plugin/jqgrid/js/i18n/grid.locale-cn.js"></script>
  7. <script type="text/ecmascript" src="<%=request.getContextPath()%>/pages/event/detail.js"></script>
  8. <script src="<%=request.getContextPath()%>/resource/js/datePicker/WdatePicker.js" type="text/javascript"></script>
  9. <link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/resource/plugin/jqueryui/css/custom-theme/jquery-ui-1.9.2.custom.css" />
  10. <link rel="stylesheet" type="text/css" media="screen" href="<%=request.getContextPath() %>/resource/plugin/jqgrid/css/ui.jqgrid.css" />
  11. <style type="text/css">
  12. a{ /* 统一设置所以样式 */
  13. font-family:Arial;
  14. font-size:12px;
  15. text-align:center;
  16. margin:3px;
  17. }
  18. a:link,a:visited{ /* 超链接正常状态、被访问过的样式 */
  19. color:#000000;
  20. padding:4px 10px 4px 10px;
  21. background-color:#f1f1f1;
  22. text-decoration:none;
  23. border-top:1px solid #EEEEEE; /* 边框实现阴影效果 */
  24. border-left:1px solid #EEEEEE;
  25. border-bottom:1px solid #717171;
  26. border-right:1px solid #717171;
  27. }
  28. a:hover{ /* 鼠标指针经过时的超链接 */
  29. color:#821818; /* 改变文字颜色 */
  30. padding:5px 8px 3px 12px; /* 改变文字位置 */
  31. background-color:#e2c4c9; /* 改变背景色 */
  32. border-top:1px solid #717171; /* 边框变换,实现“按下去”的效果 */
  33. border-left:1px solid #717171;
  34. border-bottom:1px solid #EEEEEE;
  35. border-right:1px solid #EEEEEE;
  36. }
  37. fieldset legend {
  38. color:#302A2A;
  39. font: bold 16px/2 Verdana, Geneva, sans-serif;
  40. font-weight: bold;
  41. text-align: left;
  42. text-shadow: 2px 2px 2px rgb(88, 126, 156);
  43. }
  44. </style>
  45. <script type="text/javascript">
  46. function queryData(){
  47. var wfId = $("#wfId").val();
  48. var beginDate = $("#beginDate").val();
  49. var endDate = $("#endDate").val();
  50. if("" == beginDate){
  51. alert("请选择查询开始日期!");
  52. }else if("" ==endDate){
  53. alert("请选择查询结束日期!");
  54. }else if(beginDate >endDate){
  55. alert("结束日期不允许小于开始日期!");
  56. }else{
  57. var temp="query.action?beginDate="+beginDate
  58. +"&endDate="+endDate
  59. +"&wfId="+wfId;
  60. var url= encodeURI(encodeURI(temp));
  61. $("#gridTable").setGridParam({url:url}).trigger("reloadGrid");
  62. }
  63. }
  64. function toExcel() {
  65. var wfId = $("#wfId").val();
  66. var beginDate = $("#beginDate").val();
  67. var endDate = $("#endDate").val();
  68. if("" == beginDate){
  69. alert("请选择查询开始日期!");
  70. }else if("" ==endDate){
  71. alert("请选择查询结束日期!");
  72. }else if(beginDate >endDate){
  73. alert("结束日期不允许小于开始日期!");
  74. }else{
  75. var temp="brownoutsExcel.action?beginDate="+beginDate
  76. +"&endDate="+endDate
  77. +"&wfId="+wfId;
  78. var url= encodeURI(encodeURI(temp));
  79. $('#toexcel').attr('href',url);
  80. }
  81. }
  82. $(document).ready(function () {
  83. showJqGrid();
  84. });
  85. function showJqGrid() {
  86. var wfId = $("#wfId").val();
  87. var beginDate = $("#beginDate").val();
  88. var endDate = $("#endDate").val();
  89. var temp="query.action?beginDate="+beginDate
  90. +"&endDate="+endDate
  91. +"&wfId="+wfId;
  92. var url= encodeURI(encodeURI(temp));
  93. var id = 'gridTable';
  94. var datatype = 'json';
  95. var colNames = ['编号','限电时刻', '恢复时刻','停机类型','限电时间','损失电量(KWh)','限电原因','关联风机'];
  96. var colModel = [
  97. { name: 'id', index: 'id', width: 200, align: 'center', hidden:true},
  98. { name: 'stopTime', index: 'stopTime', width: 200, align: 'center'},
  99. { name: 'startTime', index: 'startTime', width: 200, align: 'center'},
  100. { name: 'stopTypeId', index: 'stopTypeId', width: 200, align: 'center'},
  101. { name: 'stopHours', index: 'stopHours', width: 200, align: 'center'},
  102. { name: 'lossPower', index: 'lossPower', width: 200, align: 'center'},
  103. { name: 'description', index: 'description', width: 200, align: 'center'},
  104. { name: 'wts', index: 'wts', width: 200, align: 'center'}
  105. ];
  106. var caption = '限电事件管理';
  107. var sortname = 'stopTime';
  108. var gridPagerID ='gridPager';
  109. var sortorder='desc';
  110. var height='650';
  111. var width='1610';
  112. var rownumbers=true;
  113. var multiselect=true;
  114. myJqGrid(id, url, datatype, colNames, colModel, caption, sortname, gridPagerID,sortorder,height,width,
  115. multiselect,rownumbers);
  116. }
  117. function addData(){
  118. var wfId = $("#wfId").val();
  119. if("" == wfId){
  120. alert("请选择需要进行限电的场站!");
  121. return false;
  122. }
  123. $("#f1").attr("action","editData.action").submit();
  124. }
  125. /**
  126. * 批量删除
  127. */
  128. function batchDelete() {
  129. var arr=$("#gridTable").jqGrid('getGridParam', 'selarrrow');
  130. var wtids = new Array();
  131. $.each(arr,function(n,value) {
  132. var temp= $("#gridTable").jqGrid('getCell',value,'id');
  133. wtids.push(temp);
  134. })
  135. if (arr.length<1) {
  136. alert("请选择要删除的数据!");
  137. } else {
  138. if (confirm("确定要删除吗?")) {
  139. $.ajax({
  140. type:'post',
  141. traditional :true,
  142. url:'batchDelete.action',
  143. data:{"ids":wtids},
  144. success:function(data){
  145. thisPage();
  146. }
  147. });
  148. }
  149. }
  150. }
  151. function thisPage(){
  152. $("#f1").attr("action","index.action").submit();
  153. }
  154. </script>
  155. <style type="text/css">
  156. fieldset legend {
  157. color:#302A2A;
  158. font: bold 16px/2 Verdana, Geneva, sans-serif;
  159. font-weight: bold;
  160. text-align: left;
  161. text-shadow: 2px 2px 2px rgb(88, 126, 156);
  162. }
  163. </style>
  164. </head>
  165. <body>
  166. <form action="index.action" method="post" id="f1">
  167. <fieldset style="height: 60px;width: 1580px" id="fst">
  168. <legend class="item_Name">查询条件</legend>
  169. <table class="dataform">
  170. <tr>
  171. <th width="5%" class="item_Name">
  172. 场站:
  173. </th>
  174. <td width="15%" >
  175. <s:select list="wps" listKey="id" listValue="name" id="wfId" name="wfId" headerKey="" headerValue="请选择" onchange="queryData();" ></s:select>
  176. </td>
  177. <th width="5%" class="item_Name">
  178. 开始日期
  179. </th>
  180. <td width="10%" style="text-align: left">
  181. <s:textfield cssClass="Wdate" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',isShowWeek:true,readOnly:true})"
  182. id="beginDate" name="beginDate" title="开始日期" onchange="queryData();"/>
  183. </td>
  184. <th width="5%" class="item_Name">
  185. 结束日期
  186. </th>
  187. <td width="10%" style="text-align: left">
  188. <s:textfield cssClass="Wdate" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',isShowWeek:true,readOnly:true})"
  189. id="endDate" name="endDate" title="结束日期" onchange="queryData();"/>
  190. </td>
  191. <td width="20%" style="text-align: right">
  192. <a href="#" onclick="javascript:addData();" id="toexcel">新增</a>
  193. <a href="#" onclick="javascript:batchDelete();" id="toexcel">删除</a>
  194. <a href="#" onclick="javascript:toExcel();" id="toexcel">导出</a>
  195. </td>
  196. <td width="30%"></td>
  197. </tr>
  198. </table>
  199. </fieldset>
  200. <br/>
  201. <table id='gridTable' height="100%">
  202. </table>
  203. <div id='gridPager'></div>
  204. </form>
  205. </body>