RetakePlanResultTask.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. var mnu = "";
  2. //加载
  3. $(function () {
  4. mnu = $.SystemGeneral.getUrlParam("MNU");
  5. })
  6. //刷新
  7. function reload() {
  8. $("#dgRetakePlanResultTaskList").cmsXDataTable("load", $.getDataGridParams("dgRetakePlanResultTaskList"));
  9. }
  10. //获取选中的数据
  11. function validChoose() {
  12. var d = [];
  13. $.each($("#dgRetakePlanResultTaskList").cmsXDataTable("getSelections"), function (index) {
  14. d.push(this.RetakePlanID);
  15. });
  16. return d;
  17. }
  18. //获取选中的重修任务状态
  19. function validChooseStatus() {
  20. var d = [];
  21. $.each($("#dgRetakePlanResultTaskList").cmsXDataTable("getSelections"), function (index) {
  22. d.push(this.RecordStatus);
  23. });
  24. return d;
  25. }
  26. //修改
  27. function RetakePlanResultTask_Update() {
  28. var d = validChoose();
  29. var r = validChooseStatus();
  30. if (d.length == 0) {
  31. $.messager.alert("系统信息", "请选择您要修改的信息。");
  32. return;
  33. }
  34. if (d.length > 1) {
  35. $.messager.alert("系统信息", "只能选择单个记录进行修改。");
  36. return;
  37. }
  38. if (r[0] == CreatedStatus) {
  39. $.messager.alert("系统提示", "无法对已开班状态的信息进行修改。");
  40. return;
  41. }
  42. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/RetakePlanResultTask/Edit?RetakePlanID=" + d[0] + '&MNU=' + mnu;
  43. $.popupTopWindow('重修班级修改', redirectTo, 750, 550, null, null);
  44. }
  45. //查看重修班级信息
  46. function retakeDetail(rowindex, rowdata) {
  47. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/RetakePlanResultTask/Edit?RetakePlanID=" + rowdata.RetakePlanID
  48. + "&MNU=" + mnu + "&Status=" + rowdata.RecordStatus + "&Isdisplay=true";
  49. $.popupTopWindow('重修班级信息', redirectTo, 750, 550, null, null);
  50. }
  51. //重修报名
  52. function RetakePlanResultTask_Student() {
  53. var d = validChoose();
  54. var r = validChooseStatus();
  55. if (d.length == 0) {
  56. $.messager.alert("系统信息", "请选择您要报名的信息。");
  57. return;
  58. }
  59. if (d.length > 1) {
  60. $.messager.alert("系统信息", "只能选择单个记录进行报名。");
  61. return;
  62. }
  63. if (r[0] == CreatedStatus) {
  64. $.messager.alert("系统提示", "已开班状态的信息无法报名。");
  65. return;
  66. }
  67. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/RetakePlanResultTask/StudentDetail?RetakePlanID=" + d[0] + "&MNU=" + mnu;
  68. $.popupTopWindow('重修报名', redirectTo, 900, 540, reload, null);
  69. }
  70. //查看重修报名
  71. function studentDetail(rowindex, rowdata) {
  72. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/RetakePlanResultTask/StudentDetail?RetakePlanID=" + rowdata.RetakePlanID
  73. + "&MNU=" + mnu + "&Status=" + rowdata.RecordStatus;
  74. $.popupTopWindow('重修报名', redirectTo, 900, 540, reload);
  75. }
  76. //开班(重修计划)
  77. function RetakePlanResultTask_AddMission() {
  78. var RetakePlanIDs = validChoose().join(',');
  79. if (RetakePlanIDs.length == 0) {
  80. $.messager.alert("系统提示", "请选择您要开班的信息。");
  81. return;
  82. }
  83. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/RetakePlanResultTask/IsOverRange', { retakePlanIDs: RetakePlanIDs }, function (data) {
  84. if (data.IsSuccess) {
  85. if (data.Data) {
  86. $.messager.defaults = { ok: "继续开班", cancel: "取消" };
  87. $.messager.confirm("选择提示", "检测到选择开班的信息中报名人数未达到人数下限或超过人数上限,是否继续开班?", function (r) {
  88. if (r) {
  89. Generate(RetakePlanIDs);
  90. }
  91. else {
  92. return;
  93. }
  94. });
  95. $.messager.defaults = { ok: "确定", cancel: "取消" };
  96. }
  97. else {
  98. Generate(RetakePlanIDs);
  99. }
  100. }
  101. else {
  102. $.messager.alert("系统提示", data.Message);
  103. }
  104. });
  105. }
  106. //确定开班(重修计划)
  107. function Generate(RetakePlanIDs) {
  108. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/RetakePlanResultTask/Generate', { RetakePlanIDs: RetakePlanIDs }, function (data) {
  109. $.messager.alert("系统提示", data.Message);
  110. if (data.IsSuccess) {
  111. $("#dgRetakePlanResultTaskList").cmsXDataTable('load');
  112. }
  113. });
  114. }
  115. //重修计划名单
  116. function studentPlanDetail(rowindex, rowdata) {
  117. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/RetakePlanResultTask/StudentPlanDetail?RetakePlanID=" + rowdata.RetakePlanID
  118. + "&MNU=" + mnu + "&Status=" + rowdata.RecordStatus;
  119. $.popupTopWindow('重修计划名单', redirectTo, 900, 540, reload);
  120. }
  121. //列颜色设置为红色
  122. function SetRedtColumn(index, row, value) {
  123. return " <span style=\"color: red;\">" + value + "</span>";
  124. }
  125. //导出Excel
  126. function RetakePlanResultTask_Export() {
  127. $("#formQuery").submit();
  128. }
  129. //联动查询
  130. function queryCourseCollege(data) {
  131. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  132. var departmentID = $("#DepartmentComboGrid").combogridX("getValue");
  133. var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + collegeID + "|@|";
  134. jsonString += "DepartmentComboGrid|*|" + departmentID + "|@|'})";
  135. $("#DepartmentComboGrid").combogridX("reload", eval(jsonString));
  136. reload();
  137. }