Misconduct.js 9.6 KB

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