StudentScoreList.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. var mnu = "";
  2. //加载
  3. $(function () {
  4. mnu = $.SystemGeneral.getUrlParam("MNU");
  5. reload();
  6. })
  7. function reload() {
  8. $("#display_search_list").css('display', 'none');
  9. $.post(CMS_SystemConfig.VirtualDirectoryPath + '/SOCDetailScore/StudentCoursematerialList', null, function (data) {
  10. if (data.length > 0) {
  11. var count = data[0].ListStarttermID.length;
  12. var width = " 20%";
  13. var a = "100%";
  14. if (count > 5) {
  15. var height = 0;
  16. a = (100 + (count - 5) * 20).toString() + "%";
  17. width = 100 / count + "%";
  18. }
  19. $("#search_list").html("");
  20. StudentCoursematerialtable(data[0]);
  21. var html = "<div id='divScroll' style='width: " + a + "%'>";
  22. for (var i = 0; i < data[0].ListStarttermID.length; i++) {
  23. //PS:同一课程、可能开课学期不同~
  24. var socStudentScoreItemViewList = $.grep(data[0].SOCStudentScoreItemViewList, function (x) { return (x.StarttermID == data[0].ListStarttermID[i]); });
  25. html += "<table cellpadding='0' cellspacing='0' style='width: " + width + "; margin-bottom: 5px; float:left;' class='Coursematerialtable'>";
  26. html += "<tr>";
  27. html += "<td align='center' colspan='3' style='background-color: #F0F0F0'>" + socStudentScoreItemViewList[0].StarttermName + "</td>";
  28. html += "</tr>";
  29. html += "<tr>";
  30. html += "<td align='center' style='background-color: #F0F0F0'>课程名称</td>";
  31. html += "<td align='center' style='background-color: #F0F0F0'>总成绩</td>";
  32. html += "<td align='center' style='background-color: #F0F0F0'>学分</td>";
  33. html += "</tr>";
  34. for (var j = 0; j < socStudentScoreItemViewList.length; j++) {
  35. html += "<tr>";
  36. html += "<td align=\"center\"><a href=\"#this\" onclick=\"return LoadScore('" + socStudentScoreItemViewList[j].CoursematerialID + "','" + socStudentScoreItemViewList[j].SchoolyearID + "','" + data[0].ListStarttermID[i] + "');\"><font color=blue>" + socStudentScoreItemViewList[j].CourseName + "</font></a></td>";
  37. if (socStudentScoreItemViewList[j].TotalScore < 60 || socStudentScoreItemViewList[j].TotalScore == "")
  38. html += "<td align='center' style='color:Red'>" + socStudentScoreItemViewList[j].TotalScore.toFixed(scoreDigitCount) + "</td>";
  39. else
  40. html += "<td align='center' >" + socStudentScoreItemViewList[j].TotalScore.toFixed(scoreDigitCount) + "</td>";
  41. html += "<td align='center'>" + isEmpty(socStudentScoreItemViewList[j].ScoreCredit) + "</td>";
  42. html += "</tr>";
  43. }
  44. html += "</table>";
  45. }
  46. html += "</div>";
  47. $("#search_list").html(html);
  48. }
  49. else {
  50. StudentCoursematerialtable(data[0]);
  51. var html = " <p style='color:Red;'>选择的学生成绩库中无成绩,请检查。</p>"
  52. $("#search_list").html(html);
  53. }
  54. });
  55. }
  56. //验证是否为空。
  57. function isEmpty(val) {
  58. switch (typeof (val)) {
  59. case 'string':
  60. return trim(val).length == 0 ? 0 : val;
  61. break;
  62. case 'number':
  63. return val == 0 ? 0 : val;
  64. break;
  65. case 'object':
  66. return val == null ? 0 : val;
  67. break;
  68. case 'array':
  69. return val.length == 0 ? 0 : val;
  70. break;
  71. default:
  72. return true;
  73. }
  74. };
  75. function StudentCoursematerialtable(data) {
  76. if (data != null) {
  77. //$("#StudentCoursematerialtable").find("tr.row").remove();
  78. var html = "";
  79. html += "<label><b>姓名:</b></label>";
  80. html += "&nbsp<label><b>" + data.UserName + "</b></label>";
  81. html += "&nbsp&nbsp<label><b>院系所:</b></label>";
  82. html += "&nbsp<label><b>" + data.CollegeName + "</b></label>";
  83. html += "&nbsp&nbsp<label><b>班级名称:</b></label>";
  84. html += "&nbsp<label><b>" + data.ClassName + "</b></label>";
  85. html += "&nbsp&nbsp<label><b>毕业时间:</b></label>";
  86. html += "<label><b>" + (data.PlanningGraduateDate == null ? "" : ChangeDateFormat(data.PlanningGraduateDate)) + "</b></label>";
  87. $("#StudentCoursematerialtable").html(html);
  88. }
  89. else {
  90. $("#StudentCoursematerialtable").html("");
  91. }
  92. }
  93. function LoadScore(CoursematerialID, SchoolyearID, StarttermID) {
  94. $("#display_search_list").css('display', 'block');
  95. $("#dgStudentDetailScoreList").cmsXDataTable("load", { coursematerialID: CoursematerialID, starttermID: StarttermID });
  96. }
  97. //转化json数据的日期
  98. function ChangeDateFormat(jsondate) {
  99. jsondate = jsondate.replace("/Date(", "").replace(")/", "");
  100. if (jsondate.indexOf("+") > 0) {
  101. jsondate = jsondate.substring(0, jsondate.indexOf("+"));
  102. } else if (jsondate.indexOf("-") > 0) {
  103. jsondate = jsondate.substring(0, jsondate.indexOf("-"));
  104. }
  105. //alert(jsondate);
  106. var date = new Date(parseInt(jsondate, 10));
  107. //alert(date.getHours());
  108. var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
  109. var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
  110. //+ " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds(); 时分秒就不需要了~~
  111. return date.getFullYear() + "-" + month + "-" + currentDate;
  112. }
  113. //列表字体颜色设置为红色
  114. function SetRedColumn(index, row, value) {
  115. return " <span style=\"color: red;\">" + value + "</span>";
  116. }