ExaminationApply.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. //获取选中的数据
  2. function validChoose() {
  3. var d = [];
  4. $.each($("#dgCourseScheduleSettingList").cmsXDataTable("getSelections"), function (index) {
  5. d.push(this);
  6. });
  7. return d;
  8. }
  9. function idvalidChoose() {
  10. var d = [];
  11. $.each($("#dgCourseScheduleSettingList").cmsXDataTable("getSelections"), function (index) {
  12. d.push(this.ExaminationSubjectID);
  13. });
  14. return d;
  15. }
  16. function validChooseUserGrade() {
  17. var d = [];
  18. $.each($("#dgUserGrade").cmsXDataTable("getSelections"), function (index) {
  19. d.push(this);
  20. });
  21. return d;
  22. }
  23. //报名按钮
  24. function ExamineApply_Update() {
  25. var d = validChoose();
  26. var id = idvalidChoose().join(',');
  27. var myDateTime = getNowFormatDate();
  28. var newData = new Date(myDateTime.replace("-", "/").replace("-", "/"));
  29. if (d.length == 0) {
  30. $.messager.alert("系统提示", "请选择您要报名的考试科目。");
  31. return;
  32. }
  33. else if (d.length > 1) {
  34. $.messager.alert("系统提示", "每次只能选择一个科目报考。");
  35. return;
  36. }
  37. var isError = false;
  38. $.each(d, function (index, value) {
  39. if (value.EndDate != null) {
  40. var dt1 = new Date();
  41. var dtime = new Date(dt1.getFullYear(), dt1.getMonth(), dt1.getDate());
  42. var dt2 = getDate(value.EndDate);
  43. if (dtime > dt2) {
  44. $.messager.alert("系统提示", "不在报名时间内,不能报名。");
  45. isError = true;
  46. return false;
  47. }
  48. }
  49. });
  50. if (isError) {
  51. return;
  52. }
  53. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ExamineApply/ApplySubmit', { ExaminationSubjectID: id, Version: 10 }, function (data) {
  54. if (data == "报名成功") {
  55. $.messager.alert("系统提示", "报名成功!");
  56. $("#dgCourseScheduleSettingList").cmsXDataTable('load');
  57. $("#dgUserGrade").cmsXDataTable('load');
  58. } else {
  59. $.messager.alert("系统提示", data);
  60. }
  61. });
  62. }
  63. function ExamineApply_Refresh() {
  64. $("#dgCourseScheduleSettingList").cmsXDataTable('load');
  65. $("#dgUserGrade").cmsXDataTable('load');
  66. }
  67. //撤销
  68. function ExamineApply_Cancel() {
  69. var d = validChooseUserGrade();
  70. // var myDateTime = getNowFormatDate();
  71. // var newData = new Date(myDateTime.replace("-", "/").replace("-", "/"));
  72. if (d.length == 0) {
  73. $.messager.alert("系统提示", "请选择您要撤销报名的考试科目。");
  74. return;
  75. }
  76. var dt1 = new Date();
  77. var dtime = new Date(dt1.getFullYear(), dt1.getMonth(), dt1.getDate());
  78. var dt2 = getDate(d[0].EndDate);
  79. var isError = false;
  80. $.each(d, function (index, value) {
  81. if (value.EndDate != null) {
  82. var dt1 = new Date();
  83. var dtime = new Date(dt1.getFullYear(), dt1.getMonth(), dt1.getDate());
  84. var dt2 = getDate(value.EndDate);
  85. if (dtime > dt2) {
  86. $.messager.alert("系统提示", "对不起,已过报名截止时间,不能进行撤销操作!");
  87. isError = true;
  88. return false;
  89. }
  90. }
  91. // if (value.IsRister) {
  92. // $.messager.alert("系统提示", "你已报名,请勿重复报名。");
  93. // isError = true;
  94. // return false;
  95. // }
  96. // if (value.RegisterNum >= value.PeopleNumLimit) {
  97. // $.messager.alert("系统提示", "科目" + value.Name + "已达报考人数上限,暂时无法报名。");
  98. // isError = true;
  99. // return false;
  100. // }
  101. });
  102. if (isError) {
  103. return;
  104. }
  105. $.post('/ExamineApply/ApplyCancel?ExaminationRegistrationIDs=' + $.map(d, function (x) { return x.ExaminationRegistrationID; }).join(','), function (data) {
  106. if (data == "撤销成功") {
  107. $.messager.alert("系统提示", "撤销成功!");
  108. $("#dgCourseScheduleSettingList").cmsXDataTable('load');
  109. $("#dgUserGrade").cmsXDataTable('load');
  110. } else {
  111. $.messager.alert("系统提示", data);
  112. }
  113. });
  114. }
  115. //获取系统时间 时分秒yyyy-MM-dd HH:MM:SS
  116. function getNowFormatDate() {
  117. var d = new Date(), str = '';
  118. str += d.getFullYear() + '-'; //获取当前年份
  119. str += d.getMonth() + 1 + '-'; //获取当前月份(0——11)
  120. str += d.getDate() + '-';
  121. str += d.getHours() + '-';
  122. str += d.getMinutes() + '-';
  123. str += d.getSeconds();
  124. return str;
  125. }
  126. //字符串转时间格式
  127. function getDate(strDate) {
  128. var date = eval('new Date(' + strDate.replace(/\d+(?=-[^-]+$)/,
  129. function (a) { return parseInt(a, 10) - 1; }).match(/\d+/g) + ')');
  130. return date;
  131. }
  132. function CheckIsRister(index, row, value, bb) {
  133. //alert(aa);
  134. if (row.IsRister == true) {
  135. return " <input type=\"checkbox\" disabled='disabled' value=" + value + ">";
  136. //return " <span style=\"color:red;\">" + value + "</span>";
  137. }
  138. else {
  139. return " <input type=\"checkbox\" value=" + value + ">";
  140. }
  141. }
  142. function CheckIsRister1(index, row, value, bb) {
  143. //alert(aa);
  144. if (row.IsRister == true) {
  145. return "display :none";
  146. }
  147. else {
  148. return "";
  149. }
  150. }