Commit 892c3766d8045bf1032fbd47029241bf2e5bfff6

Authored by =
1 parent 92b276f8

1、增加练习报表页面

WebRoot/WEB-INF/jsp/sunvote/homework/homework_report.jsp 0 → 100644
  1 +<%@ page language="java" contentType="text/html; charset=UTF-8"
  2 + pageEncoding="UTF-8"%>
  3 +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
  4 +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
  5 +<%
  6 + String path = request.getContextPath();
  7 + String basePath = request.getScheme() + "://"
  8 + + request.getServerName() + ":" + request.getServerPort()
  9 + + path + "/";
  10 +%>
  11 +
  12 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  13 +<html>
  14 +<head>
  15 +<base href="<%=basePath%>">
  16 +
  17 +<title>${info.CLASS_NAME}成绩报表</title>
  18 +<base href="<%=basePath%>">
  19 +<!-- 下拉框 -->
  20 +<link rel="stylesheet" href="static/ace/css/chosen.css" />
  21 + <link type="text/css" href="static/css/tablescroller.css" rel="stylesheet" />
  22 +<!-- jsp文件头和头部 -->
  23 +<%@ include file="../../system/index/top.jsp"%>
  24 +<!-- 日期框 -->
  25 +<link rel="stylesheet" href="static/ace/css/datepicker.css" />
  26 +<style>
  27 + .font span{ font-size: 12px;
  28 + font-weight: initial;color:#000;}
  29 + </style>
  30 +</head>
  31 +
  32 +<body style="background:#fff;">
  33 + <div style="padding:20px 20px;">
  34 + <form action="report/report.do" method="post" name="Form" id="Form" style="margin-bottom:0;">
  35 + <input type="hidden" name="CLASSID" id="CLASSID" value="${info.CLASS_ID}" />
  36 + <input type="hidden" name="ROLE" id="ROLE" value="${pd.ROLE}" />
  37 + <table style="margin-top:5px;margin-bottom:20px;">
  38 + <tr>
  39 + <td><div style="width:150px;text-align:center;">课程统计: ${info.testsize}</div></td>
  40 + <td><div style="width:150px;text-align:center;">班级名册: ${info.CLASS_NAME}</div></td>
  41 +
  42 + <td><div style="width:150px;text-align:center;"><span>学生人数: ${info.STUDENT_NUM}</span></div></td>
  43 + <td></td>
  44 + <c:if test="${not empty subjectInfos}">
  45 + <td>
  46 + <select class="chosen-select form-control" name="SUBJECT_ID" id="SUBJECT_ID" data-placeholder="这里输入所属学校">
  47 + <option value="">全部</option>
  48 + <c:forEach var="item" items="${subjectInfos}">
  49 + <option value="${item.SUBJECT_ID}" <c:if test="${pd.SUBJECT_ID == item.SUBJECT_ID }">selected = ture</c:if>>${item.SCNAME}</option>
  50 + </c:forEach>
  51 + </select>
  52 + </td>
  53 + </c:if>
  54 + <td style="padding-left:2px;">
  55 + <input
  56 + class="span10 date-picker" name="lastStart" id="lastStart"
  57 + value="${start_date}" type="text" data-date-format="yyyy-mm-dd"
  58 + readonly="readonly" style="width:88px;" placeholder="开始日期"
  59 + title="开始日期" />
  60 + </td>
  61 + <td style="padding-left:2px;"><input
  62 + class="span10 date-picker" name="lastEnd" id="lastEnd" value="${end_date}"
  63 + type="text" data-date-format="yyyy-mm-dd" readonly="readonly"
  64 + style="width:88px;" placeholder="结束日期" title="结束日期" /></td>
  65 + <td style="vertical-align:top;padding-left:2px"><a
  66 + class="btn btn-light btn-xs" onclick="tosearch();" title="检索"><i
  67 + id="nav-search-icon"
  68 + class="ace-icon fa fa-search bigger-110 nav-search-icon blue"></i></a></td>
  69 + </tr>
  70 + </table>
  71 + <table id="simple-table"
  72 + class="table table-striped table-bordered table-hover"
  73 + style="margin-top:0px;margin-bottom:0px;">
  74 + <thead>
  75 + <tr>
  76 + <th class="center th_name"><div style="width:150px;">姓名</div></th>
  77 + <th class="center "><div style="width:150px;">课程平均得分率</div></th>
  78 + <th class="center"><div style="width:80px;">课程总分</div></th>
  79 + <c:forEach items="${testpaperList}" var="var" varStatus="vs">
  80 + <th class="center kc"><a
  81 + onclick="paper('${info.CLASS_ID}','${var.TESTPAPER_ID}');"><div style="width:180px; margin: 0 auto;cursor:hand" class="font">${var.NAME}</br><span>${var.CREATE_DATE}</span></div></a></th>
  82 + </c:forEach>
  83 + </tr>
  84 + </thead>
  85 + <tbody>
  86 + <tr>
  87 + <td class="center"><div style="width:150px;">班级课程总分</div></td>
  88 + <td class="center"><div style="width:150px;"></div></td>
  89 + <td class="center"><div style="width:80px;"></div></td>
  90 + <c:forEach items="${testpaperList}" var="var" varStatus="vs">
  91 + <td class="center"><div style="width:80px;margin:0 auto;">${var.TOTAL_SCORE}</div></td>
  92 + </c:forEach>
  93 + </tr>
  94 + <tr>
  95 + <td class="center"><div style="width:150px;">班级课程平均分</div></td>
  96 + <td class="center"><div style="width:150px;"></div></td>
  97 + <td class="center"><div style="width:80px;"></div></td>
  98 + <c:forEach items="${testpaperList}" var="var" varStatus="vs">
  99 + <td class="center"><div style="width:80px;margin:0 auto;">${var.AVG_SCORE}</div></td>
  100 + </c:forEach>
  101 + </tr>
  102 + <tr>
  103 + <td class="center"><div style="width:150px;">班级课程平均得分率</div></td>
  104 + <td class="center"><div style="width:150px;"></div></td>
  105 + <td class="center"><div style="width:80px;"></div></td>
  106 + <c:forEach items="${testpaperList}" var="var" varStatus="vs">
  107 + <td class="center"><div style="width:80px;margin:0 auto;"><fmt:formatNumber type="number"
  108 + value="${var.TOTAL_SCORE == 0 ? 0: (var.AVG_SCORE / var.TOTAL_SCORE * 100)}"
  109 + maxFractionDigits="2" />%</div></td>
  110 + </c:forEach>
  111 + </tr>
  112 +
  113 + <c:choose>
  114 + <c:when test="${not empty studentList}">
  115 + <c:forEach items="${studentList}" var="var" varStatus="vs">
  116 + <tr>
  117 + <%-- <td class="center"><a
  118 + href="report/student_report?studentid=${var.ID}&class_id=${info.CLASS_ID}">${var.NAME}</a>
  119 + </td> --%>
  120 + <td class="center"><div style="width:150px;cursor:hand"><a
  121 + onclick="student('${info.CLASS_ID}','${var.STUDENT_ID}')">${var.NAME}</a></div>
  122 + </td>
  123 + <td class="center"><div style="width:150px;"><fmt:formatNumber type="number"
  124 + value="${var.TOTALSCORE == 0 ? 0: (var.GETSCORE / var.TOTALSCORE * 100)}"
  125 + maxFractionDigits="2" />%</div></td>
  126 + <td class="center"><div style="width:80px;margin:0 auto;">${var.GETSCORE }</div></td>
  127 + <c:forEach items="${testpaperList}" var="var1" varStatus="vs1">
  128 + <td class="center"><div style="width:180px;margin:0 auto;"><c:set var="TEST_ID"
  129 + value="${var1.TESTPAPER_ID}" /> ${var[TEST_ID] }</div></td>
  130 + </c:forEach>
  131 + </tr>
  132 + </c:forEach>
  133 + </c:when>
  134 + </c:choose>
  135 + </tbody>
  136 + </table>
  137 + <div id="scrollableTable"></div>
  138 + </form>
  139 + </div>
  140 +
  141 + <%@ include file="../../system/index/foot.jsp"%>
  142 + <script src="static/ace/js/bootbox.js"></script>
  143 + <!-- ace scripts -->
  144 + <script src="static/ace/js/ace/ace.js"></script>
  145 + <!-- 下拉框 -->
  146 + <script src="static/ace/js/chosen.jquery.js"></script>
  147 + <!-- 日期框 -->
  148 + <script src="static/ace/js/date-time/bootstrap-datepicker.js"></script>
  149 + <!--提示框-->
  150 + <script type="text/javascript" src="static/js/jquery.tips.js"></script>
  151 +
  152 + <script language="javascript" src="static/js/tablescroller.js"></script>
  153 + <script language="javascript" src="static/js/tablescroller.jquery.js"></script>
  154 +
  155 +
  156 +
  157 + <script type="text/javascript">
  158 + $(function() {
  159 +
  160 + //日期框
  161 + $('.date-picker').datepicker({
  162 + autoclose : true,
  163 + todayHighlight : true
  164 + });
  165 +
  166 + //下拉框
  167 + if (!ace.vars['touch']) {
  168 + $('.chosen-select').chosen({
  169 + allow_single_deselect : true
  170 + });
  171 + $(window).off('resize.chosen').on('resize.chosen', function() {
  172 + $('.chosen-select').each(function() {
  173 + var $this = $(this);
  174 + $this.next().css({
  175 + 'width' : $this.parent().width()
  176 + });
  177 + });
  178 + }).trigger('resize.chosen');
  179 + $(document).on('settings.ace.chosen',
  180 + function(e, event_name, event_val) {
  181 + if (event_name != 'sidebar_collapsed')
  182 + return;
  183 + $('.chosen-select').each(function() {
  184 + var $this = $(this);
  185 + $this.next().css({
  186 + 'width' : $this.parent().width()
  187 + });
  188 + });
  189 + });
  190 + $('#chosen-multiple-style .btn').on(
  191 + 'click',
  192 + function(e) {
  193 + var target = $(this).find('input[type=radio]');
  194 + var which = parseInt(target.val());
  195 + if (which == 2)
  196 + $('#form-field-select-4').addClass(
  197 + 'tag-input-style');
  198 + else
  199 + $('#form-field-select-4').removeClass(
  200 + 'tag-input-style');
  201 + });
  202 + }
  203 +
  204 + //复选框全选控制
  205 + var active_class = 'active';
  206 + $('#simple-table > thead > tr > th input[type=checkbox]').eq(0).on(
  207 + 'click',
  208 + function() {
  209 + var th_checked = this.checked;//checkbox inside "TH" table header
  210 + $(this).closest('table').find('tbody > tr').each(
  211 + function() {
  212 + var row = this;
  213 + if (th_checked)
  214 + $(row).addClass(active_class).find(
  215 + 'input[type=checkbox]').eq(0)
  216 + .prop('checked', true);
  217 + else
  218 + $(row).removeClass(active_class).find(
  219 + 'input[type=checkbox]').eq(0)
  220 + .prop('checked', false);
  221 + });
  222 + });
  223 + });
  224 +
  225 + var role = '${pd.ROLE}';
  226 +
  227 + function precent(avg,total){
  228 + if(total == 0){
  229 + return "0%"
  230 + }
  231 + return Math.round(avg / total * 100)/100 + '%' ;
  232 + }
  233 +
  234 + function tosearch(){
  235 + var url = "<%=basePath%>report/report.do?classid=${info.CLASS_ID}" ;
  236 + var startDate = $("#lastStart").val();
  237 + var endDate = $("#lastEnd").val();
  238 + var subject_id = $("#SUBJECT_ID").val();
  239 + url = url + "&start_date=" + startDate ;
  240 + if(endDate != null){
  241 + url = url + "&end_date=" + endDate;
  242 + }
  243 + if(subject_id != null){
  244 + url = url + "&SUBJECT_ID=" + subject_id;
  245 + }
  246 + if(role == "admin"){
  247 + url = url + "&ROLE=admin" ;
  248 + }
  249 + window.location.href = url;
  250 + window.top.loading.show();
  251 + /* $("#Form").sumbit(); */
  252 + }
  253 +
  254 + function student(classid,studentid){
  255 +
  256 + var url = "<%=basePath%>report/student_report?studentid=" + studentid + "&class_id=" + classid ;
  257 + var startDate = $("#lastStart").val();
  258 + var endDate = $("#lastEnd").val();
  259 + url = url + "&start_date=" + startDate + "&end_date=" + endDate ;
  260 + var SUBJECT_ID = $("#SUBJECT_ID").val();
  261 + if(SUBJECT_ID != null && SUBJECT_ID != ''){
  262 + url = url + "&SUBJECT_ID="+ SUBJECT_ID ;
  263 + }
  264 + window.self.location.href = url;
  265 + window.top.loading.show();
  266 + }
  267 +
  268 + function paper(class_id,testpaper_id){
  269 + var url = "<%=basePath%>report/test_report?TestID=" + testpaper_id + "&class_id=" + class_id;
  270 + var startDate = $("#lastStart").val();
  271 + var endDate = $("#lastEnd").val();
  272 + url = url + "&start_date=" + startDate + "&end_date=" + endDate ;
  273 + window.self.location.href = url;
  274 + window.top.loading.show();
  275 + }
  276 +
  277 + $(document).ready(function(){
  278 + window.top.loading.remove();
  279 +
  280 + var sour = "${testpaperList}";
  281 +
  282 + if(sour != null && sour.length > 3){
  283 + var _width = $('#mainFrame', parent.document).width()-40;
  284 + var _heigh = $('#mainFrame', parent.document).height()-100;
  285 + var options = {
  286 + width: _width,
  287 + height: _heigh,
  288 + pinnedRows: 4,
  289 + pinnedCols: 3,
  290 + container: "#scrollableTable",
  291 + removeOriginal: true
  292 + };
  293 + $("#simple-table").tablescroller(options);
  294 + var name_height = $(".kc").last().parent().height()-18.5;
  295 + console.log(name_height);
  296 + $(".th_name").height(name_height);
  297 + }
  298 +
  299 + });
  300 +
  301 + </script>
  302 +
  303 +</body>
  304 +</html>
... ...
WebRoot/WEB-INF/jsp/sunvote/teacher/teacher_main.jsp
... ... @@ -106,7 +106,7 @@
106 106 <p id="practice_do" onclick="event.stopPropagation();homeWork('${SCHOOL_ID}')">布置练习</p>
107 107 </li>
108 108 <li>
109   - <p id="practice_report">练习报表</p>
  109 + <p id="practice_report" onclick="event.stopPropagation();homeReport('${SCHOOL_ID}')">练习报表</p>
110 110 </li>
111 111 </ul>
112 112 </div>
... ... @@ -193,6 +193,13 @@
193 193 window.top.loading.show();
194 194 }
195 195  
  196 + function homeReport(schoolId){
  197 + var path = '<%=basePath%>homework/report.do?teacher_id=${pd.TEACHER.ID}&ID=' + schoolId ;
  198 +
  199 + $("#mainFrame").attr('src',path);
  200 + window.top.loading.show();
  201 + }
  202 +
196 203 function report(classId){
197 204 //window.open('<%=basePath%>report/report.do?classid=' + classId);
198 205 //if($("#mainFrame").attr('src') != ('<%=basePath%>report/report.do?classid=' + classId)){
... ...
src/com/fh/controller/sunvote/homework/HomeworkController.java
... ... @@ -202,7 +202,7 @@ public class HomeworkController extends BaseController {
202 202 }
203 203  
204 204 /**
205   - * 去修改页面
  205 + * 去预览页面
206 206 *
207 207 * @param
208 208 * @throws Exception
... ... @@ -221,6 +221,27 @@ public class HomeworkController extends BaseController {
221 221 mv.addObject("pd", pd);
222 222 return mv;
223 223 }
  224 +
  225 + /**
  226 + * 去查看报表页面
  227 + *
  228 + * @param
  229 + * @throws Exception
  230 + */
  231 + @RequestMapping(value = "/report")
  232 + public ModelAndView report() throws Exception {
  233 + ModelAndView mv = this.getModelAndView();
  234 + PageData pd = new PageData();
  235 + pd = this.getPageData();
  236 + pd = homeworkService.findById(pd); // 根据ID读取
  237 + pd.put("QUESTIONS", homeworkproblemService.listProblem(pd));
  238 + pd.put("TEACHER_ID", geTeacherID());
  239 + mv.setViewName("sunvote/homework/homework_report");
  240 + mv.addObject("msg", "edit");
  241 + mv.addObject("operation", "view");
  242 + mv.addObject("pd", pd);
  243 + return mv;
  244 + }
224 245  
225 246 /**
226 247 * 批量删除
... ...