RetakePlanResultTaskEdit.js 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. var mnu = "";
  2. //加载
  3. $(function () {
  4. mnu = $.SystemGeneral.getUrlParam("MNU");
  5. })
  6. //保存
  7. function RetakePlanResultTask_Save() {
  8. //授课方式
  9. if ($("input[name='TeachingModeID']:checked").length == 0) {
  10. $.messager.alert("系统提示", "请选择至少一种授课方式。");
  11. return;
  12. }
  13. ////授课地点
  14. //if ($("input[name='TeachingPlaceID']:checked").length == 0) {
  15. // $.messager.alert("系统提示", "请选择至少一种授课地点。");
  16. // return;
  17. //}
  18. //排课明细
  19. var scheduling = $("#dgSchedulingList").cmsXDataTable("getRows");
  20. var isSchedulingValidated = true;
  21. $.each(scheduling, function () {
  22. var selectedScheduling = this;
  23. if (selectedScheduling.Weekday == null || selectedScheduling.Weekday == "") {
  24. isSchedulingValidated = false;
  25. return false;
  26. }
  27. if (selectedScheduling.CoursesTimeID == null || selectedScheduling.CoursesTimeID == "") {
  28. isSchedulingValidated = false;
  29. return false;
  30. }
  31. });
  32. if (!isSchedulingValidated) {
  33. $.messager.alert('系统信息', '请选择相应的排课信息。');
  34. return;
  35. }
  36. //任课教师
  37. var currentTeacher = $("#dgTeacherList").cmsXDataTable("getRows");
  38. var isValidated = true;
  39. $.each(currentTeacher, function () {
  40. var curSelectedTeacher = this;
  41. if (curSelectedTeacher.TeachingMethod == null) {
  42. isValidated = false;
  43. return false;
  44. }
  45. });
  46. if (!isValidated) {
  47. $.messager.alert('系统信息', '请指定一种任课方式。');
  48. return;
  49. }
  50. if (!isNaN($("#Trialhours").val()) && $("#Trialhours").val() != ""
  51. && !isNaN($("#Practicehours").val()) && $("#Practicehours").val() != ""
  52. && parseFloat($("#Trialhours").val()) > parseFloat($("#Practicehours").val())) {
  53. $.messager.alert("系统提示", "实验学时不能大于实践学时。");
  54. return;
  55. }
  56. if (!isNaN($("#TrialWeeklyNum").val()) && $("#TrialWeeklyNum").val() != ""
  57. && !isNaN($("#PracticeWeeklyNum").val()) && $("#PracticeWeeklyNum").val() != ""
  58. && parseFloat($("#TrialWeeklyNum").val()) > parseFloat($("#PracticeWeeklyNum").val())) {
  59. $.messager.alert("系统提示", "实验周次不能大于实践周次。");
  60. return;
  61. }
  62. $(document.forms[0]).submit();
  63. }
  64. //保存后执行方法(强制排课)
  65. VerifySave = function (data) {
  66. if (!data.IsSuccess) {
  67. if (data.Type == 1) {
  68. //如果验证到排课冲突type返回1,弹出选择框,用户可选择继续保存或不保存,如果不返回1,弹出一般的错误提示框
  69. $.messager.defaults = { ok: "保存", cancel: "不保存" };
  70. $.messager.confirm("选择提示", data.Message + ",是否继续保存?", function (r) {
  71. if (r) {
  72. //验证到排课冲突后,若要继续保存则IsNeedVerify为false
  73. $("#IsNeedVerify").val(false);
  74. $(document.forms[0]).submit();
  75. }
  76. });
  77. $.messager.defaults = { ok: "确定", cancel: "取消" };
  78. }
  79. else {
  80. $.messager.alert("系统提示", data.Message);
  81. }
  82. } else {
  83. $.messager.alert('系统信息', data.Message, null, function () {
  84. if (data.IsSuccess) {
  85. var dialogId = $.SystemGeneral.getUrlParam('WindowID');
  86. dialogId = (dialogId == null || dialogId == '') ? 'sysWindow' : dialogId;
  87. try {
  88. top.$('#' + dialogId).window('close');
  89. } catch (e) {
  90. }
  91. var tab = top.$('#index_center_tabs').tabs('getSelected');
  92. var $iframe = tab.panel('body').find("iframe");
  93. if ($iframe[0].contentWindow.reload)
  94. $iframe[0].contentWindow.reload();
  95. }
  96. });
  97. }
  98. }
  99. function success(data) {
  100. $.messager.alert('系统信息', data.Message);
  101. if (data.IsSuccess) {
  102. top.$('#sysWindow').window('close');
  103. var tab = top.$('#index_center_tabs').tabs('getSelected');
  104. tab.panel('refresh');
  105. }
  106. }
  107. //弹出添加教师页面
  108. function RetakePlanResultTask_TeaAdd() {
  109. $.popupTopWindow('添加教师', CMS_SystemConfig.VirtualDirectoryPath + '/Common/TeacherSelect?FromMNU=' +
  110. mnu, 560, 480, AddTeachers_Confirm);
  111. }
  112. //确定添加教师
  113. function AddTeachers_Confirm(teacherList) {
  114. if (teacherList == null)
  115. return;
  116. var teacherViewList = $("#dgTeacherList").cmsXDataTable("getRows");
  117. $.each(teacherList, function (index, value) {
  118. if ($.grep(teacherViewList, function (row, index) { return value.UserID == row.UserID; }).length == 0) {
  119. teacherViewList.push({
  120. RetakePlanID: $("#RetakePlanID").val(),
  121. UserID: value.UserID,
  122. LoginID: value.StaffCode,
  123. Name: value.Name,
  124. CollegeID: value.CollegeID,
  125. CollegeName: value.CollegeName,
  126. BirthDate: value.BirthDate,
  127. TeacherType: value.TeacherType,
  128. TeacherTypeName: value.TeacherTypeName,
  129. IncumbencyState: value.IncumbencyState,
  130. IncumbencyStateName: value.IncumbencyStateName,
  131. Title: value.Title,
  132. TitleName: value.TitleName,
  133. TeachingMethod: TeachingMethod,
  134. TeachingMethodDesc: null
  135. });
  136. }
  137. });
  138. $("#dgTeacherList").cmsXDataTable("loadData", { rows: teacherViewList, total: teacherViewList.length });
  139. }
  140. //获取选中的教师信息
  141. function validChoose() {
  142. var d = [];
  143. $.each($("#dgTeacherList").cmsXDataTable("getSelections"), function (index) {
  144. d.push(this);
  145. });
  146. return d;
  147. }
  148. //删除添加教师
  149. function RetakePlanResultTask_TeaDelete() {
  150. var d = validChoose();
  151. var teacherViewList = $("#dgTeacherList").cmsXDataTable("getRows");
  152. var i, j;
  153. var len = teacherViewList.length;
  154. for (i = len - 1; i >= 0; i--) {
  155. for (j = 0; j < d.length; j++) {
  156. if (teacherViewList[i].UserID == d[j].UserID) {
  157. teacherViewList.splice(i, 1);
  158. break;
  159. }
  160. }
  161. }
  162. $("#dgTeacherList").cmsXDataTable("loadData", { rows: teacherViewList, total: teacherViewList.length });
  163. }
  164. //点击重修计划设置信息收缩
  165. function swapRetakeSettings() {
  166. if ($("#retakeExpander").attr("expanded") == "0") {
  167. $("#retakeExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -32px 0");
  168. $("#retakeExpander").closest("tr")
  169. .next().css("display", "none")
  170. .next().css("display", "none")
  171. .next().css("display", "none")
  172. .next().css("display", "none")
  173. .next().css("display", "none");
  174. $("#retakeExpander").attr("expanded", "1");
  175. } else {
  176. $("#retakeExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -50px 0");
  177. $("#retakeExpander").closest("tr")
  178. .next().css("display", "")
  179. .next().css("display", "")
  180. .next().css("display", "")
  181. .next().css("display", "")
  182. .next().css("display", "");
  183. $("#retakeExpander").attr("expanded", "0");
  184. }
  185. }
  186. //点击上课周次信息收缩
  187. function swapWeekSettings() {
  188. if ($("#weekExpander").attr("expanded") == "0") {
  189. $("#weekExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -50px 0");
  190. $("#weekExpander").closest("tr")
  191. .next().css("display", "")
  192. .next().css("display", "")
  193. .next().css("display", "")
  194. .next().css("display", "");
  195. $("#weekExpander").attr("expanded", "1");
  196. } else {
  197. $("#weekExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -32px 0");
  198. $("#weekExpander").closest("tr")
  199. .next().css("display", "none")
  200. .next().css("display", "none")
  201. .next().css("display", "none")
  202. .next().css("display", "none");
  203. $("#weekExpander").attr("expanded", "0");
  204. }
  205. }