FinalExaminationEdit.js 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. var mnu = "";
  2. var atype = "";
  3. //加载
  4. $(function () {
  5. mnu = $.SystemGeneral.getUrlParam("MNU");
  6. atype = $.SystemGeneral.getUrlParam("aType");
  7. })
  8. function FinalExamination_Save() {
  9. $(document.forms[0]).submit();
  10. }
  11. //获取选中的数据
  12. function validChoose() {
  13. var d = [];
  14. $.each($("#dgStudentList").cmsXDataTable("getSelections"), function (index) {
  15. d.push(this);
  16. });
  17. return d;
  18. }
  19. //弹出添加学生页面
  20. function FinalExamination_SettingsAdd() {
  21. $.popupTopWindow('添加学生', CMS_SystemConfig.VirtualDirectoryPath + '/Common/StudentViewSelect?FromMNU=' +
  22. mnu + '&ClassmajorID=' + $("#ClassmajorID").combogridX('getValue'), 650, 480, AddStudent_Confirm);
  23. }
  24. //确定
  25. function AddStudent_Confirm(studentList) {
  26. if (studentList == undefined)
  27. return;
  28. var studentViewList = $("#dgStudentList").cmsXDataTable("getRows");
  29. $.each(studentList, function (index, value) {
  30. if ($.grep(studentViewList, function (row, index) { return value.UserID == studentViewList.UserID; }).length == 0) {
  31. studentViewList.push({
  32. UserID: value.UserID,
  33. LoginID: value.LoginID,
  34. UserName: value.UserName,
  35. SexName: value.SexName,
  36. ClassmajorName: value.ClassmajorName,
  37. StudentStatusName: value.StudentStatusName,
  38. InSchoolStatusName: value.InSchoolStatusName
  39. });
  40. }
  41. });
  42. $("#dgStudentList").cmsXDataTable("loadData", { rows: studentViewList, total: studentViewList.length });
  43. }
  44. //弹出添加班级页面
  45. function FinalExamination_ClassmajorAdd() {
  46. var CollegeID = $("#CollegeID").combogridX('getValue');
  47. var GradeYearID = $("#GradeYearID").combobox('getValue');
  48. var StandardID = $("#StandardID").combogridX('getValue');
  49. $.popupTopWindow('添加班级', CMS_SystemConfig.VirtualDirectoryPath + '/Common/ClassmajorViewSelect?FromMNU=' +
  50. mnu + '&CollegeID=' + CollegeID + '&GradeYearID=' +
  51. GradeYearID + '&StandardID=' + StandardID, 600, 480, AddClassmajor_Confirm);
  52. }
  53. function AddClassmajor_Confirm(ClassmajorList) {
  54. if (ClassmajorList == undefined)
  55. return;
  56. var className = "";
  57. var id = "";
  58. var name = "";
  59. $.each(ClassmajorList, function (index, value) {
  60. className += value.Name + ",";
  61. id += value.ClassmajorID + ",";
  62. });
  63. if (className != "" && id != "") {
  64. className = className.toString().substring(0, className.lastIndexOf(','));
  65. id = id.toString().substring(0, id.lastIndexOf(','));
  66. }
  67. document.getElementById("ClassmajorName").value = className;
  68. document.getElementById("ClassID").value = id;
  69. if (atype != "update") {
  70. if ($("#CoursematerialID").combogridX("getText") != "请选择")
  71. name = $("#CoursematerialID").combogridX("getText");
  72. if (className != "") {
  73. var cName = className.split(",");
  74. name += "-" + cName[0];
  75. }
  76. if ($("#ExamsCategoryID").combobox("getText") != "请选择")
  77. name += "-" + $("#ExamsCategoryID").combobox("getText");
  78. $("#ClassName").val(name);
  79. }
  80. if ($("#CoursematerialID").combogridX("getValue") != "" && $("#CoursematerialID").combogridX("getValue") != "-1") {
  81. var CoursematerialID = $("#CoursematerialID").combogridX("getValue");
  82. var cID = id.split(",");
  83. QueryDepartment(CoursematerialID, cID[0]);
  84. }
  85. }
  86. //删除学生
  87. function FinalExamination_SettingsDelete() {
  88. var d = validChoose();
  89. var studentViewList = $("#dgStudentList").cmsXDataTable("getRows");
  90. var i, j;
  91. var len = studentViewList.length;
  92. for (i = len - 1; i >= 0; i--) {
  93. for (j = 0; j < d.length; j++) {
  94. if (studentViewList[i].UserID == d[j].UserID) {
  95. studentViewList.splice(i, 1);
  96. break;
  97. }
  98. }
  99. }
  100. $("#dgStudentList").cmsXDataTable("loadData", { rows: studentViewList, total: studentViewList.length });
  101. }
  102. function queryClass(data) {
  103. if ($("#GradeYearID").length > 0 && $.data($("#GradeYearID")[0], "combobox")
  104. && $("#CollegeID").length > 0 && $.data($("#CollegeID")[0], "combogridX")
  105. && $("#ClassmajorID").length > 0 && $.data($("#ClassmajorID")[0], "combogridX")) {
  106. var gradeYearID = $("#GradeYearID").combobox("getValue");
  107. var collegeID = $("#CollegeID").combogridX("getValue");
  108. var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + collegeID + "|@|DictionaryGrade|*|" + gradeYearID + "|@|'})";
  109. $("#ClassmajorID").combogridX("reload", eval(jsonString));
  110. }
  111. }
  112. function QueryCollegeComboGridList(data) {
  113. var collegeID = $("#CollegeID").combogridX("getValue");
  114. var yearID = document.getElementsByName("GradeYearID")[0].value;
  115. var parameterString = "";
  116. $("#StandardID").combogridX("setValue", "-1");
  117. if (collegeID != nonSelect) {
  118. parameterString += "CollegeDropdown|*|" + collegeID + "|@|";
  119. }
  120. var schoolyearID = $("#GradeYearID").combobox("getValue");
  121. if (schoolyearID != nonSelect) {
  122. parameterString += "DictionaryGrade|*|" + schoolyearID + "|@|";
  123. }
  124. if (parameterString != "") {
  125. jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
  126. $("#StandardID").combogridX("reload", eval(jsonString));
  127. } else {
  128. $("#StandardID").combogridX("reload");
  129. }
  130. }
  131. function selectCollege(data) {
  132. queryClass(data);
  133. }
  134. function selectGrade(data) {
  135. queryClass(data);
  136. }
  137. function QueryComboGridCourse(data) {
  138. if (atype != "update") {
  139. var name = data.CourseName;
  140. if (document.getElementById("ClassmajorName").value != "") {
  141. var className = document.getElementById("ClassmajorName").value;
  142. var cName = className.split(",");
  143. name += "-" + cName[0];
  144. }
  145. if ($("#ExamsCategoryID").combobox("getText") != "请选择")
  146. name += "-" + $("#ExamsCategoryID").combobox("getText");
  147. $("#ClassName").val(name);
  148. }
  149. var id = data.CoursematerialID;
  150. if (document.getElementById("ClassmajorName").value != "") {
  151. var classID = document.getElementById("ClassID").value;
  152. var cID = classID.split(",");
  153. QueryDepartment(id, cID[0]);
  154. }
  155. }
  156. function QueryComboGridClassmajor(data) {
  157. if (atype != "update") {
  158. var name = "";
  159. if ($("#CoursematerialID").combogridX("getText") != "请选择")
  160. name = $("#CoursematerialID").combogridX("getText");
  161. if (data.Name != "请选择")
  162. name += "-" + $("#ClassmajorID").combogridX("getText");
  163. if ($("#ExamsCategoryID").combobox("getText") != "请选择")
  164. name += "-" + $("#ExamsCategoryID").combobox("getText");
  165. $("#ClassName").val(name);
  166. }
  167. }
  168. function QueryExamsCategory(data) {
  169. if (atype != "update") {
  170. var name = "";
  171. if ($("#CoursematerialID").combogridX("getText") != "请选择" && $("#CoursematerialID").combogridX("getText") != undefined)
  172. name = $("#CoursematerialID").combogridX("getText");
  173. if (document.getElementById("ClassmajorName").value != "") {
  174. className = document.getElementById("ClassmajorName").value;
  175. var cName = className.split(",");
  176. name += "-" + cName[0];
  177. }
  178. if (data.Text != "请选择")
  179. name += "-" + data.Text;
  180. $("#ExamsCategoryID").val(data.Text);
  181. $("#ClassName").val(name);
  182. }
  183. }
  184. function QueryDepartment(CoursematerialID, ClassmajorID) {
  185. var depatrmentId = "";
  186. $.post('/Department/ListForExamination', { CoursematerialID: CoursematerialID, ClassmajorID: ClassmajorID }, function (data) {
  187. if (data != "") {
  188. $("#DepartmentID").combogridX("setValue", data);
  189. }
  190. });
  191. }