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.
 
 
 
 
 
 

303 lines
14 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. var bootstrap = function ($, learun) {
  10. "use strict";
  11. var page = {
  12. init: function () {
  13. //选课开始后无法进行编辑
  14. //learun.httpAsyncGet(top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/IsSelectElectiveLesson', function (result) {
  15. // if (result.code == 200) {
  16. // } else {
  17. // learun.alert.warning("学生选课已开始,合班编辑功能已停用。");
  18. // $('#lr_edit').hide();
  19. // }
  20. //});
  21. page.initGird();
  22. page.bind();
  23. },
  24. bind: function () {
  25. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  26. page.search(queryJson);
  27. }, 220, 400);
  28. // 刷新
  29. $('#lr_refresh').on('click', function () {
  30. location.reload();
  31. });
  32. //设置选课专业
  33. $('#lr_editMajor').on('click', function () {
  34. var keyValue = $('#gridtable').jfGridValue('Id');
  35. if (learun.checkrow(keyValue)) {
  36. learun.layerForm({
  37. id: 'formmajor',
  38. title: '管理选课专业',
  39. url: top.$.rootUrl + '/EducationalAdministration/ElectiveMajor/Index?OLPOEId=' + keyValue,
  40. width: 1000,
  41. height: 700,
  42. //btn: null
  43. callBack: function (id) {
  44. return top[id].acceptClick(refreshGirdData);
  45. }
  46. });
  47. }
  48. });
  49. //新增
  50. $('#lr_add').on('click', function () {
  51. learun.layerForm({
  52. id: 'formadd',
  53. title: '新增',
  54. url: top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/FormElective',
  55. width: 700,
  56. height: 500,
  57. callBack: function (id) {
  58. return top[id].acceptClick(refreshGirdData);
  59. }
  60. });
  61. });
  62. //设置人数
  63. $('#lr_edit').on('click', function () {
  64. var keyValue = $('#gridtable').jfGridValue('Id');
  65. if (learun.checkrow(keyValue)) {
  66. //选课开始后无法进行编辑
  67. //learun.httpAsyncGet(top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/IsSelectElectiveLesson', function (result) {
  68. // if (result.code == 200) {
  69. learun.layerForm({
  70. id: 'OpenLessonPlanOfElectiveform',
  71. title: '设置人数',
  72. url: top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/Form?keyValue=' + keyValue,
  73. width: 600,
  74. height: 400,
  75. callBack: function (id) {
  76. return top[id].acceptClick(refreshGirdData);
  77. }
  78. });
  79. // } else {
  80. // learun.alert.warning("学生选课已开始,合班编辑功能已停用。");
  81. // $('#lr_edit').hide();
  82. // }
  83. //});
  84. }
  85. });
  86. //查看学生
  87. $('#lr_view').on('click', function () {
  88. var keyValue = $('#gridtable').jfGridValue('Id');
  89. if (learun.checkrow(keyValue)) {
  90. learun.layerForm({
  91. id: 'form',
  92. title: '查看学生',
  93. url: top.$.rootUrl + '/EducationalAdministration/StuSelectLessonListOfElective/FinishIndex?OLPEId=' + keyValue,
  94. width: 1000,
  95. height: 700,
  96. btn: null,
  97. end: function () {
  98. refreshGirdData();
  99. }
  100. });
  101. }
  102. });
  103. //审核学生
  104. $('#lr_audit').on('click', function () {
  105. var keyValue = $('#gridtable').jfGridValue('Id');
  106. if (learun.checkrow(keyValue)) {
  107. learun.layerForm({
  108. id: 'form',
  109. title: '审核学生',
  110. url: top.$.rootUrl + '/EducationalAdministration/StuSelectLessonListOfElective/AuditIndex?OLPEId=' + keyValue,
  111. width: 1000,
  112. height: 700,
  113. btn: null,
  114. end: function () {
  115. refreshGirdData();
  116. }
  117. });
  118. }
  119. });
  120. //查看已审学生(预)
  121. $('#lr_viewPre').on('click', function () {
  122. var keyValue = $('#gridtable').jfGridValue('Id');
  123. if (learun.checkrow(keyValue)) {
  124. learun.layerForm({
  125. id: 'form',
  126. title: '查看学生',
  127. url: top.$.rootUrl + '/EducationalAdministration/StuSelectLessonListOfElectivePre/FinishIndex?OLPEId=' + keyValue,
  128. width: 1000,
  129. height: 700,
  130. btn: null,
  131. end: function () {
  132. refreshGirdData();
  133. }
  134. });
  135. }
  136. });
  137. //审核学生(预)
  138. $('#lr_auditPre').on('click', function () {
  139. var keyValue = $('#gridtable').jfGridValue('Id');
  140. if (learun.checkrow(keyValue)) {
  141. learun.layerForm({
  142. id: 'form',
  143. title: '审核学生',
  144. url: top.$.rootUrl + '/EducationalAdministration/StuSelectLessonListOfElectivePre/AuditIndex?OLPEId=' + keyValue,
  145. width: 1000,
  146. height: 700,
  147. btn: null,
  148. end: function () {
  149. refreshGirdData();
  150. }
  151. });
  152. }
  153. });
  154. //编辑
  155. $('#lr_modify').on('click', function () {
  156. var keyValue = $('#gridtable').jfGridValue('Id');
  157. if (learun.checkrow(keyValue)) {
  158. learun.layerForm({
  159. id: 'OpenLessonPlanOfElectiveModifyForm',
  160. title: '编辑',
  161. url: top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/ModifyForm?keyValue=' + keyValue,
  162. width: 600,
  163. height: 400,
  164. callBack: function (id) {
  165. return top[id].acceptClick(refreshGirdData);
  166. }
  167. });
  168. }
  169. });
  170. //初始化学生选课记录
  171. $('#lr_initStuSelectLesson').on('click', function () {
  172. var keyValue = $('#gridtable').jfGridValue('Id');
  173. if (learun.checkrow(keyValue)) {
  174. //选课专业
  175. var ElectiveMajorList = $('#gridtable').jfGridValue('ElectiveMajorList');
  176. if (ElectiveMajorList.length <= 0) {
  177. return learun.alert.warning("请先管理选课专业!");
  178. }
  179. learun.layerConfirm('是否确认初始化学生选课记录!', function (res) {
  180. if (res) {
  181. learun.postForm(top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/InitStuSelectLesson', { keyValue: keyValue }, function () {
  182. refreshGirdData();
  183. });
  184. }
  185. });
  186. }
  187. });
  188. },
  189. // 初始化列表
  190. initGird: function () {
  191. $('#gridtable').lrAuthorizeJfGrid({
  192. url: top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/GetPageListOfMerge',
  193. headData: [
  194. { label: "学年", name: "AcademicYearNo", width: 45, align: "left" },
  195. { label: "学期", name: "Semester", width: 35, align: "left" },
  196. { label: "课程号", name: "LessonNo", width: 70, align: "left" },
  197. //{
  198. // label: "课程名称", name: "LessonNo2", width: 170, align: "left",
  199. // formatterAsync: function (callback, value, row, op, $cell) {
  200. // learun.clientdata.getAsync('custmerData', {
  201. // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo',
  202. // key: value,
  203. // keyId: 'lessonno',
  204. // callback: function (_data) {
  205. // callback(_data['lessonname']);
  206. // }
  207. // });
  208. // }
  209. //},
  210. {
  211. label: "课程名称", name: "LessonName", width: 170, align: "left"
  212. },
  213. {
  214. label: "上课节次", name: "LessonSection", width: 100, align: "left",
  215. formatter: function (cellvalue, row) {
  216. if (cellvalue.indexOf(',') == -1)
  217. return "星期" + weekChina[cellvalue.slice(0, 1) - 1] + "第" + cellvalue.slice(1) + "节";
  218. else {
  219. return "星期" + weekChina[cellvalue.slice(0, 1) - 1] + "第" + cellvalue.slice(1, 2) + "、" + cellvalue.slice(4) + "节";
  220. }
  221. }
  222. },
  223. { label: "上课时间", name: "LessonTime", width: 150, align: "left" },
  224. { label: "学分", name: "StudyScore", width: 50, align: "left" },
  225. { label: "教师号", name: "EmpNo", width: 75, align: "left" },
  226. {
  227. label: "教师姓名", name: "EmpNo2", width: 100, align: "left",
  228. formatterAsync: function (callback, value, row, op, $cell) {
  229. learun.clientdata.getAsync('custmerData', {
  230. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo',
  231. key: value,
  232. keyId: 'empno',
  233. callback: function (_data) {
  234. callback(_data['empname']);
  235. }
  236. });
  237. }
  238. },
  239. {
  240. label: "教室", name: "ClassRoomNo", width: 60, align: "left",
  241. formatterAsync: function (callback, value, row, op, $cell) {
  242. learun.clientdata.getAsync('custmerData', {
  243. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'ClassRoomInfo',
  244. key: value,
  245. keyId: 'classroomno',
  246. callback: function (_data) {
  247. callback(_data['classroomname']);
  248. }
  249. });
  250. }
  251. },
  252. { label: "人数上限", name: "StuNumMax", width: 60, align: "left" },
  253. { label: "已报人数", name: "StuNumOfApply", width: 60, align: "left" },
  254. { label: "通过人数", name: "StuNum", width: 60, align: "left" },
  255. { label: "已报人数(预)", name: "StuNumOfApplyPre", width: 80, align: "left" },
  256. { label: "通过人数(预)", name: "StuNumPre", width: 80, align: "left" },
  257. {
  258. label: "是否已选专业", name: "IsElectiveMajor", width: 100, align: "left", formatter: function (cellvalue, row) {
  259. if (!!row.ElectiveMajorList && row.ElectiveMajorList.length > 0) {
  260. return "<span class=\"label label-success\">是</span>";
  261. } else {
  262. return "<span class=\"label label-default\">否</span>";
  263. }
  264. }
  265. },
  266. {
  267. label: "选课专业", name: "ElectiveMajorList", width: 150, align: "left", formatter: function (cellvalue, row) {
  268. var str = "";
  269. if (!!cellvalue && cellvalue.length > 0) {
  270. for (var i = 0; i < cellvalue.length; i++) {
  271. str += cellvalue[i].Grade + "级" + cellvalue[i].MajorName;
  272. if (i != cellvalue.length - 1) {
  273. str += ",";
  274. }
  275. }
  276. }
  277. return str;
  278. }
  279. }
  280. ],
  281. mainId: 'Id',
  282. isPage: true,
  283. sidx: 'AcademicYearNo DESC, Semester DESC, LessonName ASC',
  284. sord: 'desc'
  285. });
  286. page.search();
  287. },
  288. search: function (param) {
  289. param = param || {};
  290. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  291. }
  292. };
  293. refreshGirdData = function () {
  294. page.search();
  295. };
  296. page.init();
  297. }