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 15 KiB

4 years ago
4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  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/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').jfGrid({
  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: "LessonTypeId", width: 100, align: "left",
  198. formatterAsync: function (callback, value, row, op, $cell) {
  199. console.log(row.LessonTypeId);
  200. learun.clientdata.getAsync('custmerData', {
  201. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdLessonType',
  202. key: row.LessonTypeId,
  203. keyId: 'ltid',
  204. callback: function (_data) {
  205. callback(_data['lessontypename']);
  206. }
  207. });
  208. }
  209. },
  210. {
  211. label: "上课节次", name: "LessonSection", width: 150, align: "left",
  212. formatter: function (cellvalue, row) {
  213. if (cellvalue.indexOf(',') == -1)
  214. return "星期" + weekChina[cellvalue.slice(0, 1) - 1] + "第" + cellvalue.slice(1) + "节";
  215. else
  216. return "星期" + weekChina[cellvalue.slice(0, 1) - 1] + "第" + cellvalue.slice(1, 2) + "、" + cellvalue.slice(4) + "节";
  217. }
  218. },
  219. { label: "上课时间", name: "LessonTime", width: 180, align: "left" },
  220. { label: "学分", name: "StudyScore", width: 80, align: "left" },
  221. {
  222. label: "教师姓名", name: "EmpName", width: 100, align: "left",
  223. formatterAsync: function (callback, value, row, op, $cell) {
  224. learun.clientdata.getAsync('custmerData', {
  225. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo',
  226. key: row.EmpNo,
  227. keyId: 'empno',
  228. callback: function (_data) {
  229. //callback(_data['empname']);
  230. callback('<span style="color:blue;" onclick="EmpIntroduction(\'' + row.EmpNo + '\');">' + _data['empname'] + '</span>');
  231. }
  232. });
  233. }
  234. },
  235. {
  236. label: "教室名称", name: "ClassRoomNo", width: 100, align: "left",
  237. formatterAsync: function (callback, value, row, op, $cell) {
  238. learun.clientdata.getAsync('custmerData', {
  239. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'ClassRoomInfo',
  240. key: value,
  241. keyId: 'classroomno',
  242. callback: function (_data) {
  243. callback(_data['classroomname']);
  244. }
  245. });
  246. }
  247. },
  248. { label: "报名人数上限", name: "StuNumMax", width: 100, align: "left" },
  249. { label: "已报名人数", name: "StuNumOfApply", width: 100, align: "left" },
  250. {
  251. label: "报名状态", name: "Status", width: 100, align: "left",
  252. formatter: function (cellvalue, row) {
  253. if (cellvalue == 1) {
  254. return '<span class=\"label label-primary\">审核中</span>';
  255. } else if (cellvalue == 2) {
  256. return '<span class=\"label label-success\">报名成功</span>';
  257. } else if (cellvalue == 3) {
  258. return '<span class=\"label label-warning\">报名失败</span>';
  259. } else {
  260. return '<span class=\"label label-default\">未报名</span>';
  261. }
  262. }
  263. },
  264. { label: "已报名人数(预)", name: "StuNumOfApplyPre", width: 100, align: "left" },
  265. {
  266. label: "报名状态(预)", name: "StatusPre", width: 100, align: "left",
  267. formatter: function (cellvalue, row) {
  268. if (cellvalue == 1) {
  269. return '<span class=\"label label-primary\">审核中</span>';
  270. } else if (cellvalue == 2) {
  271. return '<span class=\"label label-success\">报名成功</span>';
  272. } else if (cellvalue == 3) {
  273. return '<span class=\"label label-warning\">报名失败</span>';
  274. } else {
  275. return '<span class=\"label label-default\">未报名</span>';
  276. }
  277. }
  278. },
  279. ],
  280. mainId: 'Id',
  281. isPage: true,
  282. sidx: 'AcademicYearNo,Semester',
  283. sord: 'desc'
  284. });
  285. page.search();
  286. },
  287. search: function (param) {
  288. param = param || {};
  289. param.StuNo = learun.clientdata.get(['userinfo']).enCode;
  290. param.StuMajorNo = StuMajorNo;
  291. param.StuGrade = StuGrade;
  292. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  293. }
  294. };
  295. refreshGirdData = function () {
  296. page.search();
  297. };
  298. page.init();
  299. }