gamonthmr.jsp 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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 array1 = [];
  21. var array2 = [];
  22. var state=true;
  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(8).find("input").val();
  27. var tempName = $(this).find("td").eq(9).find("input").val();
  28. // 为空判断
  29. tempVal = tempVal.replace(/\s+/g, "");
  30. if(tempVal==""){
  31. $(this).find("td").eq(8).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(8).find("input").css({"background-color":"red"});
  39. alert("分数必须为数字");
  40. state=false;
  41. return false;
  42. }
  43. // 超过最大值
  44. var temp=$(this).find("td").eq(7).text();
  45. if(!isNaN(tempVal) && !isNaN(temp)){
  46. if(parseFloat(tempVal)>parseFloat(temp))
  47. {
  48. $(this).find("td").eq(8).find("input").css({"background-color":"red"});
  49. alert("分数不能超过满分");
  50. state=false;
  51. return false;
  52. }
  53. }
  54. array1.push(tempid+"/"+tempVal);
  55. array2.push(tempid+"/"+tempName);
  56. }
  57. });
  58. if(state)
  59. {
  60. var temp="/gradeassess/batchMeasurerecordSave.action?ids="+array1+"&idname="+array2+"&pid="+pid;
  61. var url= encodeURI(encodeURI(temp));
  62. $.ajax({
  63. type: "POST",
  64. url: url,
  65. dataType:"json",
  66. complete:function (XMLHttpRequest, textStatus) {
  67. queryApData();
  68. alert('保存成功');
  69. }
  70. });
  71. }
  72. }
  73. function goback() {
  74. $("#f1").attr("action", "/gradeassess/gamonthindex.action").submit();
  75. }
  76. function queryApData() {
  77. $("#gridTable").jqGrid('GridUnload');
  78. showJqGrid();
  79. }
  80. function showJqGrid() {
  81. var pid = $("#pid").val();
  82. jQuery("#gridTable").jqGrid({
  83. url:'gamonthmrlist.action?pid=' + pid,
  84. mtype:'POST',
  85. datatype: "json",
  86. colNames:['编号','名称','类别', '计算公式','计算值','权重公式','得分','上限值','下限值','满分','修改得分','描述'],
  87. colModel:[
  88. { name: 'id', index: 'id', width: 130, align: 'center',hidden:true},
  89. { name: 'name', index: 'name', width: 150, align: 'center'},
  90. { name: 'typeobj', index: 'typeobj', width: 100, align: 'center'},
  91. { name: 'formuls', index: 'formuls', width: 600, align: 'center'},
  92. { name: 'calculatevalue', index: 'calculatevalue', width: 150, align: 'center'},
  93. { name: 'formula', index: 'formula', width: 300, align: 'center'},
  94. { name: 'score', index: 'score', width: 100, align: 'center'},
  95. { name: 'valueh', index: 'valueh', width: 100, align: 'center'},
  96. { name: 'valuel', index: 'valuel', width: 100, align: 'center'},
  97. { name: 'wvalue', index: 'wvalue', width: 100, align: 'center'},
  98. { name: 'modscore', index: 'modscore', width: 100, align: 'center',editable : true},
  99. { name: 'description', index: 'description', width: 400, align: 'center',editable : true}
  100. ],
  101. rowNum:1000,
  102. height:'auto',
  103. width:'auto',
  104. autowidth: true,
  105. sortorder: "desc",
  106. caption: "月定量分析指标",
  107. pager: '#gridPager',
  108. viewrecords: true,
  109. afterInsertRow:function(rowid,rowdata,rowelem){
  110. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{id:rowdata.id});
  111. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{name:rowdata.name});
  112. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{typeobj:rowdata.typeobj});
  113. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{formuls:rowdata.formuls});
  114. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{calculatevalue:rowdata.calculatevalue});
  115. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{formula:rowdata.formula});
  116. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{score:rowdata.score});
  117. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{valueh:rowdata.valueh});
  118. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{valuel:rowdata.valuel});
  119. jQuery("#gridTable").jqGrid('setRowData',rowdata.id,{wvalue:rowdata.wvalue});
  120. jQuery("#gridTable").jqGrid('editRow', rowdata.id,{modscore:rowdata.modscore});
  121. jQuery("#gridTable").jqGrid('editRow', rowdata.id,{description:rowdata.description});
  122. }
  123. });
  124. }
  125. </script>
  126. </head>
  127. <body>
  128. <form action="" method="post" id="f1" style="width: 1620px;">
  129. <div class="panelcontainer" style="width: 1620px;">
  130. <div
  131. style="float: left; line-height: 39px; margin-left: 20px; width: 80px;">
  132. <input type="button" value="保存" onClick="gosave()" />
  133. </div>
  134. <div
  135. style="float: left; line-height: 39px; margin-left: 20px; width: 80px;">
  136. <input type="button" value=" 返回" onClick="goback()" />
  137. </div>
  138. </div>
  139. <s:hidden id="pid" name="pid"></s:hidden>
  140. <s:hidden id="wpid" name="wpid"></s:hidden>
  141. <s:hidden id="pjid" name="pjid"></s:hidden>
  142. <s:hidden id="lnid" name="lnid"></s:hidden>
  143. <s:hidden id="tid" name="tid"></s:hidden>
  144. <s:hidden id="year" name="year"></s:hidden>
  145. <s:hidden id="month" name="month"></s:hidden>
  146. <table id='gridTable' >
  147. </table>
  148. <div id='gridPager'></div>
  149. </form>
  150. </body>