GTViewGarde.js 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. function reload() {
  2. $("#display_search_list").css('display', 'none');
  3. var userID = $("#UserID").val();
  4. $.post(CMS_SystemConfig.VirtualDirectoryPath + '/PersonalScore/NewCoursematerialList', { userID: userID }, function (data) {
  5. if (data.length > 0) {
  6. var count = data[0].ListStarttermID.length;
  7. var width = " 20%";
  8. var a = "100%";
  9. if (count > 5) {
  10. var height = 0;
  11. a = 100 + (count - 5) * 20;
  12. width = 100 / count + "%";
  13. }
  14. $("#search_list").html("");
  15. StudentCoursematerialtable(data[0]);
  16. var html = "<div id='divScroll' style='width: " + a + "%'>";
  17. for (var i = 0; i < data[0].ListStarttermID.length; i++) {
  18. //PS:同一课程、可能开课学期不同~
  19. var listCourseGradeView = $.grep(data[0].ListCourseGradeView, function (x) { return (x.StarttermID == data[0].ListStarttermID[i]); });
  20. html += "<table cellpadding='0' cellspacing='0' style='width: " + width + "; margin-bottom: 5px; float:left;' class='Coursematerialtable'>";
  21. html += "<tr>";
  22. html += "<td align='center' colspan='3' style='background-color: #F0F0F0'>" + listCourseGradeView[0].StarttermName + "</td>";
  23. html += "</tr>";
  24. html += "<tr>";
  25. html += "<td align='center' style='background-color: #F0F0F0'>课程名称</td>";
  26. html += "<td align='center' style='background-color: #F0F0F0'>总成绩</td>";
  27. html += "<td align='center' style='background-color: #F0F0F0'>学分</td>";
  28. html += "</tr>";
  29. for (var j = 0; j < listCourseGradeView.length; j++) {
  30. var color = "'" + listCourseGradeView[j].CourseTypeColour + "'"
  31. html += "<tr>";
  32. if (listCourseGradeView[j].Club == null) {
  33. html += "<td style='background-color:" + listCourseGradeView[j].CourseTypeColour + "'" + " align=\"center\"><a href=\"#this\" onclick=\"return LoadScore('" + listCourseGradeView[j].CoursematerialID + "','" + data[0].ListStarttermID[i] + "','" + listCourseGradeView[j].UserID + "');\"><font color=blue>" + listCourseGradeView[j].CourseName + "</font></a></td>";
  34. } else {
  35. html += "<td style='background-color:#32CD32' align=\"center\"><a href=\"#this\" onclick=\"return LoadScore('" + listCourseGradeView[j].CoursematerialID + "','" + listCourseGradeView[j].SchoolyearID + "','" + listCourseGradeView[j].UserID + "','" + data[0].ListStarttermID[i] + "');\"><font color=blue>" + listCourseGradeView[j].CourseName + "</font></a></td>";
  36. }
  37. if (listCourseGradeView[j].TotalScore < 60 || listCourseGradeView[j].TotalScore == "")
  38. html += "<td align='center' style='color:Red'>" + listCourseGradeView[j].TotalScoreStr + "</td>";
  39. else
  40. html += "<td align='center' >" + listCourseGradeView[j].TotalScoreStr + "</td>";
  41. html += "<td align='center'>" + isEmpty(listCourseGradeView[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. function StudentCoursematerialtable(data) {
  57. if (data != null) {
  58. //$("#StudentCoursematerialtable").find("tr.row").remove();
  59. var html = "";
  60. html += "<label><b>姓名:</b></label>";
  61. html += "&nbsp<label><b>" + data.UserName + "</b></label>";
  62. html += "&nbsp&nbsp<label><b>院系所:</b></label>";
  63. html += "&nbsp<label><b>" + data.CollegeName + "</b></label>";
  64. html += "&nbsp&nbsp<label><b>班级名称:</b></label>";
  65. html += "&nbsp<label><b>" + data.ClassName + "</b></label>";
  66. html += "&nbsp&nbsp<label><b>毕业时间:</b></label>";
  67. html += "<label><b>" + (data.PlanningGraduateDate == null ? "" : ChangeDateFormat(data.PlanningGraduateDate)) + "</b></label>";
  68. var html1 = "";
  69. html1 += "<label><b>门数:</b></label>";
  70. html1 += "&nbsp<label><b>" + data.CoursematerialCount + "</b></label>";
  71. html1 += "&nbsp&nbsp<label'><b>平均成绩:</b></label>";
  72. html1 += "&nbsp<label><b>" + (data.AVGScore == null ? 0 : data.AVGScore.toFixed(1)) + "</b></label>";
  73. html1 += "&nbsp&nbsp<label><b>总学分:</b></label>";
  74. html1 += "&nbsp<label><b>" + (data.TotalCredit == null ? 0 : data.TotalCredit.toFixed(1)) + "</b></label>";
  75. html1 += "&nbsp&nbsp<label><b>必修:</b></label>";
  76. html1 += "&nbsp<label><b>" + (data.RequiredCredit == null ? 0 : data.RequiredCredit.toFixed(1)) + "</b></label>";
  77. html1 += "&nbsp&nbsp<label><b>限选(含通识教育):</b></label>";
  78. html1 += "&nbsp<label><b>" + (data.OptionalCourseCredit == null ? 0 : data.OptionalCourseCredit.toFixed(1)) + "</b></label>";
  79. html1 += "&nbsp&nbsp<label><b>任选:</b></label>";
  80. html1 += "&nbsp<label><b>" + (data.FreeSelectionCourseCredit == null ? 0 : data.FreeSelectionCourseCredit.toFixed(1)) + "</b></label>";
  81. html1 += "&nbsp&nbsp<label><b>方向选修:</b></label>";
  82. html1 += "&nbsp<label><b>" + (data.ElectiveCredit == null ? 0 : data.ElectiveCredit.toFixed(1)) + "</b></label>";
  83. html1 += "&nbsp&nbsp<label><b>公共选修:</b></label>";
  84. html1 += "&nbsp<label><b>" + (data.ElectivePublicCredit == null ? 0 : data.ElectivePublicCredit.toFixed(1)) + "</b></label>";
  85. html1 += "&nbsp&nbsp<label><b>实践环节:</b></label>";
  86. html1 += "&nbsp<label><b>" + (data.PractiseNotCredit == null ? 0 : data.PractiseNotCredit.toFixed(1)) + "</b></label>";
  87. html1 += "&nbsp&nbsp<label><b>俱乐部(含校本):</b></label>";
  88. html1 += "&nbsp<label><b>" + (data.ClubWithSchoolbasedCredit == null ? 0 : data.ClubWithSchoolbasedCredit.toFixed(1)) + "</b></label>";
  89. $("#Studenttable").html(html);
  90. $("#StudentCoursematerialtable").html(html1);
  91. }
  92. else {
  93. $("#Studenttable").html("");
  94. $("#StudentCoursematerialtable").html("");
  95. }
  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 isEmpty(val) {
  115. switch (typeof (val)) {
  116. case 'string':
  117. return trim(val).length == 0 ? 0 : val;
  118. break;
  119. case 'number':
  120. return val == 0 ? 0 : val;
  121. break;
  122. case 'object':
  123. return val == null ? 0 : val;
  124. break;
  125. case 'array':
  126. return val.length == 0 ? 0 : val;
  127. break;
  128. default:
  129. return true;
  130. }
  131. };
  132. //列表字体颜色设置为红色
  133. function SetRedColumn(index, row, value) {
  134. return " <span style=\"color: red;\">" + value + "</span>";
  135. }