FinalExamination.js 9.1 KB

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