ExaminationPlan.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/ExaminationPlan/Classroom";
  2. var mnu;
  3. $(function () {
  4. mnu = $.SystemGeneral.getUrlParam("MNU");
  5. var customerUrl = $(CMS_SystemConfig.GetConfig()).find("configuration>customUrls>add[key='ExaminationClassroom']");
  6. if (customerUrl.attr("value")) {
  7. url = CMS_SystemConfig.VirtualDirectoryPath + "/" + customerUrl.attr("value");
  8. }
  9. });
  10. function ExaminationPlan_Import() {
  11. // $.post(CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationPlan/Generate', null, function (result) {
  12. // $.messager.alert("系统提示", result.Message);
  13. // reload();
  14. // });
  15. $.popupTopWindow('生成计划', CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationPlan/Generate?MNU=' + mnu, 500, 300);
  16. }
  17. function ExaminationPlan_ImportResit() {
  18. $.popupTopWindow('生成补考计划', CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationPlan/GenerateResit?MNU=' + mnu, 400, 200);
  19. }
  20. function ExaminationPlan_ImportGraduateExam() {
  21. $.popupTopWindow('生成毕业清考计划', CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationPlan/GenerateGraduateExam?MNU=' + mnu, 400, 200);
  22. }
  23. function ExaminationPlan_AutoSchedule() {
  24. var ids = $.map(validChoosedata(), function (x) { return x.ExaminationPlanID; });
  25. var d = ids.join(',');
  26. var message = "是否对本学期的考试进行排考?";
  27. if (ids.length > 0) {
  28. message = "是否对选中的考试进行排考?";
  29. }
  30. $.messager.confirm("系统提示", message, function (r) {
  31. if (r) {
  32. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationPlan/AutoSchedule', { examinationPlanIDs: d }, function (data) {
  33. if (data.IsSuccess) {
  34. $.messager.alert("系统提示", "自动排考成功。");
  35. $("#dgExaminationPlanList").cmsXDataTable('load');
  36. } else {
  37. $.messager.alert("系统提示", data.Message);
  38. }
  39. });
  40. }
  41. });
  42. }
  43. function ExaminationPlan_Submit() {
  44. var ids = $.map(validChoosedata(), function (x) { return x.ExaminationPlanID; });
  45. var d = ids.join(',');
  46. if (d == "") {
  47. $.messager.alert("系统提示", "请选择您要提交的记录。");
  48. return;
  49. }
  50. $.messager.confirm("系统提示", "您确定要提交该考试计划?", function (r) {
  51. if (r) {
  52. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationPlan/Submit', { examinationPlanIDs: d }, function (data) {
  53. if (data.IsSuccess) {
  54. $.messager.alert("系统提示", "提交成功。");
  55. $("#dgExaminationPlanList").cmsXDataTable('load');
  56. } else {
  57. $.messager.alert("系统提示", data.Message);
  58. }
  59. });
  60. }
  61. });
  62. }
  63. function ExaminationPlan_UnSubmit() {
  64. var ids = $.map(validChoosedata(), function (x) { return x.ExaminationPlanID; });
  65. var d = ids.join(',');
  66. if (d == "") {
  67. $.messager.alert("系统提示", "请选择您要撤回的记录。");
  68. return;
  69. }
  70. $.messager.confirm("系统提示", "您确定要撤回该考试计划?", function (r) {
  71. if (r) {
  72. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationPlan/UnSubmit', { examinationPlanIDs: d }, function (data) {
  73. if (data.IsSuccess) {
  74. $.messager.alert("系统提示", "撤回成功。");
  75. $("#dgExaminationPlanList").cmsXDataTable('load');
  76. } else {
  77. $.messager.alert("系统提示", data.Message);
  78. }
  79. });
  80. }
  81. });
  82. }
  83. function ExaminationPlan_Export() {
  84. $(document.forms[0]).submit();
  85. }
  86. function ExaminationPlan_AdultExport() {
  87. var d = validChoosedata();
  88. var examinationPlanIDs = $.map(d, function (x) { return x.ExaminationPlanID; }).join(',');
  89. $("[name='SelectedID']").val(examinationPlanIDs);
  90. $(document.forms[0]).attr("action", CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationPlan/AdultExcel');
  91. $(document.forms[0]).submit();
  92. }
  93. function ExaminationPlan_AdultImport() {
  94. var selectedIDs = validChoose().join(',');
  95. selectedIDs = selectedIDs.toString();
  96. var ExaminationPlanSelect = $.getDataGridParams("dgExaminationPlanList");
  97. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationPlan/Import?MNU=' + mnu + '&selectedIDs=' + selectedIDs;
  98. $.popupTopWindow('考试安排导入', redirectTo, 400, 300, null, ExaminationPlanSelect);
  99. }
  100. //排考
  101. function ExaminationPlan_Classroom() {
  102. var d = validChoosedata();
  103. if (d.length == 0) {
  104. $.messager.alert("系统提示", "请选择您要设置的考试计划。");
  105. return;
  106. }
  107. if (d.length > 1) {
  108. $.messager.alert("系统提示", "只能选择单个记录进行设置。");
  109. return;
  110. }
  111. if (d[0].RecordStatus != notSubmitVal) {
  112. $.messager.alert("系统提示", "只能选择未提交的记录进行设置。");
  113. return;
  114. }
  115. $.popupTopWindow('考场设置', url + '?ExaminationPlanID=' + d[0].ExaminationPlanID + '&MNU=' + mnu, 800, 600);
  116. }
  117. function ExaminationPlan_Preview() {
  118. var d = validChoosedata();
  119. if (d.length == 0) {
  120. $.messager.alert("系统提示", "请选择您要预览的考试计划。");
  121. return;
  122. }
  123. if (d.length > 1) {
  124. $.messager.alert("系统提示", "只能选择单个记录进行预览。");
  125. return;
  126. }
  127. var reportUrl = CMS_SystemConfig.ReportPagePath + "?ReportFolder=%2fExaminationManage%2fExaminationRoomLayout&ExaminationPlanID_RAP=" + d[0].ExaminationPlanID;
  128. $.popupTopWindowOutsite('考试座位预览', reportUrl, 1000, 650);
  129. }
  130. //考试时间
  131. function ExaminationPlan_SetTime() {
  132. var d = validChoosedata();
  133. if (d.length == 0) {
  134. $.messager.alert("系统提示", "请选择您要修改的考试计划。");
  135. return;
  136. }
  137. $.popupTopWindow('考试时间安排', CMS_SystemConfig.VirtualDirectoryPath + "/ExaminationPlan/SetTime?" + '&MNU=' + mnu, 500, 200, ExaminationPlan_SetTime_Confirm);
  138. }
  139. function ExaminationPlan_SetTime_Confirm(timeData) {
  140. if (timeData) {
  141. var d = validChoosedata();
  142. var idList = $.map(d, function (x) { return x.ExaminationPlanID });
  143. $.post(CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationPlan/SetTime',
  144. {
  145. ids: idList.join(','),
  146. examinationDate: timeData.ExaminationDate,
  147. startTime: timeData.StartTime,
  148. endTime: timeData.EndTime
  149. }, function (data) {
  150. if (data.IsSuccess) {
  151. $.messager.alert("系统提示", "设置时间成功。");
  152. $("#dgExaminationPlanList").cmsXDataTable('load');
  153. } else {
  154. $.messager.alert("系统提示", data.Message);
  155. }
  156. });
  157. }
  158. }
  159. //添加学生
  160. function ExaminationPlan_AddStudent() {
  161. var d = validChoose();
  162. var status = ApprovalStatus();
  163. if (d == "") {
  164. $.messager.alert("系统提示", "请选择您要增加学生的信息。");
  165. return;
  166. }
  167. if (d.length > 1) {
  168. $.messager.alert("系统提示", "只能选择单个记录。");
  169. return;
  170. }
  171. if (status == "1" || status == "3" || status == "5") {
  172. var redirectTo = "/FinalExamination/StudentEdit?finalExamination=" + d + "&MNU=" + mnu;
  173. $.popupTopWindow('学生名单', redirectTo, 850, 480, reload);
  174. }
  175. else {
  176. $.messager.alert("系统提示", "该数据已经提交或已审核,不能添加学生!");
  177. return;
  178. }
  179. }
  180. function ExaminationPlan_Resettting() {
  181. var d = validChoose().join(',');
  182. //var status = validChoosedata().join(',');
  183. if (d == "") {
  184. $.messager.alert("系统提示", "请选择你要重置的信息!");
  185. return;
  186. }
  187. $.messager.confirm("系统提示", "您确定要重置选择的信息?", function (r) {
  188. if (r) {
  189. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationPlan/Resetting', { examinationPlanIDs: d }, function (data) {
  190. if (data == "重置成功") {
  191. $.messager.alert("系统提示", data);
  192. $("#dgExaminationPlanList").cmsXDataTable("load", $.getDataGridParams("dgExaminationPlanList"));
  193. } else {
  194. $.messager.alert("系统提示", data);
  195. }
  196. });
  197. }
  198. });
  199. }
  200. function ExaminationPlan_Cancel() {
  201. var d = validChoose().join(',');
  202. //var status = validChoosedata().join(',');
  203. if (d == "") {
  204. $.messager.alert("系统提示", "请选择你要撤销的信息!");
  205. return;
  206. }
  207. $.messager.confirm("系统提示", "您确定要撤销选择的信息?", function (r) {
  208. if (r) {
  209. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationPlan/Cancel', { examinationPlanIDs: d }, function (data) {
  210. if (data == "撤销成功") {
  211. $.messager.alert("系统提示", data);
  212. $("#dgExaminationPlanList").cmsXDataTable("load", $.getDataGridParams("dgExaminationPlanList"));
  213. } else {
  214. $.messager.alert("系统提示", data);
  215. }
  216. });
  217. }
  218. });
  219. }
  220. //删除考场安排
  221. function ExaminationPlan_Delete() {
  222. var d = validChoose().join(',');
  223. //var status = validChoosedata().join(',');
  224. if (d == "") {
  225. $.messager.alert("系统提示", "请选择你要删除的信息!");
  226. return;
  227. }
  228. $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) {
  229. if (r) {
  230. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationPlan/Delete', { examinationPlanIDs: d }, function (data) {
  231. if (data == "删除成功") {
  232. $.messager.alert("系统提示", data);
  233. $("#dgExaminationPlanList").cmsXDataTable("load", $.getDataGridParams("dgExaminationPlanList"));
  234. } else {
  235. $.messager.alert("系统提示", data);
  236. }
  237. });
  238. }
  239. });
  240. }
  241. function reload() {
  242. // var starWeek = $("#StarWeek").val();
  243. // var endWeek = $("#EndWeek").val();
  244. // var re = "/^[0-9]+$/";
  245. // if (starWeek != "" && !(/(^[1-9]\d*$)/.test(starWeek))) {
  246. // $.messager.alert("系统提示", "请在开始周次输入整数!");
  247. // return
  248. // }
  249. // if (endWeek != "" && !(/(^[1-9]\d*$)/.test(endWeek))) {
  250. // $.messager.alert("系统提示", "请在结束周次输入整数!");
  251. // return
  252. // }
  253. $("#dgExaminationPlanList").cmsXDataTable("load", $.getDataGridParams("dgExaminationPlanList"));
  254. }
  255. function view(rowindex, rowdata) {
  256. $.popupTopWindow('考场详情', url + '?ExaminationPlanID=' + rowdata.ExaminationPlanID + '&MNU=' + mnu + "&isView=1", 800, 600);
  257. }
  258. function viewStudent(rowindex, rowdata) {
  259. $.popupTopWindow('学生信息', CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationPlan/ExaminationPlanStudentList?ExaminationPlanID=' + rowdata.ExaminationPlanID + '&MNU=' + mnu + "&isView=1", 800, 600);
  260. }
  261. //获取选中的数据
  262. function validChoosedata() {
  263. var d = [];
  264. $.each($("#dgExaminationPlanList").cmsXDataTable("getSelections"), function (index) {
  265. d.push(this);
  266. });
  267. return d;
  268. }
  269. function validChoose() {
  270. var d = [];
  271. $.each($("#dgExaminationPlanList").cmsXDataTable("getSelections"), function (index) {
  272. d.push(this.ExaminationPlanID);
  273. });
  274. return d;
  275. }
  276. function QueryCampusDropdownList(data) {
  277. $("#CollegeDropdown").combobox("reload", CMS_SystemConfig.VirtualDirectoryPath + "/College/CollegeDropdownListBanid?campusID=" + data.Value + "");
  278. reload();
  279. }
  280. function ExaminationPlan_Add() {
  281. $.popupTopWindow('新增考试安排', CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationPlan/Add?MNU=' + mnu, 800, 600);
  282. }