You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

211 lines
9.8 KiB

  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2019-05-14 10:02
  5. * 描 述:选课中心
  6. */
  7. var weekChina = ["一", "二", "三", "四", "五", "六", "日"];
  8. var refreshGirdData;
  9. //点击课程名称
  10. function LessonIntroduction(lessonno) {
  11. var html = "";
  12. top.learun.httpAsyncGet(top.$.rootUrl + '/EducationalAdministration/LessonInfo/GetLessonInfoEntityByLessonNo?lessonNo=' + lessonno, function (result) {
  13. if (result.code == 200) {
  14. if (result.data.Introduction == null) {
  15. top.learun.alert.warning("暂无课程简介。");
  16. return;
  17. }
  18. html = result.data.Introduction;
  19. layer.open({
  20. type: 1,
  21. closeBtn: 2,
  22. title: "课程简介",
  23. area: ['800px', '60%'],
  24. content: html
  25. });
  26. } else {
  27. top.learun.alert.warning("暂无课程简介。");
  28. }
  29. });
  30. }
  31. //点击教师名称
  32. function EmpIntroduction(empno) {
  33. var html = "";
  34. top.learun.httpAsyncGet(top.$.rootUrl + '/EducationalAdministration/EmpInfo/GetEmpInfoEntityByEmpNo?empNo=' + empno, function (result) {
  35. if (result.code == 200) {
  36. if (result.data.resume == null) {
  37. top.learun.alert.warning("暂无教师简介。");
  38. return;
  39. }
  40. html = result.data.resume;
  41. layer.open({
  42. type: 1,
  43. closeBtn: 2,
  44. title: "教师简介",
  45. area: ['800px', '60%'],
  46. content: html
  47. });
  48. } else {
  49. top.learun.alert.warning("暂无教师简介。");
  50. }
  51. });
  52. }
  53. var bootstrap = function ($, learun) {
  54. "use strict";
  55. var page = {
  56. init: function () {
  57. //是否为选课时间
  58. learun.httpAsyncGet(top.$.rootUrl + '/EducationalAdministration/LessonInfoOfElectiveOnline/IsSelectElectiveLesson', function (result) {
  59. if (result.code == 200) {//选课还未开始
  60. learun.alert.warning("当前时间不是线上选课时间!");
  61. return;
  62. } else {//选课已经开始
  63. page.initGird();
  64. }
  65. });
  66. page.bind();
  67. },
  68. bind: function () {
  69. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  70. page.search(queryJson);
  71. }, 220, 400);
  72. // 刷新
  73. $('#lr_refresh').on('click', function () {
  74. location.reload();
  75. });
  76. // 报名
  77. $('#lr_apply').on('click', function () {
  78. var keyValue = $('#gridtable').jfGridValue('Id');
  79. if (learun.checkrow(keyValue)) {
  80. var Status = $('#gridtable').jfGridValue('Status');
  81. if (Status == "1" || Status == "2") {//审核中、报名成功
  82. learun.alert.warning("系统不记录重复报名数据!");
  83. return false;
  84. }
  85. learun.layerConfirm('是否确认报名该课程!', function (res) {
  86. if (res) {
  87. //模式二:
  88. var _postData = {};
  89. _postData.keyValue = keyValue;
  90. _postData.StuNo = learun.clientdata.get(['userinfo']).enCode;
  91. $.ajax({
  92. url: WebApiUrl + '/Learun/LessonInfoOfElectiveOnline/SignIn',
  93. data: _postData,
  94. type: "POST",
  95. dataType: "json",
  96. async: false,
  97. cache: false,
  98. success: function (res) {
  99. if (res.code == 200) {
  100. learun.loading(true, '正在提交报名数据');
  101. //判断队列结果
  102. var timer = setInterval(function () {
  103. $.ajax({
  104. url: top.$.rootUrl + '/EducationalAdministration/LessonInfoOfElectiveOnline/GetApplyResult',
  105. data: { keyValue: keyValue },
  106. type: "POST",
  107. dataType: "json",
  108. async: false,
  109. cache: false,
  110. success: function (res) {
  111. if (res.code == 200) {
  112. refreshGirdData();
  113. clearInterval(timer);
  114. learun.loading(false);
  115. learun.alert.warning(res.info);
  116. }
  117. },
  118. error: function (XMLHttpRequest, textStatus, errorThrown) {
  119. learun.alert.warning("网络出错,请刷新!");
  120. },
  121. });
  122. }, 5000);
  123. } else {
  124. learun.alert.warning("系统异常,请稍后!");
  125. return false;
  126. }
  127. },
  128. error: function (XMLHttpRequest, textStatus, errorThrown) {
  129. learun.alert.warning("网络出错,请刷新!");
  130. },
  131. });
  132. }
  133. });
  134. }
  135. });
  136. //取消报名
  137. $('#lr_cancel').on('click', function () {
  138. var keyValue = $('#gridtable').jfGridValue('Id');
  139. if (learun.checkrow(keyValue)) {
  140. var Status = $('#gridtable').jfGridValue('Status');
  141. if (Status == "2") {//报名成功
  142. learun.alert.warning("当前课程已报名成功,无法取消!");
  143. return false;
  144. }
  145. if (Status != "1") {//审核中
  146. learun.alert.warning("当前课程未报名或者报名失败,无法取消!");
  147. return false;
  148. }
  149. learun.layerConfirm('是否确认取消报名该课程!', function (res) {
  150. if (res) {
  151. learun.postForm(top.$.rootUrl + '/EducationalAdministration/LessonInfoOfElectiveOnline/CancelApply', { keyValue: keyValue }, function () {
  152. refreshGirdData();
  153. });
  154. }
  155. });
  156. }
  157. });
  158. },
  159. // 初始化列表
  160. initGird: function () {
  161. $('#gridtable').jfGrid({
  162. url: top.$.rootUrl + '/EducationalAdministration/LessonInfoOfElectiveOnline/GetPageListOfStudent',
  163. headData: [
  164. { label: "学年", name: "AcademicYearNo", width: 100, align: "left" },
  165. { label: "学期", name: "Semester", width: 100, align: "left" },
  166. { label: "课程编号", name: "LessonNo", width: 150, align: "left" },
  167. { label: "课程名称", name: "LessonName", width: 150, align: "left" },
  168. { label: "建课教师", name: "EmpNo", width: 100, align: "left" },
  169. {
  170. label: "建课学校", name: "F_SchoolId", width: 150, align: "left"
  171. },
  172. //{ label: "报名人数上限", name: "StuNumMax", width: 100, align: "left" },
  173. { label: "已报人数", name: "StuNumOfApply", width: 100, align: "left" },
  174. {
  175. label: "报名状态", name: "Status", width: 100, align: "left",
  176. formatter: function (cellvalue, row) {
  177. if (cellvalue == 1) {
  178. return '<span class=\"label label-primary\">审核中</span>';
  179. } else if (cellvalue == 2) {
  180. return '<span class=\"label label-success\">报名成功</span>';
  181. } else if (cellvalue == 3) {
  182. return '<span class=\"label label-warning\">报名失败</span>';
  183. } else {
  184. return '<span class=\"label label-default\">未报名</span>';
  185. }
  186. }
  187. },
  188. ],
  189. mainId: 'Id',
  190. isPage: true,
  191. sidx: 'AcademicYearNo DESC, Semester DESC, LessonNo ASC'
  192. });
  193. page.search();
  194. },
  195. search: function (param) {
  196. param = param || {};
  197. param.StuNo = learun.clientdata.get(['userinfo']).enCode;
  198. param.StuMajorNo = StuMajorNo;
  199. param.StuGrade = StuGrade;
  200. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  201. }
  202. };
  203. refreshGirdData = function () {
  204. page.search();
  205. };
  206. page.init();
  207. }