FreeSelectionCourseApply.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/FreeSelectionCourseApply/Edit";
  2. var mnu = "";
  3. //加载
  4. $(function () {
  5. mnu = $.SystemGeneral.getUrlParam("MNU");
  6. })
  7. //弹出新增信息页面
  8. function FreeSelectionCourseApply_Add() {
  9. redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/FreeSelectionCourseApply/Edit?MNU=" + mnu;
  10. $.popupTopWindow("开课申请新增", redirectTo, 750, 550, null, null);
  11. }
  12. function reload() {
  13. $("#dgFreeSelectionCourseApplyList").cmsXDataTable("load", $.getDataGridParams("dgFreeSelectionCourseApplyList"));
  14. }
  15. //获取选中的数据
  16. function validChoose() {
  17. var d = [];
  18. var status = [];
  19. $.each($("#dgFreeSelectionCourseApplyList").cmsXDataTable("getSelections"), function (index) {
  20. d.push(this.FreeSelectionCouseApplyID);
  21. status.push(this.ApprovalStatus);
  22. });
  23. $("#hid_ApprovalStatus").val(status.join(','));
  24. return d;
  25. }
  26. //弹出信息修改页面
  27. function edit(rowindex, rowdata) {
  28. redirectTo = url + "?freeSelectionCourseApplyID=" + rowdata.FreeSelectionCouseApplyID + "&MNU=" + mnu;
  29. $.popupTopWindow("开课申请修改", redirectTo, 750, 550, null, null);
  30. }
  31. //弹出明细信息页面
  32. function Details(rowindex, rowdata) {
  33. redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/FreeSelectionCourseApply/Details?MNU=" + mnu + "&freeSelectionCourseApplyID=" + rowdata.FreeSelectionCouseApplyID + "&MNU=" + mnu;
  34. $.popupTopWindow("开课申请信息", redirectTo, 750, 550, null, null);
  35. }
  36. //修改按钮
  37. function FreeSelectionCourseApply_Update() {
  38. var d = validChoose();
  39. if (d.length == 0) {
  40. $.messager.alert("系统信息", "请选择您要修改的信息。");
  41. return;
  42. }
  43. if (d.length > 1) {
  44. $.messager.alert("系统信息", "只能选择单个记录进行修改。");
  45. return;
  46. }
  47. redirectTo = url + "?freeSelectionCourseApplyID=" + d + "&MNU=" + mnu;
  48. $.popupTopWindow("开课申请修改", redirectTo, 800, 600, null, null);
  49. }
  50. //删除
  51. function FreeSelectionCourseApply_Cancel() {
  52. var d = validChoose().join(',');
  53. var status = $("#hid_ApprovalStatus").val();
  54. if (d == "") {
  55. $.messager.alert("系统信息", "请选择您要删除的信息。");
  56. return;
  57. }
  58. for (var i = 0; i < status.split(',').length; i++) {
  59. if (status.split(',')[i] != "") {
  60. if (status.split(',')[i] != "1" && status.split(',')[i] != "5") {
  61. $.messager.alert("系统信息", "系统提示,只能对未提交和已退回状态的信息进行删除。");
  62. return;
  63. }
  64. }
  65. }
  66. $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) {
  67. if (r) {
  68. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/FreeSelectionCourseApply/Delete', { freeSelectionCourseApplyIDs: d }, function (data) {
  69. if (data == "删除成功!") {
  70. $.messager.alert("系统提示", data);
  71. $("#dgFreeSelectionCourseApplyList").cmsXDataTable('load');
  72. } else {
  73. $.messager.alert("系统提示", data);
  74. }
  75. });
  76. }
  77. });
  78. }
  79. //提交
  80. function FreeSelectionCourseApply_Submit() {
  81. var d = validChoose().join(',');
  82. var status = $("#hid_ApprovalStatus").val();
  83. if (d == "") {
  84. $.messager.alert("系统信息", "请选择您要提交的信息。");
  85. return;
  86. }
  87. for (var i = 0; i < status.split(',').length; i++) {
  88. if (status.split(',')[i] != "") {
  89. //取消申请或者结束流程
  90. if (status.split(',')[i] == "4") {
  91. $.messager.alert("系统提示", "抱歉,您提交申请中存已存审批状态为“已结束”的申请单,请重新选择提交。");
  92. return;
  93. }
  94. }
  95. }
  96. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/FreeSelectionCourseApply/SubmitFreeSelectionCourseApply', { freeSelectionCourseApplyIDs: d }, function (data) {
  97. if (data == "提交成功!") {
  98. $.messager.alert("系统提示", data);
  99. $("#dgFreeSelectionCourseApplyList").cmsXDataTable('load');
  100. } else {
  101. $.messager.alert("系统提示", data);
  102. }
  103. });
  104. }
  105. //Excel导出
  106. function FreeSelectionCourseApply_Export() {
  107. $("#formQuery").submit();
  108. }
  109. //校区查询下拉
  110. function QueryCampusComboGridList() {
  111. var campusID = $("#CampusDropdown").combogridX("getValue");
  112. if (campusID != nonSelect) {
  113. var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|'})";
  114. $("#CollegeDropdown").combogridX("reload", eval(jsonString));
  115. }
  116. reload();
  117. }
  118. //院系所查询下拉
  119. function QueryCollegeComboGridList() {
  120. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  121. if (collegeID != nonSelect) {
  122. var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + collegeID + "|@|'})";
  123. $("#DepartmentDropdown").combogridX("reload", eval(jsonString));
  124. }
  125. reload();
  126. }
  127. //教研室查询下拉
  128. function QueryDepartmentComboGridList() {
  129. reload();
  130. }
  131. //弹出添加教师页面
  132. function addTeachers(rowindex, rowdata) {
  133. $.popupTopWindow('教师信息', CMS_SystemConfig.VirtualDirectoryPath + '/FreeSelectionCourseApply/TeacherEdit?FreeSelectionCourseApplyID=' + rowdata.FreeSelectionCouseApplyID + '&MNU=' +
  134. mnu, 560, 480, AddTeachers_Confirm, rowdata);
  135. }
  136. //确定添加教师
  137. function AddTeachers_Confirm(data) {
  138. reload();
  139. }