ExaminationPlanClassroom.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. var examinationPlanID;
  2. var isChanged = false;
  3. var isFromAddButton = false;
  4. var isFromEditButton = false;
  5. var saveConfirmMsg = "由于考试计划信息对考室安排和监考老师的安排有决定性作用,因此需要先提交考试计划信息后方能继续操作,是否确定提交?";
  6. var mnu;
  7. $(function () {
  8. mnu = $.SystemGeneral.getUrlParam("MNU");
  9. examinationPlanID = $.SystemGeneral.getUrlParam("ExaminationPlanID");
  10. WdatePicker({ el: $("#StartTime"), hmsMenuCfg: { H: [1, 2], m: [30, 2], s: [30, 4]} });
  11. WdatePicker({ el: $("#EndTime"), hmsMenuCfg: { H: [1, 2], m: [30, 2], s: [30, 4]} });
  12. });
  13. function setFormChanged() {
  14. isChanged = true;
  15. }
  16. //成教页面,处理考试时间的快速选择
  17. function setDateTime() {
  18. var timeSegmentValue = eval("(" + $("#ddlTimeSegment").combobox('getValue') + ")");
  19. if (timeSegmentValue != "-1") {
  20. $("#ExaminationDate").val(timeSegmentValue.ExaminationDateString);
  21. $("#StartTime").val(timeSegmentValue.StartTimeString + ":00");
  22. $("#EndTime").val(timeSegmentValue.EndTimeString + ":00");
  23. }
  24. }
  25. function ExaminationPlan_Save() {
  26. if ($("#ExaminationDate").val() == "") {
  27. $.messager.alert('系统信息', "考试日期必须填写。");
  28. return;
  29. }
  30. if ($("#StartTime").val() == "") {
  31. $.messager.alert('系统信息', "开始时间必须填写。");
  32. return;
  33. }
  34. if ($("#EndTime").val() == "") {
  35. $.messager.alert('系统信息', "结束时间必须填写。");
  36. return;
  37. }
  38. var date = $("#ExaminationDate").val();
  39. date = date.replace(/-/g, "/");
  40. var stime = date+" "+$("#StartTime").val();
  41. var etime = date+" "+ $("#EndTime").val();
  42. stime = new Date(stime);
  43. etime = new Date(etime);
  44. if (stime > etime) {
  45. $.messager.alert("系统提示", "开始时间不能大于结束时间");
  46. return;
  47. }
  48. $(document.forms[0]).submit();
  49. }
  50. function ExaminationPlan_Save_Complete(data) {
  51. $('a').removeAttr('disabled', 'disabled');
  52. $('#loading').hide();
  53. if (!isFromAddButton && !isFromEditButton) {
  54. $.messager.alert('系统信息', data.Message, null, function () {
  55. if (data.IsSuccess) {
  56. var dialogId = $.SystemGeneral.getUrlParam('WindowID');
  57. dialogId = (dialogId == null || dialogId == '') ? 'sysWindow' : dialogId;
  58. top.$('#' + dialogId).window('close');
  59. var tab = top.$('#index_center_tabs').tabs('getSelected');
  60. var $iframe = tab.panel('body').find("iframe");
  61. if ($iframe[0].contentWindow.reload)
  62. $iframe[0].contentWindow.reload();
  63. }
  64. });
  65. } else {
  66. if (!data.IsSuccess) {
  67. $.messager.alert('系统信息', data.Message);
  68. } else {
  69. if (isFromAddButton) {
  70. $.popupTopWindow('新增考场', CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationPlan/ClassroomLayout?MNU=' + mnu + '&ExaminationPlanID=' + examinationPlanID, 800, 600, ExaminationPlan_ClassroomAdd_Confirm);
  71. isFromAddButton = false;
  72. } else if (isFromEditButton) {
  73. $.popupTopWindow('编辑考场', CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationPlan/ClassroomLayout?MNU=' + mnu + '&ExaminationPlanID=' + examinationPlanID + '&ExaminationRoomLayoutID=' + rowData.ExaminationRoomLayoutID,
  74. 800, 600, ExaminationPlan_ClassroomAdd_Confirm);
  75. }
  76. }
  77. }
  78. }
  79. function checkModify() {
  80. if (isChanged) {
  81. return true;
  82. }
  83. if ($("ExaminationDate").val() == "") {
  84. return true;
  85. }
  86. if ($("StartTime").val() == "") {
  87. return true;
  88. }
  89. if ($("EndTime").val() == "") {
  90. return true;
  91. }
  92. return false;
  93. }
  94. function ExaminationPlan_ClassroomAdd() {
  95. if (!$(document.forms[0]).valid()) return;
  96. isFromAddButton = true;
  97. ExaminationPlan_Save();
  98. // if (checkModify()) {
  99. // isFromAddButton = true;
  100. // ExaminationPlan_Save();
  101. // } else {
  102. // $.popupTopWindow('新增考场', CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationPlan/ClassroomLayout?MNU=' + mnu + '&ExaminationPlanID=' + examinationPlanID, 800, 600, ExaminationPlan_ClassroomAdd_Confirm);
  103. // }
  104. }
  105. function edit(rowIndex, rowData) {
  106. if (!$(document.forms[0]).valid()) return;
  107. if (checkModify()) {
  108. $.messager.confirm("系统提示", saveConfirmMsg,
  109. function (r) {
  110. if (r) {
  111. isFromEditButton = true;
  112. ExaminationPlan_Save();
  113. }
  114. });
  115. } else {
  116. $.popupTopWindow('编辑考场', CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationPlan/ClassroomLayout?MNU=' + mnu + '&ExaminationPlanID=' + examinationPlanID + '&ExaminationRoomLayoutID=' + rowData.ExaminationRoomLayoutID,
  117. 800, 600, ExaminationPlan_ClassroomAdd_Confirm);
  118. }
  119. }
  120. function reload() {
  121. $("#dgExaminationRoomLayoutList").cmsXDataTable("load", $.getDataGridParams("dgExaminationRoomLayoutList"));
  122. }
  123. function ExaminationPlan_ClassroomAdd_Confirm(roomList) {
  124. window.location.reload();
  125. }
  126. //获取选中的数据
  127. function validChoose() {
  128. var d = [];
  129. $.each($("#dgExaminationRoomLayoutList").cmsXDataTable("getSelections"), function (index) {
  130. d.push(this.ExaminationRoomLayoutID);
  131. });
  132. return d;
  133. }
  134. function ExaminationPlan_ClassroomDelete() {
  135. var d = validChoose();
  136. if (d.length == 0) {
  137. $.messager.alert("系统提示", "请选择您要删除的考场信息!!");
  138. return;
  139. }
  140. $.messager.confirm("系统提示", "您确定要删除该考场信息?", function (r) {
  141. if (r) {
  142. $.post(CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationPlan/ExaminationClassroomLayoutDelete', { examinationRoomLayoutIDs: d.join(',') }, function (data) {
  143. $.messager.alert("系统提示", data.Message);
  144. if (data.IsSuccess) {
  145. $("#dgExaminationRoomLayoutList").cmsXDataTable('load');
  146. }
  147. });
  148. }
  149. });
  150. }