gayearnr.jsp 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. <script type="text/javascript">
  14. $(document).ready(function() {
  15. $("#pid").val("<s:property value='pid'/>");
  16. showJqGrid();
  17. });
  18. function gosave() {
  19. var pid = $("#pid").val();
  20. var state=true;
  21. var array1 = [];
  22. var array2 = [];
  23. $("#gridTable").find("tr").each(function(i){
  24. if(i>0){
  25. var tempid = $(this).find("td").eq(0).text();
  26. var tempVal = $(this).find("td").eq(5).find("input").val();
  27. var tempName = $(this).find("td").eq(6).find("input").val();
  28. // 为空判断
  29. tempVal = tempVal.replace(/\s+/g, "");
  30. if(tempVal==""){
  31. $(this).find("td").eq(5).find("input").css({"background-color":"red"});
  32. alert("分数不能为空");
  33. state=false;
  34. return false;
  35. }
  36. // 非法数字判断
  37. if(isNaN(tempVal)){
  38. $(this).find("td").eq(5).find("input").css({"background-color":"red"});
  39. alert("分数必须为数字");
  40. state=false;
  41. return false;
  42. }
  43. var temp=$(this).find("td").eq(4).text();
  44. if(!isNaN(tempVal) && !isNaN(temp)){
  45. if(parseFloat(tempVal)>parseFloat(temp))
  46. {
  47. $(this).find("td").eq(5).find("input").css({"background-color":"red"});
  48. alert("分数不能超过满分");
  49. state=false;
  50. return false;
  51. }
  52. }
  53. array1.push(tempid+"/"+tempVal);
  54. array2.push(tempid+"/"+tempName);
  55. }
  56. });
  57. if(state)
  58. {
  59. var temp="/gradeassessyear/batchNaturerecordSave.action?ids="+array1+"&idname="+array2+"&pid="+pid;
  60. var url= encodeURI(encodeURI(temp));
  61. $.ajax({
  62. type: "POST",
  63. url: url,
  64. dataType:"json",
  65. complete:function (XMLHttpRequest, textStatus) {
  66. queryApData();
  67. alert('保存成功');
  68. }
  69. });
  70. }
  71. }
  72. function goback() {
  73. $("#f1").attr("action", "/gradeassessyear/gayearindex.action").submit();
  74. }
  75. function queryApData() {
  76. $("#gridTable").jqGrid('GridUnload');
  77. showJqGrid();
  78. }
  79. function showJqGrid() {
  80. var pid = $("#pid").val();
  81. jQuery("#gridTable").jqGrid({
  82. url:'gayearnrlist.action?pid=' + pid,
  83. mtype:'POST',
  84. datatype: "json",
  85. colNames:['编号','名称', '类别','计算值','满分','得分','描述'],
  86. colModel:[
  87. { name: 'id', index: 'id', width: 120, align: 'center',hidden:true},
  88. { name: 'name', index: 'name', width: 150, align: 'center'},
  89. { name: 'typeobj', index: 'typeobj', width: 100, align: 'center'},
  90. { name: 'calculatevalue', index: 'calculatevalue', width: 200, align: 'center'},
  91. { name: 'wvalue', index: 'wvalue', width: 100, align: 'center'},
  92. { name: 'modscore', index: 'modscore', width: 100, align: 'center',editable : true},
  93. { name: 'description', index: 'description', width: 400, align: 'center',editable : true}
  94. ],
  95. rowNum:1000,
  96. height:'auto',
  97. width:'auto',
  98. autowidth: true,
  99. sortorder: "desc",
  100. caption: "年定性分析指标",
  101. pager: '#gridPager',
  102. viewrecords: true,
  103. afterInsertRow:function(rowid,rowdata,rowelem){
  104. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{id:rowdata.id});
  105. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{name:rowdata.name});
  106. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{typeobj:rowdata.typeobj});
  107. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{calculatevalue:rowdata.calculatevalue});
  108. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{wvalue:rowdata.wvalue});
  109. jQuery("#gridTable").jqGrid('editRow', rowdata.id,{modscore:rowdata.modscore});
  110. jQuery("#gridTable").jqGrid('editRow', rowdata.id,{description:rowdata.description});
  111. }
  112. });
  113. }
  114. </script>
  115. </head>
  116. <body>
  117. <form action="" method="post" id="f1" style="width: 1620px;">
  118. <div class="panelcontainer" style="width: 1620px;">
  119. <div
  120. style="float: left; line-height: 39px; margin-left: 20px; width: 80px;">
  121. <input type="button" value="保存" onClick="gosave()" />
  122. </div>
  123. <div
  124. style="float: left; line-height: 39px; margin-left: 20px; width: 80px;">
  125. <input type="button" value=" 返回" onClick="goback()" />
  126. </div>
  127. </div>
  128. <s:hidden id="pid" name="pid"></s:hidden>
  129. <s:hidden id="wpid" name="wpid"></s:hidden>
  130. <s:hidden id="pjid" name="pjid"></s:hidden>
  131. <s:hidden id="lnid" name="lnid"></s:hidden>
  132. <s:hidden id="tid" name="tid"></s:hidden>
  133. <s:hidden id="year" name="year"></s:hidden>
  134. <table id='gridTable' >
  135. </table>
  136. <div id='gridPager'></div>
  137. </form>
  138. </body>