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.

StudentIndex.js 14 KiB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  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/OpenLessonPlanOfElective/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. learun.layerConfirm('是否确认报名该课程!', function (res) {
  81. if (res) {
  82. //learun.postForm(top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/ElectiveLessonApply', { keyValue: keyValue }, function () {
  83. // refreshGirdData();
  84. //});
  85. //模式二:
  86. var _postData = {};
  87. _postData.keyValue = keyValue;
  88. _postData.StuNo = learun.clientdata.get(['userinfo']).enCode;
  89. $.ajax({
  90. url: WebApiUrl + '/Learun/EducationalAdministration/OpenLessonPlanOfElectiveStudent/SignIn',
  91. data: _postData,
  92. type: "POST",
  93. dataType: "json",
  94. async: false,
  95. cache: false,
  96. success: function (res) {
  97. if (res.code == 200) {
  98. learun.loading(true, '正在提交报名数据');
  99. //判断队列结果
  100. var timer = setInterval(function () {
  101. $.ajax({
  102. url: top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/GetApplyResult',
  103. data: { keyValue: keyValue },
  104. type: "POST",
  105. dataType: "json",
  106. async: false,
  107. cache: false,
  108. success: function (res) {
  109. if (res.code == 200) {
  110. refreshGirdData();
  111. clearInterval(timer);
  112. learun.loading(false);
  113. learun.alert.warning(res.info);
  114. }
  115. },
  116. error: function (XMLHttpRequest, textStatus, errorThrown) {
  117. learun.alert.warning("网络出错,请刷新!");
  118. },
  119. });
  120. }, 5000);
  121. } else {
  122. learun.alert.warning("系统异常,请稍后!");
  123. return false;
  124. }
  125. },
  126. error: function (XMLHttpRequest, textStatus, errorThrown) {
  127. learun.alert.warning("网络出错,请刷新!");
  128. },
  129. });
  130. }
  131. });
  132. }
  133. });
  134. //取消报名
  135. $('#lr_cancel').on('click', function () {
  136. var keyValue = $('#gridtable').jfGridValue('Id');
  137. if (learun.checkrow(keyValue)) {
  138. learun.layerConfirm('是否确认取消报名该课程!', function (res) {
  139. if (res) {
  140. learun.postForm(top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/CancelApply', { keyValue: keyValue }, function () {
  141. refreshGirdData();
  142. });
  143. }
  144. });
  145. }
  146. });
  147. // 报名(预)
  148. $('#lr_applyPre').on('click', function () {
  149. var keyValue = $('#gridtable').jfGridValue('Id');
  150. if (learun.checkrow(keyValue)) {
  151. learun.layerConfirm('是否确认报名该课程!', function (res) {
  152. if (res) {
  153. learun.postForm(top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/ElectiveLessonApplyPre', { keyValue: keyValue }, function () {
  154. refreshGirdData();
  155. });
  156. }
  157. });
  158. }
  159. });
  160. //取消报名(预)
  161. $('#lr_cancelPre').on('click', function () {
  162. var keyValue = $('#gridtable').jfGridValue('Id');
  163. if (learun.checkrow(keyValue)) {
  164. learun.layerConfirm('是否确认取消报名该课程!', function (res) {
  165. if (res) {
  166. learun.postForm(top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/CancelApplyPre', { keyValue: keyValue }, function () {
  167. refreshGirdData();
  168. });
  169. }
  170. });
  171. }
  172. });
  173. },
  174. // 初始化列表
  175. initGird: function () {
  176. $('#gridtable').lrAuthorizeJfGrid({
  177. url: top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/GetPageListOfStudent',
  178. headData: [
  179. { label: "学年", name: "AcademicYearNo", width: 100, align: "left" },
  180. { label: "学期", name: "Semester", width: 100, align: "left" },
  181. //{ label: "课程号", name: "LessonNo", width: 100, align: "left" },
  182. {
  183. label: "课程名称", name: "LessonName", width: 200, align: "left",
  184. formatterAsync: function (callback, value, row, op, $cell) {
  185. learun.clientdata.getAsync('custmerData', {
  186. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo',
  187. key: row.LessonNo,
  188. keyId: 'lessonno',
  189. callback: function (_data) {
  190. //callback(_data['lessonname']);
  191. callback('<span style="color:blue;" onclick="LessonIntroduction(\'' + row.LessonNo + '\');">' + _data['lessonname'] + '</span>');
  192. }
  193. });
  194. }
  195. },
  196. {
  197. label: "上课节次", name: "LessonSection", width: 150, align: "left",
  198. formatter: function (cellvalue, row) {
  199. if (cellvalue.indexOf(',') == -1)
  200. return "星期" + weekChina[cellvalue.slice(0, 1) - 1] + "第" + cellvalue.slice(1) + "节";
  201. else
  202. return "星期" + weekChina[cellvalue.slice(0, 1) - 1] + "第" + cellvalue.slice(1, 2) + "、" + cellvalue.slice(4) + "节";
  203. }
  204. },
  205. { label: "上课时间", name: "LessonTime", width: 180, align: "left" },
  206. { label: "学分", name: "StudyScore", width: 80, align: "left" },
  207. {
  208. label: "教师姓名", name: "EmpName", width: 100, align: "left",
  209. formatterAsync: function (callback, value, row, op, $cell) {
  210. learun.clientdata.getAsync('custmerData', {
  211. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo',
  212. key: row.EmpNo,
  213. keyId: 'empno',
  214. callback: function (_data) {
  215. //callback(_data['empname']);
  216. callback('<span style="color:blue;" onclick="EmpIntroduction(\'' + row.EmpNo + '\');">' + _data['empname'] + '</span>');
  217. }
  218. });
  219. }
  220. },
  221. {
  222. label: "教室名称", name: "ClassRoomNo", width: 100, align: "left",
  223. formatterAsync: function (callback, value, row, op, $cell) {
  224. learun.clientdata.getAsync('custmerData', {
  225. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'ClassRoomInfo',
  226. key: value,
  227. keyId: 'classroomno',
  228. callback: function (_data) {
  229. callback(_data['classroomname']);
  230. }
  231. });
  232. }
  233. },
  234. { label: "报名人数上限", name: "StuNumMax", width: 100, align: "left" },
  235. { label: "已报名人数", name: "StuNumOfApply", width: 100, align: "left" },
  236. {
  237. label: "报名状态", name: "Status", width: 100, align: "left",
  238. formatter: function (cellvalue, row) {
  239. if (cellvalue == 1) {
  240. return '<span class=\"label label-primary\">审核中</span>';
  241. } else if (cellvalue == 2) {
  242. return '<span class=\"label label-success\">报名成功</span>';
  243. } else if (cellvalue == 3) {
  244. return '<span class=\"label label-warning\">报名失败</span>';
  245. } else {
  246. return '<span class=\"label label-default\">未报名</span>';
  247. }
  248. }
  249. },
  250. { label: "已报名人数(预)", name: "StuNumOfApplyPre", width: 100, align: "left" },
  251. {
  252. label: "报名状态(预)", name: "StatusPre", width: 100, align: "left",
  253. formatter: function (cellvalue, row) {
  254. if (cellvalue == 1) {
  255. return '<span class=\"label label-primary\">审核中</span>';
  256. } else if (cellvalue == 2) {
  257. return '<span class=\"label label-success\">报名成功</span>';
  258. } else if (cellvalue == 3) {
  259. return '<span class=\"label label-warning\">报名失败</span>';
  260. } else {
  261. return '<span class=\"label label-default\">未报名</span>';
  262. }
  263. }
  264. },
  265. ],
  266. mainId: 'Id',
  267. isPage: true,
  268. sidx: 'AcademicYearNo,Semester',
  269. sord: 'desc'
  270. });
  271. page.search();
  272. },
  273. search: function (param) {
  274. param = param || {};
  275. param.StuNo = learun.clientdata.get(['userinfo']).enCode;
  276. param.StuMajorNo = StuMajorNo;
  277. param.StuGrade = StuGrade;
  278. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  279. }
  280. };
  281. refreshGirdData = function () {
  282. page.search();
  283. };
  284. page.init();
  285. }