RetakePlanTask.js 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. var mnu = "";
  2. //加载
  3. $(function () {
  4. mnu = $.SystemGeneral.getUrlParam("MNU");
  5. })
  6. //刷新
  7. function reload() {
  8. $("#dgRetakePlanTaskList").cmsXDataTable("load", $.getDataGridParams("dgRetakePlanTaskList"));
  9. }
  10. //获取选中的数据
  11. function validChoose() {
  12. var d = [];
  13. $.each($("#dgRetakePlanTaskList").cmsXDataTable("getSelections"), function (index) {
  14. d.push(this.RetakePlanID);
  15. });
  16. return d;
  17. }
  18. //获取选中的数据(重修任务状态)
  19. function validChooseStatus() {
  20. var d = [];
  21. $.each($("#dgRetakePlanTaskList").cmsXDataTable("getSelections"), function (index) {
  22. d.push(this.RecordStatus);
  23. });
  24. return d;
  25. }
  26. //重修任务分班
  27. function RetakePlanTask_Separate() {
  28. var d = validChoose();
  29. if (d.length == 0) {
  30. $.messager.alert("系统信息", "请选择要进行分班的信息。");
  31. return;
  32. }
  33. if (d.length > 1) {
  34. $.messager.alert("系统信息", "只能选择单个记录进行分班。");
  35. return;
  36. }
  37. var r = validChooseStatus();
  38. if (r[0] != CancleStatus) {
  39. $.messager.alert("系统提示", "只能对未开放状态的信息进行分班。");
  40. return;
  41. }
  42. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/RetakePlanTask/DivideIntoClassesEdit?RetakePlanID=" + d[0] + "&MNU=" + mnu;
  43. $.popupTopWindow('重修任务分班', redirectTo, 650, 280, null, null);
  44. }
  45. //修改
  46. function RetakePlan_Update() {
  47. var d = validChoose();
  48. if (d.length == 0) {
  49. $.messager.alert("系统信息", "请选择您要修改的信息。");
  50. return;
  51. }
  52. if (d.length > 1) {
  53. $.messager.alert("系统信息", "只能选择单个记录进行修改。");
  54. return;
  55. }
  56. var r = validChooseStatus();
  57. if (r[0] != CancleStatus) {
  58. $.messager.alert("系统提示", "只能对未开放状态的信息进行修改。");
  59. return;
  60. }
  61. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/RetakePlanTask/Edit?RetakePlanID=" + d[0] + '&MNU=' + mnu;
  62. $.popupTopWindow('重修任务修改', redirectTo, 750, 550, null, null);
  63. }
  64. //查看重修任务信息
  65. function retakeDetail(rowindex, rowdata) {
  66. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/RetakePlanTask/Edit?RetakePlanID=" + rowdata.RetakePlanID
  67. + "&MNU=" + mnu + "&Status=" + rowdata.RecordStatus + "&Isdisplay=true";
  68. $.popupTopWindow('重修任务信息', redirectTo, 750, 550, null, null);
  69. }
  70. //删除
  71. function RetakePlan_Delete() {
  72. var retakePlanIDs = validChoose();
  73. if (retakePlanIDs.length == 0) {
  74. $.messager.alert("系统提示", "请选择您要删除的信息。");
  75. return;
  76. }
  77. var r = validChooseStatus();
  78. for (var i = 0; i < r.length; i++) {
  79. if (r[i] != CancleStatus) {
  80. $.messager.alert("系统提示", "只能对未开放状态的信息进行删除。");
  81. return;
  82. }
  83. }
  84. $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) {
  85. if (r) {
  86. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/RetakePlanTask/IsExistsApplyStudentByRetakePlanID', { RetakePlanIDs: retakePlanIDs.join(',') }, function (data) {
  87. if (data.IsSuccess) {
  88. if (data.Data) {
  89. $.messager.defaults = { ok: "继续删除", cancel: "取消" };
  90. $.messager.confirm("选择提示", "检测到要删除的信息中存在已报名重修的学生名单,是否继续删除?", function (r) {
  91. if (r) {
  92. DeleteRetakePlan(retakePlanIDs.join(','));
  93. }
  94. else {
  95. return;
  96. }
  97. });
  98. $.messager.defaults = { ok: "确定", cancel: "取消" };
  99. }
  100. else {
  101. DeleteRetakePlan(retakePlanIDs.join(','));
  102. }
  103. }
  104. else {
  105. $.messager.alert("系统提示", data.Message);
  106. }
  107. });
  108. }
  109. });
  110. }
  111. //确定删除重修计划
  112. function DeleteRetakePlan(RetakePlanIDs) {
  113. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/RetakePlanTask/Delete', { RetakePlanIDs: RetakePlanIDs }, function (data) {
  114. $.messager.alert("系统提示", data.Message);
  115. if (data.IsSuccess) {
  116. $("#dgRetakePlanTaskList").cmsXDataTable('load');
  117. }
  118. });
  119. }
  120. //重修计划取消开放
  121. function RetakePlan_Cancle() {
  122. var retakePlanIDs = validChoose();
  123. if (retakePlanIDs.length == 0) {
  124. $.messager.alert("系统提示", "请选择您要取消开放的信息。");
  125. return;
  126. }
  127. var r = validChooseStatus();
  128. for (var i = 0; i < r.length; i++) {
  129. if (r[i] != OpenStatus) {
  130. $.messager.alert("系统提示", "只能对已开放状态的信息取消开放。");
  131. return;
  132. }
  133. }
  134. $.messager.confirm("系统提示", "您确定要对选择的信息进行取消开放?", function (r) {
  135. if (r) {
  136. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/RetakePlanTask/IsExistsApplyStudentByRetakePlanID', { RetakePlanIDs: retakePlanIDs.join(',') }, function (data) {
  137. if (data.IsSuccess) {
  138. if (data.Data) {
  139. $.messager.defaults = { ok: "继续取消", cancel: "放弃" };
  140. $.messager.confirm("选择提示", "检测到要取消开放的信息中存在已报名重修的学生名单,如果继续取消,则将对报名名单进行取消报名,是否继续取消?", function (r) {
  141. if (r) {
  142. CancleRetakePlan(retakePlanIDs.join(','));
  143. }
  144. else {
  145. return;
  146. }
  147. });
  148. $.messager.defaults = { ok: "确定", cancel: "取消" };
  149. }
  150. else {
  151. CancleRetakePlan(retakePlanIDs.join(','));
  152. }
  153. }
  154. else {
  155. $.messager.alert("系统提示", data.Message);
  156. }
  157. });
  158. }
  159. });
  160. }
  161. //确定重修计划取消开放
  162. function CancleRetakePlan(RetakePlanIDs) {
  163. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/RetakePlanTask/CancleOpen', { RetakePlanIDs: RetakePlanIDs }, function (data) {
  164. $.messager.alert("系统提示", data.Message);
  165. if (data.IsSuccess) {
  166. $("#dgRetakePlanTaskList").cmsXDataTable('load');
  167. }
  168. });
  169. }
  170. //重修计划开放
  171. function RetakePlan_Open() {
  172. var RetakePlanIDs = validChoose();
  173. if (RetakePlanIDs.length == 0) {
  174. $.messager.alert("系统提示", "请选择您要开放的信息。");
  175. return;
  176. }
  177. var r = validChooseStatus();
  178. for (var i = 0; i < r.length; i++) {
  179. if (r[i] != CancleStatus) {
  180. $.messager.alert("系统提示", "只能对未开放状态的信息开放。");
  181. return;
  182. }
  183. }
  184. $.messager.confirm("系统提示", "您确定要对选择的信息进行开放?", function (r) {
  185. if (r) {
  186. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/RetakePlanTask/Open', { RetakePlanIDs: RetakePlanIDs.join(',') }, function (data) {
  187. if (data.IsSuccess) {
  188. $("#dgRetakePlanTaskList").cmsXDataTable('load');
  189. }
  190. $.messager.alert("系统提示", data.Message);
  191. });
  192. }
  193. });
  194. }
  195. //重修计划名单
  196. function studentDetail(rowindex, rowdata) {
  197. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/RetakePlanTask/StudentDetail?RetakePlanID=" + rowdata.RetakePlanID
  198. + "&MNU=" + mnu + "&Status=" + rowdata.RecordStatus;
  199. $.popupTopWindow('重修计划名单', redirectTo, 900, 540, reload);
  200. }
  201. //列颜色设置为红色
  202. function SetRedtColumn(index, row, value) {
  203. return " <span style=\"color: red;\">" + value + "</span>";
  204. }
  205. //Excel导出
  206. function RetakePlan_Export() {
  207. $("#formQuery").submit();
  208. }
  209. //联动查询
  210. function queryCourseCollege(data) {
  211. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  212. var departmentID = $("#DepartmentComboGrid").combogridX("getValue");
  213. var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + collegeID + "|@|";
  214. jsonString += "DepartmentComboGrid|*|" + departmentID + "|@|'})";
  215. $("#DepartmentComboGrid").combogridX("reload", eval(jsonString));
  216. reload();
  217. }