ExecutableFreeSelectionCouse.js 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/ExecutableFreeSelectionCouse/Edit";
  2. var mnu = "";
  3. //加载
  4. $(function () {
  5. mnu = $.SystemGeneral.getUrlParam("MNU");
  6. })
  7. //新增
  8. function ExecutableFreeSelectionCouse_Add() {
  9. var d = validChoose();
  10. if (d.length > 0) {
  11. $.popupTopWindow('任选设定复制新增', CMS_SystemConfig.VirtualDirectoryPath + '/ExecutableFreeSelectionCouse/CopyAdd?sourceExecutableFreeSelectionCouseID=' + d[0] + '&MNU=' + mnu, 750, 550, null, null);
  12. } else {
  13. $.popupTopWindow('任选设定新增', CMS_SystemConfig.VirtualDirectoryPath + '/ExecutableFreeSelectionCouse/Edit?MNU=' + mnu, 750, 550, null, null);
  14. }
  15. }
  16. function reload() {
  17. $("#dgExecutableFreeSelectionCouseList").cmsXDataTable("load", $.getDataGridParams("dgExecutableFreeSelectionCouseList"));
  18. }
  19. //获取选中的数据
  20. function validChoose() {
  21. var d = [];
  22. var status = [];
  23. $.each($("#dgExecutableFreeSelectionCouseList").cmsXDataTable("getSelections"), function (index) {
  24. d.push(this.ExecutableFreeSelectionCouseID);
  25. });
  26. return d;
  27. }
  28. function validChooseIsOpened() {
  29. var d = [];
  30. var status = [];
  31. $.each($("#dgExecutableFreeSelectionCouseList").cmsXDataTable("getSelections"), function (index) {
  32. d.push(this.IsOpened);
  33. });
  34. return d;
  35. }
  36. function statusvalidChoose() {
  37. var d = [];
  38. $.each($("#dgExecutableFreeSelectionCouseList").cmsXDataTable("getSelections"), function (index) {
  39. d.push(this.RecordStatusCode);
  40. });
  41. return d;
  42. }
  43. //点击列表更新
  44. function edit(rowindex, rowdata) {
  45. $.popupTopWindow('任选设定信息', url + '?ExecutableFreeSelectionCouseID=' + rowdata.ExecutableFreeSelectionCouseID + '&MNU=' + mnu, 750, 550, null, null);
  46. }
  47. //详细信息
  48. function Details(rowindex, rowdata) {
  49. $.popupTopWindow('任选设定信息', CMS_SystemConfig.VirtualDirectoryPath + '/ExecutableFreeSelectionCouse/Details?ExecutableFreeSelectionCouseID=' + rowdata.ExecutableFreeSelectionCouseID + '&MNU=' + mnu, 750, 550, null, null);
  50. }
  51. //修改按钮
  52. function ExecutableFreeSelectionCouse_Update() {
  53. var d = validChoose();
  54. var r = statusvalidChoose();
  55. if (d.length == 0) {
  56. $.messager.alert("系统信息", "请选择您要修改的信息。");
  57. return;
  58. }
  59. if (d.length > 1) {
  60. $.messager.alert("系统信息", "只能选择单个记录进行修改。");
  61. return;
  62. }
  63. if (r[0] == CreatedStatus) {
  64. $.messager.alert("系统提示", "已开班状态的信息无法修改。");
  65. return;
  66. }
  67. $.popupTopWindow('任选设定修改', url + '?ExecutableFreeSelectionCouseID=' + d[0] + '&MNU=' + mnu, 750, 550, null, null);
  68. }
  69. //开放
  70. function ExecutableFreeSelectionCouse_Open() {
  71. var d = validChoose().join(',');
  72. if (d == "") {
  73. $.messager.alert("系统信息", "请选择您要开放的信息。");
  74. return;
  75. }
  76. var status = statusvalidChoose();
  77. for (var i = 0; i < status.length; i++) {
  78. if (status[i] != NotOpenStatus) {
  79. $.messager.alert("系统提示", "已开放状态的信息无法重复开放。");
  80. return;
  81. }
  82. }
  83. $.messager.confirm("系统提示", "您确定要对选择的任选设定进行开放?", function (r) {
  84. if (r) {
  85. $.post(CMS_SystemConfig.VirtualDirectoryPath + '/ExecutableFreeSelectionCouse/Open', { ExecutableFreeSelectionCouseIDs: d }, function (data) {
  86. $.messager.alert("系统提示", data.Message);
  87. if (data.IsSuccess == true) {
  88. $("#dgExecutableFreeSelectionCouseList").cmsXDataTable('load');
  89. }
  90. });
  91. }
  92. });
  93. }
  94. //取消开放
  95. function ExecutableFreeSelectionCouse_Cancel() {
  96. var d = validChoose().join(',');
  97. if (d == "") {
  98. $.messager.alert("系统信息", "请选择您要取消的信息。");
  99. return;
  100. }
  101. var status = statusvalidChoose();
  102. for (var i = 0; i < status.length; i++) {
  103. if (status[i] != OpenedStatus) {
  104. $.messager.alert("系统提示", "只能对已开放状态的信息进行取消。");
  105. return;
  106. }
  107. }
  108. $.messager.confirm("系统提示", "您确定要对选择的任选设定进行取消?", function (r) {
  109. if (r) {
  110. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ExecutableFreeSelectionCouse/Cancel', { ExecutableFreeSelectionCouseIDs: d }, function (data) {
  111. if (data.IsSuccess == true) {
  112. $("#dgExecutableFreeSelectionCouseList").cmsXDataTable('load');
  113. }
  114. $.messager.alert("系统提示", data.Message);
  115. });
  116. }
  117. });
  118. }
  119. //提交
  120. function ExecutableFreeSelectionCouse_Submit() {
  121. var d = validChoose().join(",");
  122. var r = statusvalidChoose();
  123. if (d == "") {
  124. $.messager.alert("系统提示", "请选择您要提交的信息。");
  125. return;
  126. }
  127. $.messager.confirm("系统提示", "您确定要对选择的任选设定进行提交?", function (r) {
  128. if (r) {
  129. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ExecutableFreeSelectionCouse/Submit', { executableFreeSelectionCouseIDs: d }, function (data) {
  130. if (data.IsSuccess == true) {
  131. $("#dgExecutableFreeSelectionCouseList").cmsXDataTable('load');
  132. }
  133. $.messager.alert("系统提示", data.Message);
  134. });
  135. }
  136. });
  137. }
  138. //删除
  139. function ExecutableFreeSelectionCouse_Delete() {
  140. var d = validChoose().join(',');
  141. var r = statusvalidChoose();
  142. if (d == "") {
  143. $.messager.alert("系统信息", "请选择您要删除的信息。");
  144. return;
  145. }
  146. for (var i = 0; i < r.length; i++) {
  147. if (r[i] == CreatedStatus) {
  148. $.messager.alert("系统提示", "已开班状态的信息无法删除。");
  149. return;
  150. }
  151. }
  152. $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) {
  153. if (r) {
  154. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ExecutableFreeSelectionCouse/Delete', { ExecutableFreeSelectionCouseIDs: d }, function (data) {
  155. if (data.IsSuccess == true) {
  156. $("#dgExecutableFreeSelectionCouseList").cmsXDataTable('load');
  157. }
  158. $.messager.alert("系统提示", data.Message);
  159. });
  160. }
  161. });
  162. }
  163. //Excel导出
  164. function ExecutableFreeSelectionCouse_Export() {
  165. $("#formQuery").submit();
  166. }
  167. //校区查询下拉
  168. function QueryCampusComboGridList() {
  169. var campusID = $("#CampusDropdown").combogridX("getValue");
  170. if (campusID != nonSelect) {
  171. var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|'})";
  172. $("#CollegeDropdown").combogridX("reload", eval(jsonString));
  173. }
  174. reload();
  175. }
  176. //院系所查询下拉
  177. function QueryCollegeComboGridList() {
  178. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  179. if (collegeID != nonSelect) {
  180. var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + collegeID + "|@|'})";
  181. $("#DepartmentDropdown").combogridX("reload", eval(jsonString));
  182. }
  183. reload();
  184. }
  185. //教研室查询下拉
  186. function QueryDepartmentComboGridList() {
  187. reload();
  188. }
  189. //弹出添加教师页面
  190. function addTeachers(rowindex, rowdata) {
  191. $.popupTopWindow('添加教师', CMS_SystemConfig.VirtualDirectoryPath + '/ExecutableFreeSelectionCouse/TeacherEdit?ExecutableFreeSelectionCouseID=' + rowdata.ExecutableFreeSelectionCouseID + '&MNU=' +
  192. mnu, 560, 480, AddTeachers_Confirm, rowdata);
  193. }
  194. //确定添加教师
  195. function AddTeachers_Confirm(data) {
  196. reload();
  197. }