ResitExaminationEdit.js 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. function ResitExamination_Save() {
  2. $(document.forms[0]).submit();
  3. }
  4. var mnu = "";
  5. var atype = "";
  6. //加载
  7. $(function () {
  8. mnu = $.SystemGeneral.getUrlParam("MNU");
  9. atype = $.SystemGeneral.getUrlParam("aType");
  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 ResitExamination_SettingsAdd() {
  21. $.popupTopWindow('添加学生', CMS_SystemConfig.VirtualDirectoryPath + '/Common/StudentViewSelect?FromMNU=' +
  22. mnu, 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. StudentStatusName: value.StudentStatusName,
  37. InSchoolStatusName: value.InSchoolStatusName
  38. });
  39. }
  40. });
  41. $("#dgStudentList").cmsXDataTable("loadData", { rows: studentViewList, total: studentViewList.length });
  42. }
  43. //弹出添加班级页面
  44. function ResitExamination_ClassmajorAdd() {
  45. var CollegeID = $("#CollegeID").combogridX('getValue');
  46. var GradeYearID = $("#GradeYearID").combobox('getValue');
  47. var StandardID = $("#StandardID").combogridX('getValue');
  48. $.popupTopWindow('添加班级', CMS_SystemConfig.VirtualDirectoryPath + '/Common/ClassmajorViewSelect?FromMNU=' +
  49. mnu + '&CollegeID=' + CollegeID + '&GradeYearID=' +
  50. GradeYearID + '&StandardID=' + StandardID, 600, 480, AddClassmajor_Confirm);
  51. }
  52. function AddClassmajor_Confirm(ClassmajorList) {
  53. if (ClassmajorList == undefined)
  54. return;
  55. var className = "";
  56. var id = "";
  57. var name = "";
  58. $.each(ClassmajorList, function (index, value) {
  59. className += value.Name + ",";
  60. id += value.ClassmajorID + ",";
  61. });
  62. if (className != "" && id != "") {
  63. className = className.toString().substring(0, className.lastIndexOf(','));
  64. id = id.toString().substring(0, id.lastIndexOf(','));
  65. }
  66. document.getElementById("ClassmajorName").value = className;
  67. document.getElementById("ClassID").value = id;
  68. if (atype != "update") {
  69. if ($("#CoursematerialID").combogridX("getText") != "请选择")
  70. name = $("#CoursematerialID").combogridX("getText");
  71. if (className != "") {
  72. var cName = className.split(",");
  73. name += "-" + cName[0];
  74. }
  75. if ($("#ExamsCategoryID").combobox("getText") != "请选择")
  76. name += "-" + $("#ExamsCategoryID").combobox("getText");
  77. $("#ClassName").val(name);
  78. }
  79. if ($("#CoursematerialID").combogridX("getValue") != "" && $("#CoursematerialID").combogridX("getValue") != "-1") {
  80. var CoursematerialID = $("#CoursematerialID").combogridX("getValue");
  81. var cID = id.split(",");
  82. QueryDepartment(CoursematerialID, cID[0]);
  83. }
  84. }
  85. //删除学生
  86. function ResitExamination_SettingsDelete() {
  87. var d = validChoose();
  88. var studentViewList = $("#dgStudentList").cmsXDataTable("getRows");
  89. var i, j;
  90. var len = studentViewList.length;
  91. for (i = len - 1; i >= 0; i--) {
  92. for (j = 0; j < d.length; j++) {
  93. if (studentViewList[i].UserID == d[j].UserID) {
  94. studentViewList.splice(i, 1);
  95. break;
  96. }
  97. }
  98. }
  99. $("#dgStudentList").cmsXDataTable("loadData", { rows: studentViewList, total: studentViewList.length });
  100. }
  101. function QueryCollegeComboGridList(data) {
  102. var collegeID = $("#CollegeID").combogridX("getValue");
  103. var yearID = document.getElementsByName("GradeYearID")[0].value;
  104. var parameterString = "";
  105. $("#StandardID").combogridX("setValue", "-1");
  106. if (collegeID != nonSelect) {
  107. parameterString += "CollegeDropdown|*|" + collegeID + "|@|";
  108. }
  109. var schoolyearID = $("#GradeYearID").combobox("getValue");
  110. if (schoolyearID != nonSelect) {
  111. parameterString += "DictionaryGrade|*|" + schoolyearID + "|@|";
  112. }
  113. if (parameterString != "") {
  114. jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
  115. $("#StandardID").combogridX("reload", eval(jsonString));
  116. } else {
  117. $("#StandardID").combogridX("reload");
  118. }
  119. }
  120. function QueryComboGridCollege(data) {
  121. var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + data.CollegeID + "|@|'})";
  122. $("#ClassmajorID").combogridX("reload", eval(jsonString));
  123. }
  124. function QueryComboGridCourse(data) {
  125. if (atype != "update") {
  126. var name = data.CourseName;
  127. if (document.getElementById("ClassmajorName").value != "") {
  128. var className = document.getElementById("ClassmajorName").value;
  129. var cName = className.split(",");
  130. name += "-" + cName[0];
  131. }
  132. if ($("#ExamsCategoryID").combobox("getText") != "请选择")
  133. name += "-" + $("#ExamsCategoryID").combobox("getText");
  134. $("#ClassName").val(name);
  135. }
  136. var id = data.CoursematerialID;
  137. if (document.getElementById("ClassmajorName").value != "") {
  138. var classID = document.getElementById("ClassID").value;
  139. var cID = classID.split(",");
  140. QueryDepartment(id, cID[0]);
  141. }
  142. }
  143. function QueryComboGridClassmajor(data) {
  144. if (atype != "update") {
  145. var name = "";
  146. if ($("#CoursematerialID").combogridX("getText") != "请选择")
  147. name = $("#CoursematerialID").combogridX("getText");
  148. if (data.Name != "请选择")
  149. name += "-" + $("#ClassmajorID").combogridX("getText");
  150. if ($("#ExamsCategoryID").combobox("getText") != "请选择")
  151. name += "-" + $("#ExamsCategoryID").combobox("getText");
  152. $("#ClassName").val(name);
  153. }
  154. }
  155. function QueryExamsCategory(data) {
  156. if (atype != "update") {
  157. var name = "";
  158. if ($("#CoursematerialID").combogridX("getText") != "请选择" && $("#CoursematerialID").combogridX("getText") != undefined)
  159. name = $("#CoursematerialID").combogridX("getText");
  160. if (document.getElementById("ClassmajorName").value != "") {
  161. className = document.getElementById("ClassmajorName").value;
  162. var cName = className.split(",");
  163. name += "-" + cName[0];
  164. }
  165. if (data.Text != "请选择")
  166. name += "-" + data.Text;
  167. $("#ExamsCategoryID").val(data.Text);
  168. $("#ClassName").val(name);
  169. }
  170. }
  171. function QueryDepartment(CoursematerialID, ClassmajorID) {
  172. var depatrmentId = "";
  173. $.post('/Department/ListForExamination', { CoursematerialID: CoursematerialID, ClassmajorID: ClassmajorID }, function (data) {
  174. if (data != "") {
  175. $("#DepartmentID").combogridX("setValue", data);
  176. }
  177. });
  178. }