SpecialityScoreSum.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. var isFirstLoadGradeYear = true;
  2. var isFirstLoadClassmajor = true;
  3. var isPageLoad = true;
  4. function SpecialityScoreSumTable() {
  5. var collegeID = $("#CollegeDropdown").combobox("getValue");
  6. var standardID = $("#DictionaryStandard").combogridX("getValue");
  7. var classmajorID = $("#ClassmajorDropdown").combogridX("getValue");
  8. var yearID = $("#DictionarySchoolyear").combobox("getValue");
  9. var schoolyearNumID = $("#DictionarySchoolyearNum").combobox("getValue");
  10. var schoolcodeID = $("#DictionarySchoolcode").combobox("getValue");
  11. var InSchoolStatus = $("#InSchoolStatusDictionaryDropDown").combobox("getValue");
  12. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/SpecialityScoreSum/SpecialityScoreSumList', { collegeID: collegeID, standardID: standardID, classmajorID: classmajorID, yearID: yearID, schoolyearNumID: schoolyearNumID, schoolcodeID: schoolcodeID, InSchoolStatus: InSchoolStatus },
  13. function (data) {
  14. $("#SpecialityScoreSumtable").find("tr.row").remove();
  15. if (data) {
  16. var d = [];
  17. var firstRow = [];
  18. var secondRow = [];
  19. var thirdRow = [];
  20. var forthRow = [];
  21. var detailRow = [];
  22. //生成第一、二、三行表头,学年和学期和课程
  23. //第一行开头
  24. firstRow.push("<tr style='background-color:#f0f0f0'>");
  25. firstRow.push("<td colspan='3' rowspan='2'>学期</td>");
  26. //第二行开头
  27. secondRow.push("<tr style='background-color:#f0f0f0'>");
  28. //第三行开头
  29. thirdRow.push("<tr style='background-color:#f0f0f0'>");
  30. thirdRow.push("<td width='20'>次序</td>");
  31. thirdRow.push("<td width='120'>学号</td>");
  32. thirdRow.push("<td width='60'>姓名</td>");
  33. for (var i = 0; i < data.StudentList.length; i++) {
  34. var student = data.StudentList[i];
  35. forthRow[i] = [];
  36. forthRow[i].push("<tr>");
  37. forthRow[i].push("<td width='20'>" + (i + 1).toString() + "</td>");
  38. forthRow[i].push("<td width='120'>" + student.LoginID + "</td>");
  39. forthRow[i].push("<td width='60'>" + student.UserName + "</td>");
  40. }
  41. var totalWidth = 206;
  42. //前三行明细
  43. for (var i = 0; i < data.SchoolyearNums.length; i++) {
  44. var schoolyearWidth = data.SchoolyearNums[i].CoursematerialNum * 22;
  45. totalWidth += schoolyearWidth + 2;
  46. firstRow.push("<td width='" + (schoolyearWidth - 2).toString() + "' colspan='" + data.SchoolyearNums[i].CoursematerialNum + "'>" + data.SchoolyearNums[i].Title + "</td>");
  47. var schoolyearNum = data.SchoolyearNums[i];
  48. for (var j = 0; j < schoolyearNum.SchoolCodeView.length; j++) {
  49. var schoolcode = schoolyearNum.SchoolCodeView[j];
  50. var schoolcodeWidth = schoolcode.CoursematerialList.length * 22;
  51. secondRow.push("<td width='" + (schoolcodeWidth - 2).toString() + "' colspan='" + schoolcode.CoursematerialList.length + "'>" + schoolcode.Title + "</td>");
  52. for (var k = 0; k < schoolcode.CoursematerialList.length; k++) {
  53. var coursematerial = schoolcode.CoursematerialList[k];
  54. //thirdRow.push("<td width='20' style='word-break: break-all;'>" + coursematerial.Title.substring(0, 12).split('').join('<br/>') + "</td>");
  55. if (coursematerial.Title.length <= 12) {
  56. thirdRow.push("<td width='20' style='word-break: break-all;'>" + coursematerial.Title.split('').join('<br/>') + "</td>");
  57. } else {
  58. var str = coursematerial.Title.substring(0, 12) + "...";
  59. thirdRow.push("<td width='20' style='word-break: break-all;'>" + str.split('').join('<br/>') + "</td>");
  60. }
  61. for (var l = 0; l < coursematerial.ScoreList.length; l++) {
  62. var score = coursematerial.ScoreList[l];
  63. var index = -1;
  64. for (var m = 0; m < data.StudentList.length; m++) {
  65. if (data.StudentList[m].UserID == score.UserID) {
  66. index = m;
  67. }
  68. }
  69. if (index < 0) continue;
  70. if (score.Score != null && score.Score != "") {
  71. if (score.Score >= 60)
  72. forthRow[index].push("<td width='20' style='word-break: break-all;'>" + score.Score + "</td>");
  73. else
  74. forthRow[index].push("<td width='20' style='color:red;word-break: break-all;'>" + score.Score + "</td>");
  75. }
  76. else if (score.Score == 0) {
  77. forthRow[index].push("<td width='20' style='color:red;word-break: break-all;'>" + score.Score + "</td>");
  78. //forthRow[index].push("<td style='width:20px;'>&nbsp;</td>");
  79. }
  80. else {
  81. forthRow[index].push("<td width='20' style='color:red;word-break: break-all;'>&nbsp;</td>");
  82. //forthRow[index].push("<td style='width:20px;'>&nbsp;</td>");
  83. }
  84. }
  85. }
  86. }
  87. }
  88. //第一行结尾
  89. firstRow.push("</tr>");
  90. //第二行结尾
  91. secondRow.push("</tr>");
  92. //第三行结尾
  93. thirdRow.push("</tr>");
  94. totalWidth += 16;
  95. d.push("<div style='overflow-x: hidden;width: " + totalWidth.toString() + "px;'><table cellpadding='0' cellspacing='0'>");
  96. d.push(firstRow.join(""));
  97. d.push(secondRow.join(""));
  98. d.push(thirdRow.join(""));
  99. d.push("</table></div>");
  100. d.push("<div id='divScore' style='height: 300px; overflow-x: auto; overflow-y: auto;width: " + totalWidth.toString() + "px;'><table cellpadding='0' cellspacing='0'>");
  101. for (var i = 0; i < data.StudentList.length; i++) {
  102. d.push(forthRow[i].join(""));
  103. d.push("</tr>");
  104. }
  105. d.push("</table></div>");
  106. $("#SpecialityScoreSumtable").html(d.join(""));
  107. resizeDiv();
  108. } else {
  109. $.messager.alert("系统提示", "对不起,未找到数据!");
  110. }
  111. });
  112. }
  113. function resizeDiv() {
  114. var scoreDiv = $("#divScore");
  115. var contentHeight = $(window).height() - $("#divScore").offset().top - 2;
  116. scoreDiv.height(contentHeight);
  117. }
  118. //个人成绩报表(松山、工大、科大等)
  119. function StudentScore_Report() {
  120. var classmajorID = $("#ClassmajorDropdown").combogridX("getValue");
  121. if (classmajorID == "") {
  122. $.messager.alert("系统提示", "请选择班级!");
  123. return;
  124. }
  125. var InSchoolStatus = $("#InSchoolStatusDictionaryDropDown").combobox("getValue");
  126. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/SpecialityScoreSum/StudentScoreReport?MNU=' + mnu
  127. + "&ClassmajorID=" + classmajorID + "&InSchoolStatus=" + InSchoolStatus;
  128. $.popupTopWindow('学生成绩表', redirectTo, 1100, 550, null, null);
  129. }
  130. //个人成绩报表(广体等)
  131. function StudentScore_NewReport() {
  132. var collegeID = $("#CollegeDropdown").combobox("getValue");
  133. var standardID = $("#DictionaryStandard").combogridX("getValue");
  134. var yearID = $("#DictionarySchoolyear").combobox("getValue");
  135. var schoolyearNumID = $("#DictionarySchoolyearNum").combobox("getValue");
  136. var schoolcodeID = $("#DictionarySchoolcode").combobox("getValue");
  137. var classmajorID = $("#ClassmajorDropdown").combogridX("getValue");
  138. if (classmajorID == "") {
  139. $.messager.alert("系统提示", "请选择班级!");
  140. return;
  141. }
  142. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/SpecialityScoreSum/StudentScoreNewReport?MNU=' + mnu
  143. + "&CollegeID=" + collegeID + "&StandardID=" + standardID + "&YearID=" + yearID
  144. + "&SchoolyearNumID=" + schoolyearNumID + "&SchoolcodeID=" + schoolcodeID + "&ClassmajorID=" + classmajorID;
  145. $.popupTopWindow('学生个人成绩报表', redirectTo, 850, 550, null, null);
  146. }
  147. function QueryCollegeDropdownList(data) {
  148. if (((data.length && data.length > 0) || data)
  149. && $("#DictionarySchoolyear").length > 0 && $.data($("#DictionarySchoolyear")[0], "combobox")) {
  150. var url = CMS_SystemConfig.VirtualDirectoryPath + "/Common/SchoolYearDropDown?bindType=2";
  151. $("#DictionarySchoolyear").combobox("reload", url);
  152. }
  153. }
  154. function QueryYearDropdownList(data) {
  155. if (((data.length && data.length > 0) || data)
  156. && $("#DictionaryStandard").length > 0 && $.data($("#DictionaryStandard")[0], "combogridX")) {
  157. reloadStandard();
  158. }
  159. }
  160. function reloadStandard() {
  161. var url = CMS_SystemConfig.VirtualDirectoryPath + "/Facultymajor/BindStandardDropDownList?bindType=0";
  162. var collegeID = $("#CollegeDropdown").combobox("getValue");
  163. if (collegeID != nonSelect) url += "&collegeID=" + collegeID;
  164. $("#DictionaryStandard").combobox("reload", url);
  165. }
  166. function QueryStandardComboGrid(data) {
  167. if (((data.length && data.length > 0) || data)
  168. && $("#ClassmajorDropdown").length > 0 && $.data($("#ClassmajorDropdown")[0], "combobox")) {
  169. reloadClassmajor();
  170. }
  171. }
  172. //function reloadClassmajor() {
  173. // var url = CMS_SystemConfig.VirtualDirectoryPath + "/Classmajor/BindDropdownList?bindType=2";
  174. // var college = $("#CollegeDropdown").combobox("getValue");
  175. // var year = $("#DictionarySchoolyear").combobox("getValue");
  176. // var standard = $("#DictionaryStandard").combobox("getValue");
  177. // if (college != nonSelect) url += "&collegeID=" + college;
  178. // if (year != nonSelect) url += "&schoolYear=" + year;
  179. // if (standard != nonSelect) url += "&standardID=" + standard;
  180. // $("#ClassmajorDropdown").combobox("clear");
  181. // $("#ClassmajorDropdown").combobox("reload", url);
  182. //}
  183. //function QueryClassmajorDropdownList(data) {
  184. // if (((data.length && data.length > 0) || data)) {
  185. // if (isFirstLoadClassmajor) {
  186. // isFirstLoadClassmajor = false;
  187. // } else if (!isPageLoad) {
  188. // if (data.length > 0) {
  189. // $("#ClassmajorDropdown").combobox("setValue", data[0].Value);
  190. // } else {
  191. // $("#ClassmajorDropdown").combobox("clear");
  192. // }
  193. // }
  194. // }
  195. //}
  196. function reload() {
  197. // var collegeID = $("#CollegeDropdown").combobox("getValue");
  198. // var classmajorID = $("#ClassmajorDropdown").combogridX("getValue");
  199. // var specialtyID = $("#DictionaryStandard").combogridX("getValue");
  200. // var schoolyear = $("#DictionarySchoolyear").combobox("getValue");
  201. // if (collegeID == "") {
  202. // $.messager.alert("系统提示", "请选择" + EMIS_CollegeLabel + "!");
  203. // return;
  204. // }
  205. // if (schoolyear == "-1") {
  206. // $.messager.alert("系统提示", "请选择年级!");
  207. // return;
  208. // }
  209. // if (specialtyID == "") {
  210. // $.messager.alert("系统提示", "请选择专业!");
  211. // return;
  212. // }
  213. // if (classmajorID == "") {
  214. // $.messager.alert("系统提示", "请选择班级!");
  215. // return;
  216. // }
  217. SpecialityScoreSumTable();
  218. }
  219. function getExcel() {
  220. var collegeID = $("#CollegeDropdown").combobox("getValue");
  221. var classmajorID = $("#ClassmajorDropdown").combogridX("getValue");
  222. var specialtyID = $("#DictionaryStandard").combogridX("getValue");
  223. var schoolyear = $("#DictionarySchoolyear").combobox("getValue");
  224. if (collegeID == "") {
  225. $.messager.alert("系统提示", "请选择" + EMIS_CollegeLabel + "!");
  226. return;
  227. }
  228. if (schoolyear == "-1") {
  229. $.messager.alert("系统提示", "请选择年级!");
  230. return;
  231. }
  232. if (specialtyID == "") {
  233. $.messager.alert("系统提示", "请选择专业!");
  234. return;
  235. }
  236. if (classmajorID == "") {
  237. $.messager.alert("系统提示", "请选择班级!");
  238. return;
  239. }
  240. $("#formQuery").submit();
  241. }
  242. function queryStandard(data) {
  243. queryClass();
  244. }
  245. function queryClass() {
  246. var jsonString = "";
  247. var parameterString = "";
  248. //var campusID = $("#CampusDropdown").combogridX("getValue");
  249. var collegeID = $("#CollegeDropdown").combobox("getValue");
  250. var standardID = $("#DictionaryStandard").combogridX("getValue");
  251. var schoolyearID = $("#DictionarySchoolyear").combobox("getValue");
  252. if (schoolyearID != nonSelect) parameterString += "DictionaryGrade|*|" + schoolyearID + "|@|";
  253. //if (campusID != nonSelect) parameterString += "CampusDropdown|*|" + campusID + "|@|";
  254. if (collegeID != nonSelect) parameterString += "CollegeDropdown|*|" + collegeID + "|@|";
  255. if (standardID != nonSelect) parameterString += "DictionaryStandard|*|" + standardID + "|@|";
  256. if (parameterString != "") {
  257. jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
  258. $("#ClassmajorDropdown").combogridX("reload", eval(jsonString));
  259. $("#DictionaryStandard").combogridX("reload", eval(jsonString));
  260. } else {
  261. $("#ClassmajorDropdown").combogridX("reload");
  262. $("#DictionaryStandard").combogridX("reload", eval(jsonString));
  263. }
  264. //reload();
  265. }