StudentPunish.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/StudentPunish/Edit";
  2. var mnu = "";
  3. //加载
  4. $(function () {
  5. mnu = $.SystemGeneral.getUrlParam("MNU");
  6. })
  7. //刷新
  8. function reload() {
  9. $("#dgStudentPunishList").cmsXDataTable("load", $.getDataGridParams("dgStudentPunishList"));
  10. }
  11. //获取选中的数据All
  12. function validChooseAll() {
  13. var d = [];
  14. $.each($("#dgStudentPunishList").cmsXDataTable("getSelections"), function (index) {
  15. d.push(this);
  16. });
  17. return d;
  18. }
  19. //获取选中的数据
  20. function validChoose() {
  21. var d = [];
  22. $.each($("#dgStudentPunishList").cmsXDataTable("getSelections"), function (index) {
  23. d.push(this.StudentPunishID);
  24. });
  25. return d;
  26. }
  27. //获取选中的状态
  28. function validChooseStatus() {
  29. var d = [];
  30. $.each($("#dgStudentPunishList").cmsXDataTable("getSelections"), function (index) {
  31. d.push(this.ApprovalStatus);
  32. });
  33. return d;
  34. }
  35. //查看
  36. function edit(rowindex, rowdata) {
  37. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/StudentPunish/Edit?studentPunishID=" + rowdata.StudentPunishID + "&MNU=" + mnu + "&type=detail";
  38. $.popupTopWindow('学生处分信息', redirectTo, 620, 365, null, null);
  39. }
  40. //新增
  41. function StudentPunish_Add() {
  42. var d = validChoose();
  43. if (d.length > 0) {
  44. $.popupTopWindow('学生处分复制新增', CMS_SystemConfig.VirtualDirectoryPath + '/StudentPunish/CopyAdd?studentPunishID=' + d[0] + '&MNU=' + mnu, 620, 365, null, null);
  45. } else {
  46. var redirectTo = url + "?MNU=" + mnu;
  47. $.popupTopWindow('学生处分新增', redirectTo, 620, 365, null, null);
  48. }
  49. }
  50. //修改
  51. function StudentPunish_Edit() {
  52. var d = validChoose();
  53. if (d == "") {
  54. $.messager.alert("系统提示", "请选择您要修改的信息。");
  55. return;
  56. }
  57. if (d.length > 1) {
  58. $.messager.alert("系统提示", "只能选择单个记录进行修改。");
  59. return;
  60. }
  61. var id = validChooseAll();
  62. if ($.grep(id, function (v, i) { return !(v.ApprovalStatus == startStatusID || v.ApprovalStatus == sendBackStatusID); }).length > 0) {
  63. $.messager.alert("系统提示", "只能对未提交、已退回状态的信息进行修改。");
  64. return;
  65. }
  66. var redirectTo = url + "?studentPunishID=" + d + "&MNU=" + mnu + "&type=edit";
  67. $.popupTopWindow('学生处分修改', redirectTo, 620, 365, null, null);
  68. }
  69. //批量修改
  70. SystemBatchModifyControl.OnSubmit = function () {
  71. var status = validChooseStatus().join(',');
  72. for (var i = 0; i < status.split(',').length; i++) {
  73. if (!(status.split(',')[i] == startStatusID || status.split(',')[i] == sendBackStatusID)) {
  74. $.messager.alert("系统提示", "只能对未提交、已退回状态的信息进行修改。");
  75. return false;
  76. }
  77. }
  78. }
  79. //删除
  80. function StudentPunish_Delete() {
  81. var d = validChoose().join(',');
  82. if (d == "") {
  83. $.messager.alert("系统提示", "请选择您要删除的信息。");
  84. return;
  85. }
  86. $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) {
  87. if (r) {
  88. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/StudentPunish/Delete', { studentPunishIDs: d }, function (data) {
  89. if (data.IsSuccess) {
  90. $.messager.alert("系统提示", data.Message);
  91. $("#dgStudentPunishList").cmsXDataTable('load');
  92. } else {
  93. $.messager.alert("系统提示", data.Message);
  94. }
  95. });
  96. }
  97. });
  98. }
  99. //提交
  100. function StudentPunish_Submit() {
  101. var d = validChoose().join(',');
  102. if (d.length == 0) {
  103. $.messager.alert("系统提示", "请选择您要提交的信息。");
  104. return;
  105. }
  106. var id = validChooseAll();
  107. if ($.grep(id, function (v, i) { return !(v.ApprovalStatus == startStatusID || v.ApprovalStatus == sendBackStatusID); }).length > 0) {
  108. $.messager.alert("系统提示", "只能对未提交、已退回状态的信息进行提交。");
  109. return;
  110. }
  111. $.messager.confirm("系统提示", "您确定要对选择的信息进行提交?", function (r) {
  112. if (r) {
  113. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/StudentPunish/Submit', { studentPunishIDs: d }, function (data) {
  114. if (data.IsSuccess == true) {
  115. $.messager.alert("系统提示", data.Message);
  116. $("#dgStudentPunishList").cmsXDataTable('load');
  117. } else {
  118. $.messager.alert("系统提示", data.Message);
  119. }
  120. });
  121. }
  122. });
  123. }
  124. //审核
  125. function StudentPunish_Approve() {
  126. var d = validChooseAll();
  127. if (d.length == 0) {
  128. $.messager.alert("系统提示", "请选择您要审核的信息。");
  129. return;
  130. }
  131. if ($.grep(d, function (v, i) { return (v.ApprovalStatus == startStatusID || v.ApprovalStatus == sendBackStatusID || v.ApprovalStatus == passNoEndStatusID || v.ApprovalStatus == endStatusID); }).length > 0) {
  132. $.messager.alert("系统提示", "只能对待审核的信息进行审核。");
  133. return;
  134. }
  135. var status = d[0].ApprovalStatus;
  136. if ($.grep(d, function (v, i) { return v.ApprovalStatus != status; }).length > 0) {
  137. $.messager.alert("系统提示", "只能对相同状态的待审核的信息进行批量审核。");
  138. return;
  139. }
  140. var studentPunishIDs = validChoose();
  141. if (studentPunishIDs.length > 1) {
  142. //批量审核
  143. var approveID = studentPunishIDs[0];
  144. $.popupTopWindow('审核信息', CMS_SystemConfig.VirtualDirectoryPath + '/Common/ApproveHandler?TableName=EM_StudentPunish&FormID=' + approveID,
  145. 400, 300, StudentPunish_ApproveConfirm);
  146. }
  147. else {
  148. var studentPunishID = studentPunishIDs;
  149. //单个审核
  150. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/StudentPunish/Approve?MNU=" + mnu + "&studentPunishID=" + studentPunishID;
  151. $.popupTopWindow('学生处分审核', redirectTo, 620, 420, null, null);
  152. }
  153. }
  154. //确定(审核)
  155. function StudentPunish_ApproveConfirm(action) {
  156. if (!action) {
  157. return;
  158. }
  159. if (action.ActionID == "") {
  160. return;
  161. }
  162. var approveIDs = validChoose().join(',');
  163. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + "/StudentPunish/ApproveConfirm", { studentPunishIDs: approveIDs, actionID: action.Action, comment: action.Comment },
  164. function (data) {
  165. if (data.IsSuccess) {
  166. reload();
  167. }
  168. $.messager.alert("系统提示", data.Message);
  169. }, 'json');
  170. }
  171. //撤销
  172. function StudentPunish_Cancel() {
  173. var d = validChooseAll();
  174. if (d.length == 0) {
  175. $.messager.alert("系统提示", "请选择您要撤销的信息。");
  176. return;
  177. }
  178. if ($.grep(d, function (v, i) { return v.ApprovalStatus != passNoEndStatusID; }).length > 0) {
  179. $.messager.alert("系统提示", "只能对审核通过的信息进行撤销。");
  180. return;
  181. }
  182. var studentPunishIDs = validChoose();
  183. if (studentPunishIDs.length > 1) {
  184. //批量撤销
  185. var approveID = studentPunishIDs[0];
  186. $.popupTopWindow('撤销信息', CMS_SystemConfig.VirtualDirectoryPath + '/Common/ApproveHandler?TableName=EM_StudentPunish&FormID=' + approveID,
  187. 400, 300, StudentPunish_CancelConfirm);
  188. }
  189. else {
  190. var studentPunishID = studentPunishIDs;
  191. //单个撤销
  192. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/StudentPunish/Cancel?MNU=" + mnu + "&studentPunishID=" + studentPunishID;
  193. $.popupTopWindow('学生处分撤销', redirectTo, 620, 420, null, null);
  194. }
  195. }
  196. //确定(撤销)
  197. function StudentPunish_CancelConfirm(action) {
  198. if (!action) {
  199. return;
  200. }
  201. if (action.ActionID == "") {
  202. return;
  203. }
  204. var approveIDs = validChoose().join(',');
  205. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + "/StudentPunish/CancelConfirm", { studentPunishIDs: approveIDs, actionID: action.Action, comment: action.Comment },
  206. function (data) {
  207. if (data.IsSuccess) {
  208. reload();
  209. }
  210. $.messager.alert("系统提示", data.Message);
  211. }, 'json');
  212. }
  213. //查看
  214. function cancel(rowindex, rowdata) {
  215. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/StudentPunish/Cancel?studentPunishID=" + rowdata.StudentPunishID + "&MNU=" + mnu + "&type=detail";
  216. $.popupTopWindow('学生处分信息', redirectTo, 620, 365, null, null);
  217. }
  218. //Excel导出
  219. function StudentPunish_Export() {
  220. $("#formQuery").submit();
  221. }
  222. //联动查询
  223. function queryCampus(data) {
  224. var campusID = $("#CampusDropdown").combogridX("getValue");
  225. var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|'})";
  226. $("#CollegeDropdown").combogridX("reload", eval(jsonString));
  227. queryClass();
  228. }
  229. function queryCollege(data) {
  230. var campusID = $("#CampusDropdown").combogridX("getValue");
  231. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  232. var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|";
  233. jsonString += "CollegeDropdown|*|" + collegeID + "|@|'})";
  234. $("#CollegeDropdown").combogridX("reload", eval(jsonString));
  235. $("#DictionaryStandard").combogridX("reload", eval(jsonString));
  236. queryClass();
  237. }
  238. function queryGrade(data) {
  239. queryClass();
  240. }
  241. function queryStandard(data) {
  242. queryClass();
  243. }
  244. function queryLearnSystem(data) {
  245. queryClass();
  246. }
  247. function queryClass() {
  248. var jsonString = "";
  249. var parameterString = "";
  250. var campusID = $("#CampusDropdown").combogridX("getValue");
  251. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  252. var gradeID = $("#DictionaryGrade").combogridX("getValue");
  253. var standardID = $("#DictionaryStandard").combogridX("getValue");
  254. var educationID = $("#DictionaryEducation").combogridX("getValue");
  255. var learningformID = $("#DictionaryLearningform").combogridX("getValue");
  256. var learnSystem = $("#DictionaryLearnSystem").combogridX("getValue");
  257. if (campusID != nonSelect) parameterString += "CampusDropdown|*|" + campusID + "|@|";
  258. if (collegeID != nonSelect) parameterString += "CollegeDropdown|*|" + collegeID + "|@|";
  259. if (gradeID != nonSelect) parameterString += "DictionaryGrade|*|" + gradeID + "|@|";
  260. if (standardID != nonSelect) parameterString += "DictionaryStandard|*|" + standardID + "|@|";
  261. if (educationID != nonSelect) parameterString += "DictionaryEducation|*|" + educationID + "|@|";
  262. if (learningformID != nonSelect) parameterString += "DictionaryLearningform|*|" + learningformID + "|@|";
  263. if (learnSystem != nonSelect) parameterString += "DictionaryLearnSystem|*|" + learnSystem + "|@|";
  264. if (parameterString != "") {
  265. jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
  266. $("#DictionaryStandard").combogridX("reload", eval(jsonString));
  267. }
  268. else {
  269. $("#DictionaryStandard").combogridX("reload");
  270. }
  271. reload();
  272. }