ExaminationExemption.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/ExaminationExemption/Edit";
  2. var mnu = "";
  3. //加载
  4. $(function () {
  5. mnu = $.SystemGeneral.getUrlParam("MNU");
  6. })
  7. function reload() {
  8. $("#dgExaminationExemptionList").cmsXDataTable("load", $.getDataGridParams("dgExaminationExemptionList"));
  9. }
  10. //免考名单导出
  11. function ExaminationExemption_Export() {
  12. $("#formQuery").submit();
  13. }
  14. //获取选中的数据
  15. function validChoose() {
  16. var d = [];
  17. $.each($("#dgExaminationExemptionList").cmsXDataTable("getSelections"), function (index) {
  18. d.push(this);
  19. });
  20. return d;
  21. }
  22. //获取选中的数据
  23. function validChooseID() {
  24. var d = [];
  25. $.each($("#dgExaminationExemptionList").cmsXDataTable("getSelections"), function (index) {
  26. d.push(this.ExaminationExemptionID);
  27. });
  28. return d;
  29. }
  30. function ExaminationExemption_Add() {
  31. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/ExaminationExemption/TeacherEdit" + "?MNU=" + mnu;
  32. $.popupTopWindow('免考申请', redirectTo, 600, 250, null, null);
  33. }
  34. function ExaminationExemption_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 + "/ExaminationExemption/TeacherEdit" + "?examinationExemptionID=" + id + "&MNU=" + mnu + "&type=edit";
  51. $.popupTopWindow('免考申请修改', redirectTo, 600, 250, null, null);
  52. }
  53. function applyEdit(rowindex, rowdata) {
  54. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/ExaminationExemption/applyEdit" + "?examinationExemptionID=" + rowdata.ExaminationExemptionID + "&MNU=" + mnu;
  55. $.popupTopWindow('申请原因', redirectTo, 440, 230, null, null);
  56. }
  57. //审核
  58. function ExaminationExemption_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_ExaminationExemption&FormID=' + firstID,
  86. 400, 300, ExaminationExemption_Approve_Confirm);
  87. }
  88. function ExaminationExemption_Approve_Confirm(action) {
  89. if (!action) return;
  90. if (action.ActionID == "") return;
  91. var approveIDs = validChooseID().join(',');
  92. $.post(CMS_SystemConfig.VirtualDirectoryPath + "/ExaminationExemption/Approve", { examinationExemptionIDs: 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 ExaminationExemption_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 examinationExemptionIDs = $.map(d, function (x) { return x.ExaminationExemptionID; }).join(',');
  113. $.messager.confirm("系统提示", "您确定要删除该免考申请信息?", function (r) {
  114. if (r) {
  115. $.post(CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationExemption/Delete', { examinationExemptionIDs: examinationExemptionIDs },
  116. function (data) {
  117. if (data.IsSuccess) {
  118. $.messager.alert("系统提示", "删除成功。");
  119. $("#dgExaminationExemptionList").cmsXDataTable('load');
  120. } else {
  121. $.messager.alert("系统提示", data.Message);
  122. }
  123. });
  124. }
  125. });
  126. }
  127. //提交
  128. function ExaminationExemption_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 examinationExemptionIDs = $.map(d, function (x) { return x.ExaminationExemptionID; }).join(',');
  139. $.post(CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationExemption/Submit', { examinationExemptionIDs: examinationExemptionIDs }, function (data) {
  140. if (data.IsSuccess) {
  141. $.messager.alert("系统提示", "提交成功!");
  142. $("#dgExaminationExemptionList").cmsXDataTable('load');
  143. } else {
  144. $.messager.alert("系统提示", data.Message);
  145. }
  146. });
  147. }
  148. //撤销
  149. function ExaminationExemption_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.ExaminationExemptionID; }).join(',');
  171. $.messager.confirm("系统提示", "您确定要撤销该免考申请信息?", function (r) {
  172. if (r) {
  173. $.post(CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationExemption/Cancel', { examinationExemptionIDs: approveIDs, comment: $("[name='Comment']").val() }, function (data) {
  174. if (data.IsSuccess) {
  175. $.messager.alert("系统提示", "撤销成功!");
  176. $("#dgExaminationExemptionList").cmsXDataTable('load');
  177. } else {
  178. $.messager.alert("系统提示", data.Message);
  179. }
  180. });
  181. }
  182. });
  183. }
  184. //获取列表字段查询对应比较符
  185. function GetDynamicCondition() {
  186. var attribute = eval('(' + $("[name='Attribute']").val() + ')').Value;
  187. var conditionString = $("[name='Condition']").val();
  188. var value = $("[name='Condition']").parent().parent().next().find("[name^=" + attribute + "]").val();
  189. value = $.trim(value);
  190. var sql = "";
  191. if (conditionString == "=" || conditionString == ">" || conditionString == "<" || conditionString == "<>") {
  192. sql = attribute + conditionString + value;
  193. } else if (conditionString == "左") {
  194. sql = attribute + " like '" + value + "%'";
  195. } else if (conditionString == "右") {
  196. sql = attribute + " like '%" + value + "'";
  197. } else if (conditionString == "中") {
  198. sql = attribute + " like '%" + value + "%'";
  199. }
  200. return sql;
  201. }
  202. function ExaminationExemption_Report() {
  203. var d = [];
  204. $.each($("#dgExaminationExemptionList").cmsXDataTable("getSelections"), function (index) {
  205. d.push(this.UserID);
  206. });
  207. var SchoolyearID = $("#ddlSchoolYear").combobox("getValue");
  208. var CollegeID = $("#cbgCollege").combogridX("getValue");
  209. var Year = $("#ddlYear").combobox("getValue");
  210. var StandardID = $("#cbgStandard").combogridX("getValue");
  211. var EducationID = $("#DictionaryEducation").combogridX("getValue");
  212. var LearningformID = $("#LearningformDictionaryDropDown").combogridX("getValue");
  213. var LearnSystem = $("#DictionaryLearnSystem").combogridX("getValue");
  214. var ClassmajorID = $("#cbgClassmajor").combogridX("getValue");
  215. var ApprovalStatus = $("#ddlRecordStatus").combogridX("getValue");
  216. var sql = GetDynamicCondition();
  217. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationExemption/ExaminationExemptionReport?MNU=' + mnu;
  218. var id = d.join(",");
  219. var windowDiv = $.popupTopWindow('免修申请打印', redirectTo, 951, 750, null,{
  220. schoolyearID: SchoolyearID,
  221. collegeID: CollegeID,
  222. year: (Year == nonSelect) ? null : Year,
  223. standardID: StandardID,
  224. educationID: EducationID,
  225. learningformID: LearningformID,
  226. learnSystem: LearnSystem,
  227. classmajorID: ClassmajorID,
  228. approvalStatus: ApprovalStatus,
  229. conditionString: sql,
  230. ids: id
  231. });
  232. }
  233. //退回
  234. //function ExaminationExemption_Rollback() {
  235. // var d = validChoose();
  236. // if (d.length == 0) {
  237. // $.messager.alert("系统提示", "请选择您要退回的免考申请!");
  238. // return;
  239. // }
  240. // var recordstatus = d[0].RecordStatus;
  241. // if ($.grep(d, function (v, i) { return v.RecordStatus != recordstatus; }).length > 0) {
  242. // $.messager.alert("系统提示", "请选择相同状态的记录进行退回!");
  243. // return;
  244. // }
  245. // if ($.grep(d, function (v, i) { return v.RecordStatus == startStatusID; }).length > 0) {
  246. // $.messager.alert("系统提示", "所选的免考申请有部分未提交,请先提交在退回。");
  247. // return;
  248. // }
  249. // var approveIDs = $.map(d, function (x) { return x.ExaminationExemptionID; }).join(',');
  250. // $.post(CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationExemption/Rollback', { examinationExemptionIDs: approveIDs, comment: $("[name='Comment']").val() }, function (data) {
  251. // if (data.IsSuccess) {
  252. // $.messager.alert("系统提示", "退回成功!");
  253. // $("#dgExaminationExemptionList").cmsXDataTable('load');
  254. // } else {
  255. // $.messager.alert("系统提示", data.Message);
  256. // }
  257. // });
  258. //}
  259. function queryStandard() {
  260. if ($.data($("#cbgCollege")[0], "combogridX") && $.data($("#ddlYear")[0], "combobox")) {
  261. var parameterString = "";
  262. var collegeID = $("#cbgCollege").combogridX("getValue");
  263. var year = $("#ddlYear").combobox("getValue");
  264. if (collegeID != nonSelect && collegeID != "") parameterString += "CollegeDropdown|*|" + collegeID + "|@|";
  265. if (year != nonSelect) parameterString += "DictionaryGrade|*|" + year + "|@|";
  266. if (parameterString != "") {
  267. jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
  268. $("#cbgStandard").combogridX("reload", eval(jsonString));
  269. } else {
  270. $("#cbgStandard").combogridX("reload");
  271. }
  272. }
  273. }
  274. function queryClassmajor() {
  275. if ($.data($("#cbgCollege")[0], "combogridX") && $.data($("#ddlYear")[0], "combobox") && $.data($("#cbgStandard")[0], "combogridX")) {
  276. var parameterString = "";
  277. var collegeID = $("#cbgCollege").combogridX("getValue");
  278. var year = $("#ddlYear").combobox("getValue");
  279. var standard = $("#cbgStandard").combogridX("getValue");
  280. var educationID = $("#DictionaryEducation").combobox("getValue");
  281. var LearnSystem = $("#DictionaryLearnSystem").combogridX("getValue");
  282. var learningFormID = $("#LearningformDictionaryDropDown").combobox("getValue");
  283. if (collegeID != nonSelect && collegeID != "") parameterString += "CollegeDropdown|*|" + collegeID + "|@|";
  284. if (year != nonSelect) parameterString += "DictionaryGrade|*|" + year + "|@|";
  285. if (standard != nonSelect && standard != "") parameterString += "DictionaryStandard|*|" + standard + "|@|";
  286. if (educationID != nonSelect) parameterString += "DictionaryEducation|*|" + educationID + "|@|";
  287. if (learningFormID != nonSelect) parameterString += "DictionaryLearningform|*|" + learningFormID + "|@|";
  288. if (LearnSystem != nonSelect) parameterString += "DictionaryLearnSystem|*|" + LearnSystem + "|@|";
  289. if (parameterString != "") {
  290. jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
  291. $("#cbgClassmajor").combogridX("reload", eval(jsonString));
  292. } else {
  293. $("#cbgClassmajor").combogridX("reload");
  294. }
  295. }
  296. }