ExaminationSuspension.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/ExaminationSuspension/Edit";
  2. var mnu = "";
  3. //加载
  4. $(function () {
  5. mnu = $.SystemGeneral.getUrlParam("MNU");
  6. })
  7. function reload() {
  8. $("#dgExaminationSuspensionList").cmsXDataTable("load", $.getDataGridParams("dgExaminationSuspensionList"));
  9. }
  10. //缓考名单导出
  11. function ExaminationSuspension_Export() {
  12. $("#formQuery").submit();
  13. }
  14. //获取选中的数据
  15. function validChoose() {
  16. var d = [];
  17. $.each($("#dgExaminationSuspensionList").cmsXDataTable("getSelections"), function (index) {
  18. d.push(this);
  19. });
  20. return d;
  21. }
  22. //获取选中的数据
  23. function validChooseID() {
  24. var d = [];
  25. $.each($("#dgExaminationSuspensionList").cmsXDataTable("getSelections"), function (index) {
  26. d.push(this.ExaminationSuspensionID);
  27. });
  28. return d;
  29. }
  30. function ExaminationSuspension_Add() {
  31. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/ExaminationSuspension/TeacherEdit" + "?MNU=" + mnu;
  32. $.popupTopWindow('缓考申请', redirectTo, 600, 250, null, null);
  33. }
  34. function ExaminationSuspension_Edit() {
  35. var id = validChooseID();
  36. if (id.length == 0) {
  37. $.messager.alert("系统提示", "请选择您要修改的缓考申请!");
  38. return;
  39. }
  40. if (id.length > 1) {
  41. $.messager.alert("系统提示", "只能选择一条缓考申请修改!");
  42. return;
  43. }
  44. var d = validChoose();
  45. var recordstatus = d[0].RecordStatus;
  46. if ($.grep(d, function (v, i) { return v.RecordStatus != startStatusID; }).length > 0) {
  47. $.messager.alert("系统提示", "所选的缓考申请有部分已经提交,无法修改。");
  48. return;
  49. }
  50. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/ExaminationSuspension/TeacherEdit" + "?examinationSuspensionID=" + id + "&MNU=" + mnu + "&type=edit";
  51. $.popupTopWindow('缓考申请修改', redirectTo, 600, 250, null, null);
  52. }
  53. function applyEdit(rowindex, rowdata) {
  54. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/ExaminationSuspension/applyEdit" + "?examinationSuspensionID=" + rowdata.ExaminationSuspensionID + "&MNU=" + mnu;
  55. $.popupTopWindow('申请原因', redirectTo, 440, 230, null, null);
  56. }
  57. //审核
  58. function ExaminationSuspension_Approve() {
  59. var d = validChoose();
  60. if (d.length == 0) {
  61. $.messager.alert("系统提示", "请选择您要审核的缓考申请!");
  62. return;
  63. }
  64. var recordstatus = d[0].RecordStatus;
  65. if ($.grep(d, function (v, i) { return v.RecordStatus != recordstatus; }).length > 0) {
  66. $.messager.alert("系统提示", "请选择相同状态的记录进行审核!");
  67. return;
  68. }
  69. if ($.grep(d, function (v, i) { return v.RecordStatus == startStatusID; }).length > 0) {
  70. $.messager.alert("系统提示", "所选的缓考申请有部分未提交,请先提交在审核。");
  71. return;
  72. }
  73. for (var i = 0; i < d.length; i++) {
  74. if (d[i].RecordStatus == 3) {
  75. $.messager.alert("系统提示", "缓考申请已审核如要撤销请点击撤销按钮!");
  76. return;
  77. }
  78. if (d[i].RecordStatus == 4) {
  79. $.messager.alert("系统提示", "缓考申请已撤销请勿重复操作!");
  80. return;
  81. }
  82. }
  83. var approveIDs = validChooseID();
  84. var firstID = approveIDs[0];
  85. $.popupTopWindow('审核信息', CMS_SystemConfig.VirtualDirectoryPath + '/Common/ApproveHandler?TableName=ER_ExaminationSuspension&FormID=' + firstID,
  86. 400, 300, ExaminationSuspension_Approve_Confirm);
  87. }
  88. function ExaminationSuspension_Approve_Confirm(action) {
  89. if (!action) return;
  90. if (action.ActionID == "") return;
  91. var approveIDs = validChooseID().join(',');
  92. $.post(CMS_SystemConfig.VirtualDirectoryPath + "/ExaminationSuspension/Approve", { examinationSuspensionIDs: approveIDs, actionID: action.Action, comment: action.Comment },
  93. function (data) {
  94. $.messager.alert("系统提示", data.Message);
  95. if (data.IsSuccess) {
  96. reload();
  97. }
  98. }, 'json');
  99. }
  100. //删除
  101. function ExaminationSuspension_Delete() {
  102. var d = validChoose();
  103. if (d.length == 0) {
  104. $.messager.alert("系统提示", "请选择您要删除的缓考申请。");
  105. return;
  106. }
  107. var recordstatus = d[0].RecordStatus;
  108. if ($.grep(d, function (v, i) { return v.RecordStatus != startStatusID; }).length > 0) {
  109. $.messager.alert("系统提示", "所选的缓考申请有部分已经提交,无法删除。");
  110. return;
  111. }
  112. var examinationSuspensionIDs = $.map(d, function (x) { return x.ExaminationSuspensionID; }).join(',');
  113. $.messager.confirm("系统提示", "您确定要删除该缓考申请信息?", function (r) {
  114. if (r) {
  115. $.post(CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationSuspension/Delete', { examinationSuspensionIDs: examinationSuspensionIDs },
  116. function (data) {
  117. if (data.IsSuccess) {
  118. $.messager.alert("系统提示", "删除成功。");
  119. $("#dgExaminationSuspensionList").cmsXDataTable('load');
  120. } else {
  121. $.messager.alert("系统提示", data.Message);
  122. }
  123. });
  124. }
  125. });
  126. }
  127. //提交
  128. function ExaminationSuspension_Submit() {
  129. var d = validChoose();
  130. if (d.length == 0) {
  131. $.messager.alert("系统提示", "请选择您要提交的缓考申请。");
  132. return;
  133. }
  134. if ($.grep(d, function (v, i) { return v.RecordStatus != startStatusID; }).length > 0) {
  135. $.messager.alert("系统提示", "所选的缓考申请有部分已经提交,无法再次提交。");
  136. return;
  137. }
  138. var examinationSuspensionIDs = $.map(d, function (x) { return x.ExaminationSuspensionID; }).join(',');
  139. $.post(CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationSuspension/Submit', { examinationSuspensionIDs: examinationSuspensionIDs }, function (data) {
  140. if (data.IsSuccess) {
  141. $.messager.alert("系统提示", "提交成功!");
  142. $("#dgExaminationSuspensionList").cmsXDataTable('load');
  143. } else {
  144. $.messager.alert("系统提示", data.Message);
  145. }
  146. });
  147. }
  148. //撤销
  149. function ExaminationSuspension_Cancel() {
  150. var d = validChoose();
  151. if (d.length == 0) {
  152. $.messager.alert("系统提示", "请选择您要撤销的缓考申请!");
  153. return;
  154. }
  155. var recordstatus = d[0].RecordStatus;
  156. if ($.grep(d, function (v, i) { return v.RecordStatus != recordstatus; }).length > 0) {
  157. $.messager.alert("系统提示", "请选择相同状态的记录进行撤销!");
  158. return;
  159. }
  160. for (var i = 0; i < d.length; i++) {
  161. if (d[i].RecordStatus < 3) {
  162. $.messager.alert("系统提示", "只能撤销完成审核的缓考申请!");
  163. return;
  164. }
  165. if (d[i].RecordStatus == 4) {
  166. $.messager.alert("系统提示", "缓考申请已撤销请勿重复操作!");
  167. return;
  168. }
  169. }
  170. var approveIDs = $.map(d, function (x) { return x.ExaminationSuspensionID; }).join(',');
  171. $.messager.confirm("系统提示", "您确定要撤销该缓考申请信息?", function (r) {
  172. if (r) {
  173. $.post(CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationSuspension/Cancel', { examinationSuspensionIDs: approveIDs, comment: $("[name='Comment']").val() }, function (data) {
  174. if (data.IsSuccess) {
  175. $.messager.alert("系统提示", "撤销成功!");
  176. $("#dgExaminationSuspensionList").cmsXDataTable('load');
  177. } else {
  178. $.messager.alert("系统提示", data.Message);
  179. }
  180. });
  181. }
  182. });
  183. }
  184. //退回
  185. //function ExaminationSuspension_Rollback() {
  186. // var d = validChoose();
  187. // if (d.length == 0) {
  188. // $.messager.alert("系统提示", "请选择您要退回的缓考申请!");
  189. // return;
  190. // }
  191. // var recordstatus = d[0].RecordStatus;
  192. // if ($.grep(d, function (v, i) { return v.RecordStatus != recordstatus; }).length > 0) {
  193. // $.messager.alert("系统提示", "请选择相同状态的记录进行退回!");
  194. // return;
  195. // }
  196. // if ($.grep(d, function (v, i) { return v.RecordStatus == startStatusID; }).length > 0) {
  197. // $.messager.alert("系统提示", "所选的缓考申请有部分未提交,请先提交在退回。");
  198. // return;
  199. // }
  200. // var approveIDs = $.map(d, function (x) { return x.ExaminationSuspensionID; }).join(',');
  201. // $.post(CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationSuspension/Rollback', { examinationSuspensionIDs: approveIDs, comment: $("[name='Comment']").val() }, function (data) {
  202. // if (data.IsSuccess) {
  203. // $.messager.alert("系统提示", "退回成功!");
  204. // $("#dgExaminationSuspensionList").cmsXDataTable('load');
  205. // } else {
  206. // $.messager.alert("系统提示", data.Message);
  207. // }
  208. // });
  209. //}
  210. function queryStandard() {
  211. if ($.data($("#cbgCollege")[0], "combogridX") && $.data($("#ddlYear")[0], "combobox")) {
  212. var parameterString = "";
  213. var collegeID = $("#cbgCollege").combogridX("getValue");
  214. var year = $("#ddlYear").combobox("getValue");
  215. if (collegeID != nonSelect && collegeID != "") parameterString += "CollegeDropdown|*|" + collegeID + "|@|";
  216. if (year != nonSelect) parameterString += "DictionaryGrade|*|" + year + "|@|";
  217. if (parameterString != "") {
  218. jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
  219. $("#cbgStandard").combogridX("reload", eval(jsonString));
  220. } else {
  221. $("#cbgStandard").combogridX("reload");
  222. }
  223. }
  224. }
  225. function queryClassmajor() {
  226. if ($.data($("#cbgCollege")[0], "combogridX") && $.data($("#ddlYear")[0], "combobox") && $.data($("#cbgStandard")[0], "combogridX")) {
  227. var parameterString = "";
  228. var collegeID = $("#cbgCollege").combogridX("getValue");
  229. var year = $("#ddlYear").combobox("getValue");
  230. var standard = $("#cbgStandard").combogridX("getValue");
  231. var educationID = $("#DictionaryEducation").combobox("getValue");
  232. var LearnSystem = $("#DictionaryLearnSystem").combogridX("getValue");
  233. var learningFormID = $("#LearningformDictionaryDropDown").combobox("getValue");
  234. if (collegeID != nonSelect && collegeID != "") parameterString += "CollegeDropdown|*|" + collegeID + "|@|";
  235. if (year != nonSelect) parameterString += "DictionaryGrade|*|" + year + "|@|";
  236. if (standard != nonSelect && standard != "") parameterString += "DictionaryStandard|*|" + standard + "|@|";
  237. if (educationID != nonSelect) parameterString += "DictionaryEducation|*|" + educationID + "|@|";
  238. if (learningFormID != nonSelect) parameterString += "DictionaryLearningform|*|" + learningFormID + "|@|";
  239. if (LearnSystem != nonSelect) parameterString += "DictionaryLearnSystem|*|" + LearnSystem + "|@|";
  240. if (parameterString != "") {
  241. jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
  242. $("#cbgClassmajor").combogridX("reload", eval(jsonString));
  243. } else {
  244. $("#cbgClassmajor").combogridX("reload");
  245. }
  246. }
  247. }