index.jsp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  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()%>/resource/js/system/jqdatagrid.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. <script type="text/javascript" src="<%=request.getContextPath()%>/resource/plugin/highslide/highslide-with-html.js"></script>
  12. <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/resource/plugin/highslide/highslide.css" />
  13. <style type="text/css">
  14. #username{
  15. height: 15px;
  16. }
  17. #password{
  18. height: 15px;
  19. }
  20. a.url{ /* 统一设置所以样式 */
  21. font-family:Arial;
  22. font-size:12px;
  23. text-align:center;
  24. margin:3px;
  25. }
  26. a:link.url ,a:visited.url{ /* 超链接正常状态、被访问过的样式 */
  27. color:#000000;
  28. padding:4px 10px 4px 10px;
  29. background-color:#f1f1f1;
  30. text-decoration:none;
  31. border-top:1px solid #EEEEEE; /* 边框实现阴影效果 */
  32. border-left:1px solid #EEEEEE;
  33. border-bottom:1px solid #717171;
  34. border-right:1px solid #717171;
  35. }
  36. a:hover.url{ /* 鼠标指针经过时的超链接 */
  37. color:#821818; /* 改变文字颜色 */
  38. padding:5px 8px 3px 12px; /* 改变文字位置 */
  39. background-color:#e2c4c9; /* 改变背景色 */
  40. border-top:1px solid #717171; /* 边框变换,实现“按下去”的效果 */
  41. border-left:1px solid #717171;
  42. border-bottom:1px solid #EEEEEE;
  43. border-right:1px solid #EEEEEE;
  44. }
  45. </style>
  46. <script type="text/javascript">
  47. hs.graphicsDir = '<%=request.getContextPath()%>/resource/plugin/highslide/graphics/';
  48. hs.outlineType = 'rounded-white';
  49. hs.wrapperClassName = 'draggable-header';
  50. var action = -99;
  51. function showDiv1(a) {
  52. var hc = $("#container");
  53. action = a;
  54. return hs.htmlExpand(hc[0], {
  55. contentId : 'showDiv2',
  56. width : 300,
  57. height : 200,
  58. align : 'center',
  59. headingText : '输入账号密码'
  60. });
  61. }
  62. function hsreset(){
  63. $("#operator").val("");
  64. $("#username").val("");
  65. $("#password").val("");
  66. }
  67. function check(){
  68. var operator = $("#operator").val();
  69. var username = $("#username").val();
  70. var password = $("#password").val();
  71. if(operator=="" || operator==null){
  72. alert("请输操作人姓名");
  73. }else if(username=="" || username==null){
  74. alert("请输入用户名");
  75. }else if(password=="" || password==null){
  76. alert("请输入密码");
  77. }else{
  78. $.post("/statisticsAnalysis/reportusers_check.action",{username:username,password:password,action:action,wpid:$("#wfId").val()},function(data){
  79. if(data==1){
  80. if(action ==1){
  81. $.post("/statisticsAnalysis/statisticsstate_save.action",{state:1,tbid:username,action:1,tbname:operator,tid:$("#stId").val()},function(data){
  82. hs.close();
  83. hsreset();
  84. saveData();
  85. return;
  86. })
  87. }else if(action ==2 ){
  88. $.post("/statisticsAnalysis/statisticsstate_save.action",{state:2,shid:username,action:2,shname:operator,tid:$("#stId").val()},function(data){
  89. alert("审核成功");
  90. hsreset();
  91. hs.close();
  92. status();
  93. return;
  94. })
  95. }else if(action ==3){
  96. $.post("/statisticsAnalysis/statisticsstate_save.action",{state:3,qrid:username,action:3,qrname:operator,tid:$("#stId").val()},function(data){
  97. alert("确认成功");
  98. hsreset();
  99. hs.close();
  100. status();
  101. return;
  102. })
  103. }
  104. }else{
  105. alert("账号密码不正确或您的权限不足!")
  106. }
  107. })
  108. }
  109. }
  110. function queryClear(){
  111. $("#targetName").val("");
  112. }
  113. function returnMainPage(){
  114. // 场站查询条件
  115. var wfIdQ = $("#wfIdQ").val();
  116. // 日期查询条件
  117. var recordDateQ = $("#recordDateQ").val();
  118. $("#formView").attr("action", "/statisticsAnalysis/analysismain.action?wfIdQ="+wfIdQ+"&recordDateQ="+recordDateQ).submit();
  119. }
  120. function queryData(){
  121. $("#gridTable").jqGrid('GridUnload');
  122. showJqGrid();
  123. // 风场ID
  124. //var stId = $("#stId").val();
  125. // 指标名称
  126. //var targetName = $("#targetName").val();
  127. //jQuery("#gridTable").jqGrid('setGridParam',{url:encodeURI(encodeURI("analysisList.action?targetName="+ targetName + "&stId="+stId))}).trigger("reloadGrid");
  128. }
  129. function saveData() {
  130. // 风场ID
  131. var wfId = $("#wfId").val();
  132. // 日期
  133. var recordDate = $("#recordDate").val();
  134. var array = [];
  135. $("#gridTable").find("tr").each(function(i){
  136. if(i>0){
  137. var tempid = $(this).find("td").eq(0).text();
  138. var tempVal = '';
  139. var temptype = $(this).find("td").eq(9).text();
  140. if(temptype != '计算' && temptype != '特殊'){
  141. tempVal = $(this).find("td").eq(4).find("input").val();
  142. // 为空判断
  143. tempVal = tempVal.replace(/\s+/g, "");
  144. if(tempVal==""){
  145. alert("当日值不能为空");
  146. return false;
  147. }
  148. // 非法数字判断
  149. if(isNaN(tempVal)){
  150. alert("当日值必须为数字");
  151. return false;
  152. }
  153. array.push(tempid+"/"+tempVal);
  154. } else {
  155. tempVal = $(this).find("td").eq(4).text();
  156. array.push(tempid+"/"+tempVal);
  157. }
  158. }
  159. });
  160. $.ajax({
  161. type: "POST",
  162. url: "/statisticsAnalysis/batchSave.action?wfId="+wfId+"&recordDate="+recordDate+"&idsStr="+array,
  163. dataType:"json",
  164. complete:function (XMLHttpRequest, textStatus) {
  165. queryData();
  166. alert('保存成功');
  167. status();
  168. }
  169. });
  170. }
  171. function status(){
  172. $.post("/statisticsAnalysis/statisticsstate_status.action",{tid:$("#stId").val()},function(data){
  173. if(data==-1){
  174. $("#baocun").removeAttr("disabled");
  175. $("#shenhe").attr({"disabled":"disabled"});
  176. $("#queren").attr({"disabled":"disabled"});
  177. }
  178. if(data==1){
  179. $("#baocun").attr({"disabled":"disabled"});
  180. $("#shenhe").removeAttr("disabled");
  181. $("#queren").attr({"disabled":"disabled"});
  182. }
  183. if(data==2){
  184. $("#baocun").attr({"disabled":"disabled"});
  185. $("#shenhe").attr({"disabled":"disabled"});
  186. $("#queren").removeAttr("disabled");
  187. }
  188. if(data==3){
  189. $("#baocun").attr({"disabled":"disabled"});
  190. $("#shenhe").attr({"disabled":"disabled"});
  191. $("#queren").attr({"disabled":"disabled"});
  192. }
  193. })
  194. }
  195. $(function(){
  196. status();
  197. showJqGrid();
  198. // 风场名称
  199. var wsnametext = $("#wfId").find("option:selected").text();
  200. $("#wsname").text(wsnametext);
  201. // 日期
  202. var wstimetext = $("#recordDate").val();
  203. $("#wstime").text(wstimetext);
  204. });
  205. // 加载jqgrid表格
  206. function showJqGrid(){
  207. // 场站
  208. var stId = $("#stId").val();
  209. // 日期
  210. var targetName = $("#targetName").val();
  211. //+'&targetName='+targetName
  212. jQuery("#gridTable").jqGrid({
  213. url:'/statisticsAnalysis/analysisList.action?stId='+stId,
  214. mtype:'POST',
  215. postData:{targetName:targetName},
  216. datatype: "json",
  217. colNames:['编号','指标名称','单位','当日值(只读)','当日值(可变)','当前星期值','当前月份值','当前季度值','当前年值','类别','公式描述'],
  218. colModel:[
  219. { name: 'id', index: 'id', width: 200, align: 'center', hidden: true},
  220. { name: 'targetName', index: 'targetName', width: 200, align: 'center'},
  221. { name: 'unit', index: 'unit', width: 100, align: 'center'},
  222. { name: 'dayValueR', index: 'dayValueR', width: 100, align: 'center'},
  223. { name: 'dayValue', index: 'dayValue', width: 100, align: 'center',editable : true},
  224. { name: 'weekValue', index: 'weekValue', width: 100, align: 'center'},
  225. { name: 'monthValue', index: 'monthValue', width: 100, align: 'center'},
  226. { name: 'quarterValue', index: 'wpId', width: 100, align: 'center'},
  227. { name: 'yearValue', index: 'wpName', width: 100, align: 'center'},
  228. { name: 'type', index: 'recordDate', width: 100, align: 'center'},
  229. { name: 'formulaDesc', index: 'operate', width: 600, align: 'center'}
  230. ],
  231. rowNum:1000,
  232. height:630,
  233. width:1000,
  234. editurl : '/statisticsAnalysis/analysisList.action?stId='+stId+'&targetName='+targetName+"/RowEditing",
  235. autowidth: true,
  236. sortorder: "desc",
  237. caption: "统计分析列表",
  238. pager: '#gridPager',
  239. viewrecords: true,
  240. afterInsertRow:function(rowid,rowdata,rowelem){
  241. var operateLink = "<a href=\"#\" onclick=\"requestAction('/statisticsAnalysis/index.action?wfId=" + rowdata.wpId + "&stId=" + rowdata.id + "&recordDate=" + rowdata.recordDate + "&wfIdQ=" + wfIdQ + "&recordDateQ=" + recordDateQ + "')\">场站统计分析</a>&nbsp/&nbsp"+
  242. "<a href=\"#\" onclick=\"requestAction('/windTurbineAnalysis/windturbineanalysismain.action?wfId=" + rowdata.wpId + "&stId=" + rowdata.id + "&recordDate=" + rowdata.recordDate + "&wfIdQ=" + wfIdQ + "&recordDateQ=" + recordDateQ + "')\">设备统计分析</a>";
  243. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{operate:operateLink});
  244. if(rowdata.type == '基础' ){
  245. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{targetName:"<font color=Green>"+rowdata.targetName+"</font>"});
  246. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{unit:"<font color=Green>"+rowdata.unit+"</font>"});
  247. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{dayValueR:"<font color=Green>"+rowdata.dayValueR+"</font>"});
  248. jQuery("#gridTable").jqGrid('editRow', rowdata.id);
  249. //jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{dayValue:"<input type='text' style='width: inherit;' name='names' value='"+rowdata.dayValue+"'></input>"});
  250. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{weekValue:"<font color=Green>"+rowdata.weekValue+"</font>"});
  251. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{monthValue:"<font color=Green>"+rowdata.monthValue+"</font>"});
  252. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{quarterValue:"<font color=Green>"+rowdata.quarterValue+"</font>"});
  253. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{yearValue:"<font color=Green>"+rowdata.yearValue+"</font>"});
  254. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{type:"<font color=Green>"+rowdata.type+"</font>"});
  255. } else if(rowdata.type == '计算' ){
  256. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{targetName:"<font color=Purple>"+rowdata.targetName+"</font>"});
  257. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{unit:"<font color=Purple>"+rowdata.unit+"</font>"});
  258. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{dayValueR:"<font color=Green>"+rowdata.dayValueR+"</font>"});
  259. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{dayValue:"<font color=Purple>"+rowdata.dayValue+"</font>"});
  260. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{weekValue:"<font color=Purple>"+rowdata.weekValue+"</font>"});
  261. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{monthValue:"<font color=Purple>"+rowdata.monthValue+"</font>"});
  262. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{quarterValue:"<font color=Purple>"+rowdata.quarterValue+"</font>"});
  263. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{yearValue:"<font color=Purple>"+rowdata.yearValue+"</font>"});
  264. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{type:"<font color=Purple>"+rowdata.type+"</font>"});
  265. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{formulaDesc:"<font color=Purple>"+rowdata.formulaDesc+"</font>"});
  266. } else if(rowdata.type == '默认' ){
  267. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{targetName:"<font color=Orange>"+rowdata.targetName+"</font>"});
  268. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{unit:"<font color=Orange>"+rowdata.unit+"</font>"});
  269. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{dayValueR:"<font color=Orange>"+rowdata.dayValueR+"</font>"});
  270. jQuery("#gridTable").jqGrid('editRow', rowdata.id);
  271. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{weekValue:"<font color=Orange>"+rowdata.weekValue+"</font>"});
  272. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{monthValue:"<font color=Orange>"+rowdata.monthValue+"</font>"});
  273. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{quarterValue:"<font color=Orange>"+rowdata.quarterValue+"</font>"});
  274. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{yearValue:"<font color=Orange>"+rowdata.yearValue+"</font>"});
  275. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{type:"<font color=Orange>"+rowdata.type+"</font>"});
  276. } else if(rowdata.type == '手填' ){
  277. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{targetName:"<font color=Blue>"+rowdata.targetName+"</font>"});
  278. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{unit:"<font color=Blue>"+rowdata.unit+"</font>"});
  279. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{dayValueR:"<font color=Blue>"+rowdata.dayValueR+"</font>"});
  280. jQuery("#gridTable").jqGrid('editRow', rowdata.id);
  281. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{weekValue:"<font color=Blue>"+rowdata.weekValue+"</font>"});
  282. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{monthValue:"<font color=Blue>"+rowdata.monthValue+"</font>"});
  283. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{quarterValue:"<font color=Blue>"+rowdata.quarterValue+"</font>"});
  284. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{yearValue:"<font color=Blue>"+rowdata.yearValue+"</font>"});
  285. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{type:"<font color=Blue>"+rowdata.type+"</font>"});
  286. } else if(rowdata.type == '特殊' ){
  287. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{targetName:"<font color=Red>"+rowdata.targetName+"</font>"});
  288. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{unit:"<font color=Red>"+rowdata.unit+"</font>"});
  289. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{dayValueR:"<font color=Red>"+rowdata.dayValueR+"</font>"});
  290. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{dayValue:"<font color=Red>"+rowdata.dayValue+"</font>"});
  291. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{weekValue:"<font color=Red>"+rowdata.weekValue+"</font>"});
  292. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{monthValue:"<font color=Red>"+rowdata.monthValue+"</font>"});
  293. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{quarterValue:"<font color=Red>"+rowdata.quarterValue+"</font>"});
  294. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{yearValue:"<font color=Red>"+rowdata.yearValue+"</font>"});
  295. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{type:"<font color=Red>"+rowdata.type+"</font>"});
  296. }
  297. }
  298. });
  299. }
  300. </script>
  301. </head>
  302. <body>
  303. <div class="highslide-html-content" id="showDiv2" style="width: 1100">
  304. <div class="highslide-header">
  305. <ul>
  306. <li class="highslide-move">
  307. <a href="#" onclick="return false">Move</a>
  308. </li>
  309. <li class="highslide-close" >
  310. <a href="#" onclick="return hs.close(this)"></a>
  311. </li>
  312. </ul>
  313. </div>
  314. <div class="highslide-body" id="container" style="width: 289px">
  315. <table height="180px">
  316. <tr><td width="100px" align="right" style="font-size: 16px;font-weight: bold;">操&nbsp;作&nbsp;人:</td><td width="190px"><input type="text" name="operator" id="operator" placeholder= "请输入操作人姓名" /> </td></tr>
  317. <tr><td width="100px" align="right" style="font-size: 16px;font-weight: bold;">用&nbsp;户&nbsp;名:</td><td width="190px"><input type="text" name="username" id="username" placeholder= "请输入用户名" /> </td></tr>
  318. <tr><td width="100px" align="right" style="font-size: 16px;font-weight: bold;">密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码:</td><td width="190px"><input type="password" name="password" id="password" placeholder= "请输入密码"/> </td></tr>
  319. <tr><td width="100px" align="center" colspan="2"><input type="button" class="button" onclick="javascript:check();" value="确定"/>&nbsp;<input type="reset" class="button" onclick="javascript:hs.close();" value="取消"/></td>
  320. </tr>
  321. </table>
  322. </div>
  323. </div>
  324. <table width="100%">
  325. <tr>
  326. <td align="left" class="navbar" style="font-size: 12px;"><font id="wsname"></font>统计分析<font id="wstime"></font></td>
  327. <td align="right">
  328. <input type="button" id = 'baocun' class="button" onclick="javascript:showDiv1(1);" value="保存"/>
  329. <input type="button" id="shenhe" class="button" onclick="javascript:showDiv1(2);" value="审核"/>
  330. <input type="button" id="queren" class="button" onclick="javascript:showDiv1(3);" value="确认"/>
  331. <a href="/statisticsAnalysis/analysisListexcel.action?stId=${stId}" class="url" id="toexcel">导出</a>
  332. <input type="button" class="button" onclick="javascript:returnMainPage();" value="返回"/>
  333. </td>
  334. </tr>
  335. </table>
  336. <hr/>
  337. <fieldset id="fst">
  338. <legend class="item_Name">查询条件</legend>
  339. <table width="1000px" cellpadding="0" cellspacing="0" class="dataform">
  340. <tr>
  341. <td align="left" >
  342. <input type="text" name="wfIdQ" id="wfIdQ" value="${wfIdQ}" style="display:none;"/>
  343. <input type="text" name="stId" id="stId" value="${stId}" style="display:none;"/>
  344. <s:textfield
  345. cssClass="Wdate"
  346. onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',isShowWeek:true,readOnly:true})"
  347. id="recordDateQ" name="recordDateQ" title="日期" style="display:none;"/>
  348. <s:select list="windpowers" cssStyle="width:173px;display:none" listKey="id" listValue="name" id="wfId" name="wfId" headerKey="" headerValue="请选择" onchange="javascript:queryData()" ></s:select>
  349. <input type="text" name="stId" id="stId" value="${stId}" style="display: none;"/>
  350. <s:textfield
  351. cssClass="Wdate"
  352. onFocus="WdatePicker({dateFmt:'yyyy-MM-dd',isShowWeek:true,readOnly:true})"
  353. id="recordDate" name="recordDate" title="日期" onchange="javascript:queryData()" style="display:none"/>
  354. 指标名称:<s:textfield name="targetName" id="targetName">${targetName}</s:textfield>
  355. <input type="button" class="button" onclick="javascript:queryData();" value="查询"/>
  356. <input type="button" class="button" onclick="javascript:queryClear();" value="清空"/>
  357. </td>
  358. </tr>
  359. </table>
  360. </fieldset>
  361. <br/>
  362. <table id='gridTable'></table>
  363. <div id='gridPager'></div>
  364. <form action="" method="post" id="formView">
  365. </form>
  366. </body>