ResitExamination.js 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/ResitExamination/Edit";
  2. var mnu = "";
  3. var isFirstLoadBuilding = true;
  4. //加载
  5. $(function () {
  6. mnu = $.SystemGeneral.getUrlParam("MNU");
  7. })
  8. //补考设定导出
  9. function ResitExamination_Export() {
  10. var d = validChoose().join(',')
  11. if (d != "") {
  12. document.getElementById("FinalExaminationID").value = d;
  13. }
  14. else {
  15. document.getElementById("FinalExaminationID").value = "";
  16. }
  17. $("#formQuery").attr("action", CMS_SystemConfig.VirtualDirectoryPath + "/ResitExamination/Excel");
  18. $("#formQuery").submit();
  19. }
  20. //补考汇总名单导出
  21. function ResitExaminationStudentDetails_Export() {
  22. var d = validChoose().join(',')
  23. if (d != "") {
  24. document.getElementById("FinalExaminationID").value = d;
  25. }
  26. else {
  27. document.getElementById("FinalExaminationID").value = "";
  28. }
  29. $("#formQuery").attr("action", CMS_SystemConfig.VirtualDirectoryPath + "/ResitExamination/StudentDetails_Excel");
  30. $("#formQuery").submit();
  31. }
  32. //新增
  33. function ResitExamination_Add() {
  34. var d = validChoose();
  35. var redirectTo = url + "?finalExamination=" + d + "&MNU=" + mnu + "&aType=add";
  36. if (d == "") {
  37. redirectTo = url + "?MNU=" + mnu + "&aType=add";
  38. }
  39. if (d.length > 1) {
  40. $.messager.alert("系统提示", "只能选择单个记录进行复制新增。");
  41. return;
  42. }
  43. $.popupTopWindow('补考设定新增', redirectTo, 750, 420, reload);
  44. }
  45. function reload() {
  46. $("#dgResitExaminationList").cmsXDataTable("load", $.getDataGridParams("dgResitExaminationList"));
  47. }
  48. //获取选中的数据
  49. function validChoose() {
  50. var d = [];
  51. $.each($("#dgResitExaminationList").cmsXDataTable("getSelections"), function (index) {
  52. d.push(this.FinalExaminationID);
  53. });
  54. return d;
  55. }
  56. function StudentCount() {
  57. var d = 0;
  58. $.each($("#dgResitExaminationList").cmsXDataTable("getSelections"), function (index) {
  59. d = this.StudentCount;
  60. });
  61. return d;
  62. }
  63. function ApprovalStatusName() {
  64. var d = [];
  65. $.each($("#dgResitExaminationList").cmsXDataTable("getSelections"), function (index) {
  66. d.push(this.ApprovalStatusName);
  67. });
  68. return d;
  69. }
  70. function ApprovalStatus() {
  71. var d = 0;
  72. $.each($("#dgResitExaminationList").cmsXDataTable("getSelections"), function (index) {
  73. d = this.ApprovalStatus;
  74. });
  75. return d;
  76. }
  77. //明细
  78. function edit(rowindex, rowdata) {
  79. var redirectTo = url + "?finalExamination=" + rowdata.FinalExaminationID + "&MNU=" + mnu + "&aType=update&isView=1";
  80. $.popupTopWindow('补考设定信息', redirectTo, 750, 420, null, null);
  81. }
  82. //修改按钮
  83. function ResitExamination_Update() {
  84. var d = validChoose();
  85. if (d == "") {
  86. $.messager.alert("系统提示", "请选择您要修改的信息。");
  87. return;
  88. }
  89. if (d.length > 1) {
  90. $.messager.alert("系统提示", "只能选择单个记录进行修改。");
  91. return;
  92. }
  93. var redirectTo = url + "?finalExamination=" + d + "&MNU=" + mnu + "&aType=update";
  94. $.popupTopWindow('补考设定修改', redirectTo, 750, 420, null, null);
  95. }
  96. //删除
  97. function ResitExamination_Delete() {
  98. var d = validChoose().join(',');
  99. var count = StudentCount();
  100. var statusName = ApprovalStatusName();
  101. if (d == "") {
  102. $.messager.alert("系统提示", "请选择您要删除的信息。");
  103. return;
  104. }
  105. //if ($.grep(statusName, function (x) { return x != "未开放"; }).length > 0) {
  106. // if (count > 0) {
  107. // $.messager.alert("系统提示", "已录入学生信息,不能删除该补考设定!");
  108. // return;
  109. // }
  110. //}
  111. $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) {
  112. if (r) {
  113. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ResitExamination/Delete', { finalExaminationIDs: d }, function (data) {
  114. if (data == "删除成功!") {
  115. $.messager.alert("系统提示", data);
  116. $("#dgResitExaminationList").cmsXDataTable('load');
  117. } else {
  118. $.messager.alert("系统提示", data);
  119. }
  120. });
  121. }
  122. });
  123. }
  124. //期末生成
  125. function ResitExamination_FinalGenerate() {
  126. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/ResitExamination/GenerateFinalExaminationEdit?MNU=" + mnu;
  127. $.popupTopWindow('期末补考生成', redirectTo, 530, 300, null, null);
  128. }
  129. //毕业生成
  130. function ResitExamination_Graduate() {
  131. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/ResitExamination/GenerateResitExaminationEdit?MNU=" + mnu;
  132. $.popupTopWindow('毕业补考生成', redirectTo, 530, 300, null, null);
  133. }
  134. function SelectCollegeComboGrid() {
  135. var collegeID = $("#CollegeComboGrid").combogridX("getValue");
  136. if (collegeID != nonSelect) {
  137. var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + collegeID + "|@|'})";
  138. $("#DepartmentComboGrid").combogridX("reload", eval(jsonString));
  139. }
  140. reload();
  141. }
  142. //添加学生
  143. function ResitExamination_AddStudent() {
  144. var d = validChoose();
  145. var status = ApprovalStatus();
  146. if (d == "") {
  147. $.messager.alert("系统提示", "请选择您要增加学生的信息。");
  148. return;
  149. }
  150. if (d.length > 1) {
  151. $.messager.alert("系统提示", "只能选择单个记录进行修改。");
  152. return;
  153. }
  154. //if (statusName == "已提交" || statusName == "已审核") {
  155. // $.messager.alert("系统提示", "该数据已经提交或已审核,不能添加学生!");
  156. // return;
  157. //}
  158. if (status == "1" || status == "3" || status == "5") {
  159. var redirectTo = "/ResitExamination/StudentEdit?finalExamination=" + d + "&MNU=" + mnu;
  160. $.popupTopWindow('学生名单', redirectTo, 850, 480, reload);
  161. }
  162. else {
  163. $.messager.alert("系统提示", "该数据已经提交或已审核,不能添加学生!");
  164. return;
  165. }
  166. }
  167. function AddStudent_Confirm(studentList) {
  168. var d = validChoose().join(',');
  169. var student = [];
  170. $.each(studentList, function (index, value) {
  171. student.push(value.UserID);
  172. });
  173. var userIDs = student.join(',');
  174. $.post(CMS_SystemConfig.VirtualDirectoryPath + '/ResitExamination/ResitExaminationStudentAdd', { finalExaminationID: d, userIDs: userIDs }, function (data) {
  175. if (data == "保存成功。") {
  176. $.messager.alert("系统提示", data);
  177. $("#dgResitExaminationList").cmsXDataTable('load');
  178. } else {
  179. $.messager.alert("系统提示", data);
  180. }
  181. });
  182. }
  183. //学生成绩录入名单
  184. function StudentList(rowindex, rowdata) {
  185. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/ResitExamination/StudentList?finalExaminationID=" + rowdata.FinalExaminationID + "&MNU=" + mnu;
  186. $.popupTopWindow('学生成绩录入名单', redirectTo, 850, 480, null, null);
  187. }
  188. //允许录入
  189. function ResitExamination_Input() {
  190. var d = validChoose().join(',');
  191. var dstate = ApprovalStatusName().join(',');
  192. if (d == "") {
  193. $.messager.alert("系统提示", "请选择您要允许录入的信息。");
  194. return;
  195. }
  196. var selected = $("#dgResitExaminationList").cmsXDataTable("getSelections");
  197. for (var i = 0; i < selected.length; i++) {
  198. if (selected[i].CreatorUserName == null) {
  199. $.messager.alert("系统提示", "录入人为空,无法进行允许录入,请设置。");
  200. return;
  201. }
  202. }
  203. //for (var i = 0; i < dstate.split(',').length; i++) {
  204. // if (dstate.split(',')[i] != "未开放") {
  205. // $.messager.alert("系统提示", "只能操作未开放的数据!");
  206. // return;
  207. // }
  208. //}
  209. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/FinalExamination/Final_ResitExaminationIsEntry', { finalExaminationIDs: d }, function (data) {
  210. if (data == "允许录入成功。") {
  211. $.messager.alert("系统提示", data);
  212. $("#dgResitExaminationList").cmsXDataTable('load');
  213. } else {
  214. $.messager.alert("系统提示", data);
  215. }
  216. });
  217. }
  218. //取消录入
  219. function ResitExamination_Cancel() {
  220. var d = validChoose().join(',');
  221. if (d == "") {
  222. $.messager.alert("系统提示", "请选择您要取消录入的信息。");
  223. return;
  224. }
  225. $.messager.confirm("系统提示", "撤销开放后,若所选记录中存在已录入的成绩,系统将同步进行删除,是否确定撤销开放?", function (r) {
  226. if (r) {
  227. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/FinalExamination/Final_ResitExaminationBack', { finalExaminationIDs: d }, function (data) {
  228. if (data == "取消录入成功。") {
  229. $.messager.alert("系统提示", data);
  230. $("#dgResitExaminationList").cmsXDataTable('load');
  231. } else {
  232. $.messager.alert("系统提示", data);
  233. }
  234. });
  235. }
  236. });
  237. }