SpecialtyClassSetting.js 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/SpecialtyClassSetting/Edit";
  2. var mnu = "";
  3. //加载
  4. $(function () {
  5. mnu = $.SystemGeneral.getUrlParam("MNU");
  6. })
  7. //刷新
  8. function reload() {
  9. $("#dgSpecialtyClassSettingList").cmsXDataTable("load", $.getDataGridParams("dgSpecialtyClassSettingList"));
  10. }
  11. //获取选中的数据
  12. function validChoose() {
  13. var d = [];
  14. $.each($("#dgSpecialtyClassSettingList").cmsXDataTable("getSelections"), function (index) {
  15. d.push(this.SpecialtyClassSettingID);
  16. });
  17. return d;
  18. }
  19. //新增
  20. function SpecialtyClassSetting_Add() {
  21. //var d = validChoose();
  22. //if (d.length > 0) {
  23. // $.popupTopWindow('专业分班复制新增', CMS_SystemConfig.VirtualDirectoryPath + '/SpecialtyClassSetting/CopyAdd?specialtyClassSettingID=' + d[0] + '&MNU=' + mnu, 600, 300, null, null);
  24. //} else {
  25. // var redirectTo = url + "?MNU=" + mnu;
  26. // $.popupTopWindow('专业分班新增', redirectTo, 600, 300, null, null);
  27. //}
  28. //采用以下方式进行新增
  29. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/SpecialtyClassSetting/SpecialtyClassSettingBatchAdd" + "?MNU=" + mnu;
  30. $.popupTopWindow('专业分班新增', redirectTo, 750, 500, reload, null);
  31. }
  32. //修改按钮
  33. function SpecialtyClassSetting_Update() {
  34. var d = validChoose();
  35. if (d == "") {
  36. $.messager.alert("系统提示", "请选择您要修改的信息。");
  37. return;
  38. }
  39. if (d.length > 1) {
  40. $.messager.alert("系统提示", "只能选择单个记录进行修改。");
  41. return;
  42. }
  43. var redirectTo = url + "?specialtyClassSettingID=" + d + "&MNU=" + mnu + "&type=edit";
  44. $.popupTopWindow('专业分班修改', redirectTo, 600, 300, null, null);
  45. }
  46. //查看
  47. function edit(rowindex, rowdata) {
  48. var redirectTo = url + "?specialtyClassSettingID=" + rowdata.SpecialtyClassSettingID + "&MNU=" + mnu + "&type=detail";
  49. $.popupTopWindow('专业分班信息', redirectTo, 600, 300, null, null);
  50. }
  51. //批量修改(重写)
  52. SystemBatchModifyControl.OnSubmit = function () {
  53. //计划招生人数
  54. if (document.getElementById("PlanRecruitStudentCountNumberBox_div").style.display != "none") {
  55. var planRecruitStudentCount = $("#PlanRecruitStudentCount_NumberBox").val();
  56. if (planRecruitStudentCount == null || planRecruitStudentCount == "") {
  57. $.messager.alert("系统提示", "请输入计划招生人数。");
  58. return false;
  59. }
  60. //非负的整数(/^\d+$/)
  61. var reg = /^\d+$/;
  62. if (!reg.test(planRecruitStudentCount)) {
  63. $.messager.alert("系统提示", "请输入非负整数。");
  64. return false;
  65. }
  66. var d = validChoose().join(',');
  67. if (d == "") {
  68. return;
  69. }
  70. if (parseInt(planRecruitStudentCount) >= 0) {
  71. $.messager.confirm("系统提示", "您确定要批量修改选择的信息吗?", function (r) {
  72. if (r) {
  73. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/SpecialtyClassSetting/BatchModifyControl', { specialtyClassSettingIDs: d, planRecruitStudentCount: planRecruitStudentCount, classArrangeStudentCount: classArrangeStudentCount, classMaxStudentCount: classMaxStudentCount }, function (data) {
  74. if (data.IsSuccess) {
  75. $.messager.alert("系统提示", data.Message);
  76. reload();
  77. }
  78. });
  79. }
  80. });
  81. return true;
  82. }
  83. }
  84. else if (document.getElementById("ClassArrangeStudentCountNumberBox_div").style.display != "none") {
  85. //每班预招人数
  86. var classArrangeStudentCount = $("#ClassArrangeStudentCount_NumberBox").val();
  87. if (classArrangeStudentCount == null || classArrangeStudentCount == "") {
  88. $.messager.alert("系统提示", "请输入每班预招人数。");
  89. return false;
  90. }
  91. //非负的整数(/^\d+$/)
  92. var reg = /^\d+$/;
  93. if (!reg.test(classArrangeStudentCount)) {
  94. $.messager.alert("系统提示", "请输入非负整数。");
  95. return false;
  96. }
  97. var d = validChoose().join(',');
  98. if (d == "") {
  99. return;
  100. }
  101. if (parseInt(classArrangeStudentCount) >= 0) {
  102. $.messager.confirm("系统提示", "您确定要批量修改选择的信息吗?", function (r) {
  103. if (r) {
  104. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/SpecialtyClassSetting/BatchModifyControl', { specialtyClassSettingIDs: d, planRecruitStudentCount: planRecruitStudentCount, classArrangeStudentCount: classArrangeStudentCount, classMaxStudentCount: classMaxStudentCount }, function (data) {
  105. if (data.IsSuccess) {
  106. $.messager.alert("系统提示", data.Message);
  107. reload();
  108. }
  109. });
  110. }
  111. });
  112. return true;
  113. }
  114. }
  115. else if (document.getElementById("ClassMaxStudentCountNumberBox_div").style.display != "none") {
  116. //每班最大人数
  117. var classMaxStudentCount = $("#ClassMaxStudentCount_NumberBox").val();
  118. if (classMaxStudentCount == null || classMaxStudentCount == "") {
  119. $.messager.alert("系统提示", "请输入每班最大人数。");
  120. return false;
  121. }
  122. //非负的整数(/^\d+$/)
  123. var reg = /^\d+$/;
  124. if (!reg.test(classMaxStudentCount)) {
  125. $.messager.alert("系统提示", "请输入非负整数。");
  126. return false;
  127. }
  128. var d = validChoose().join(',');
  129. if (d == "") {
  130. return;
  131. }
  132. if (parseInt(classMaxStudentCount) >= 0) {
  133. $.messager.confirm("系统提示", "您确定要批量修改选择的信息吗?", function (r) {
  134. if (r) {
  135. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/SpecialtyClassSetting/BatchModifyControl', { specialtyClassSettingIDs: d, planRecruitStudentCount: planRecruitStudentCount, classArrangeStudentCount: classArrangeStudentCount, classMaxStudentCount: classMaxStudentCount }, function (data) {
  136. if (data.IsSuccess) {
  137. $.messager.alert("系统提示", data.Message);
  138. reload();
  139. }
  140. });
  141. }
  142. });
  143. return true;
  144. }
  145. }
  146. }
  147. //删除
  148. function SpecialtyClassSetting_Delete() {
  149. var d = validChoose().join(',');
  150. if (d == "") {
  151. $.messager.alert("系统提示", "请选择您要删除的信息。");
  152. return;
  153. }
  154. $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) {
  155. if (r) {
  156. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/SpecialtyClassSetting/Delete', { specialtyClassSettingIDs: d }, function (data) {
  157. if (data.IsSuccess) {
  158. $.messager.alert("系统提示", data.Message);
  159. $("#dgSpecialtyClassSettingList").cmsXDataTable('load');
  160. } else {
  161. $.messager.alert("系统提示", data.Message);
  162. }
  163. });
  164. }
  165. });
  166. }
  167. //设置列颜色为红色
  168. function SetRedColumn(index, row, value) {
  169. return " <span style=\"color: red;\">" + value + "</span>";
  170. }
  171. //Excel导出
  172. function SpecialtyClassSetting_Export() {
  173. $("#formQuery").submit();
  174. }
  175. //联动
  176. function queryStandard(data) {
  177. reload();
  178. }
  179. function queryEducation(data) {
  180. reload();
  181. }
  182. function queryLearningform(data) {
  183. reload();
  184. }