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.
 
 
 
 
 
 

390 lines
18 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. page.bindSemesterAndYear();
  24. },
  25. bind: function () {
  26. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  27. page.search(queryJson);
  28. }, 220, 400);
  29. // 刷新
  30. $('#lr_refresh').on('click', function () {
  31. location.reload();
  32. });
  33. $('#AcademicYearNo').lrselect({
  34. placeholder: "学年",
  35. allowSearch: false,
  36. url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo',
  37. value: 'value',
  38. text: 'text'
  39. });
  40. //学期
  41. $('#Semester').lrselect({
  42. placeholder: "学期",
  43. allowSearch: false,
  44. url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetSemester',
  45. value: 'value',
  46. text: 'text'
  47. });
  48. $('#LessonName').lrDataSourceSelect({ code: 'LessonInfo', value: 'lessonno', text: 'lessonname' });
  49. //设置选课专业
  50. $('#lr_editMajor').on('click', function () {
  51. var keyValue = $('#gridtable').jfGridValue('Id');
  52. if (learun.checkrow(keyValue)) {
  53. var rowdata = $('#gridtable').jfGridGet('rowdata');
  54. //判断选中记录是否可以批量管理专业
  55. $.ajax({
  56. url: top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/IsBatchEditMajor',
  57. data: { data: JSON.stringify(rowdata) },
  58. type: "post",
  59. dataType: "json",
  60. async: false,
  61. cache: false,
  62. success: function (data) {
  63. if (data.data == true) {
  64. learun.layerForm({
  65. id: 'formmajor',
  66. title: '管理选课专业',
  67. url: top.$.rootUrl + '/EducationalAdministration/ElectiveMajor/Index?OLPOEId=' + keyValue,
  68. width: 1000,
  69. height: 700,
  70. //btn: null
  71. callBack: function (id) {
  72. return top[id].acceptClick(refreshGirdData);
  73. }
  74. });
  75. } else {
  76. return learun.alert.warning('只有同学期同课程支持批量管理专业!');
  77. }
  78. },
  79. error: function (XMLHttpRequest, textStatus, errorThrown) {
  80. learun.httpErrorLog(textStatus);
  81. },
  82. beforeSend: function () {
  83. },
  84. complete: function () {
  85. }
  86. });
  87. }
  88. });
  89. //新增
  90. $('#lr_add').on('click', function () {
  91. learun.layerForm({
  92. id: 'formadd',
  93. title: '新增',
  94. url: top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/FormElective',
  95. width: 700,
  96. height: 500,
  97. callBack: function (id) {
  98. return top[id].acceptClick(refreshGirdData);
  99. }
  100. });
  101. });
  102. //设置人数
  103. $('#lr_edit').on('click', function () {
  104. var keyValue = $('#gridtable').jfGridValue('Id');
  105. if (keyValue.indexOf(",") === -1) {
  106. if (learun.checkrow(keyValue)) {
  107. //选课开始后无法进行编辑
  108. //learun.httpAsyncGet(top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/IsSelectElectiveLesson', function (result) {
  109. // if (result.code == 200) {
  110. learun.layerForm({
  111. id: 'OpenLessonPlanOfElectiveform',
  112. title: '设置人数',
  113. url: top.$.rootUrl +
  114. '/EducationalAdministration/OpenLessonPlanOfElective/Form?keyValue=' + keyValue,
  115. width: 600,
  116. height: 400,
  117. callBack: function (id) {
  118. return top[id].acceptClick(refreshGirdData);
  119. }
  120. });
  121. // } else {
  122. // learun.alert.warning("学生选课已开始,合班编辑功能已停用。");
  123. // $('#lr_edit').hide();
  124. // }
  125. //});
  126. }
  127. } else {
  128. //批量设置
  129. learun.layerForm({
  130. id: 'OpenLessonPlanOfElectiveform',
  131. title: '设置人数',
  132. url: top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/FormBatch?keyValue=' + keyValue,
  133. width: 400,
  134. height: 300,
  135. callBack: function (id) {
  136. return top[id].acceptClick(refreshGirdData);
  137. }
  138. });
  139. }
  140. });
  141. //查看学生
  142. $('#lr_view').on('click', function () {
  143. var keyValue = $('#gridtable').jfGridValue('Id');
  144. if (learun.checkrow(keyValue)) {
  145. learun.layerForm({
  146. id: 'form',
  147. title: '查看学生',
  148. url: top.$.rootUrl + '/EducationalAdministration/StuSelectLessonListOfElective/FinishIndex?OLPEId=' + keyValue,
  149. width: 1000,
  150. height: 700,
  151. btn: null,
  152. end: function () {
  153. refreshGirdData();
  154. }
  155. });
  156. }
  157. });
  158. //审核学生
  159. $('#lr_audit').on('click', function () {
  160. var keyValue = $('#gridtable').jfGridValue('Id');
  161. if (learun.checkrow(keyValue)) {
  162. learun.layerForm({
  163. id: 'form',
  164. title: '审核学生',
  165. url: top.$.rootUrl + '/EducationalAdministration/StuSelectLessonListOfElective/AuditIndex?OLPEId=' + keyValue,
  166. width: 1000,
  167. height: 700,
  168. btn: null,
  169. end: function () {
  170. refreshGirdData();
  171. }
  172. });
  173. }
  174. });
  175. //查看已审学生(预)
  176. $('#lr_viewPre').on('click', function () {
  177. var keyValue = $('#gridtable').jfGridValue('Id');
  178. if (learun.checkrow(keyValue)) {
  179. learun.layerForm({
  180. id: 'form',
  181. title: '查看学生',
  182. url: top.$.rootUrl + '/EducationalAdministration/StuSelectLessonListOfElectivePre/FinishIndex?OLPEId=' + keyValue,
  183. width: 1000,
  184. height: 700,
  185. btn: null,
  186. end: function () {
  187. refreshGirdData();
  188. }
  189. });
  190. }
  191. });
  192. //审核学生(预)
  193. $('#lr_auditPre').on('click', function () {
  194. var keyValue = $('#gridtable').jfGridValue('Id');
  195. if (learun.checkrow(keyValue)) {
  196. learun.layerForm({
  197. id: 'form',
  198. title: '审核学生',
  199. url: top.$.rootUrl + '/EducationalAdministration/StuSelectLessonListOfElectivePre/AuditIndex?OLPEId=' + keyValue,
  200. width: 1000,
  201. height: 700,
  202. btn: null,
  203. end: function () {
  204. refreshGirdData();
  205. }
  206. });
  207. }
  208. });
  209. //编辑
  210. $('#lr_modify').on('click', function () {
  211. var keyValue = $('#gridtable').jfGridValue('Id');
  212. if (learun.checkrow(keyValue)) {
  213. learun.layerForm({
  214. id: 'OpenLessonPlanOfElectiveModifyForm',
  215. title: '编辑',
  216. url: top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/ModifyForm?keyValue=' + keyValue,
  217. width: 600,
  218. height: 400,
  219. callBack: function (id) {
  220. return top[id].acceptClick(refreshGirdData);
  221. }
  222. });
  223. }
  224. });
  225. //初始化学生选课记录
  226. $('#lr_initStuSelectLesson').on('click', function () {
  227. var keyValue = $('#gridtable').jfGridValue('Id');
  228. if (learun.checkrow(keyValue)) {
  229. //选课专业
  230. var ElectiveMajorList = $('#gridtable').jfGridValue('ElectiveMajorList');
  231. if (ElectiveMajorList.length <= 0) {
  232. return learun.alert.warning("请先管理选课专业!");
  233. }
  234. learun.layerConfirm('是否确认初始化学生选课记录!', function (res) {
  235. if (res) {
  236. learun.postForm(top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/InitStuSelectLesson', { keyValue: keyValue }, function () {
  237. refreshGirdData();
  238. });
  239. }
  240. });
  241. }
  242. });
  243. },
  244. bindSemesterAndYear: function () {
  245. $.ajax({
  246. url: top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/GetSemesterAndYear',
  247. type: "GET",
  248. dataType: "json",
  249. async: false,
  250. cache: false,
  251. success: function (res) {
  252. var data = res.data;
  253. if (!!data) {
  254. $('#AcademicYearNo').lrselectSet(data.AcademicYearShort);
  255. var Semester = data.Semester;
  256. $('#Semester').lrselectSet(Semester);
  257. var param = { "AcademicYearNo": data.AcademicYearShort, "Semester": data.Semester };
  258. page.search(param);
  259. }
  260. },
  261. error: function (XMLHttpRequest, textStatus, errorThrown) {
  262. learun.httpErrorLog(textStatus);
  263. },
  264. beforeSend: function () {
  265. },
  266. complete: function () {
  267. }
  268. });
  269. },
  270. // 初始化列表
  271. initGird: function () {
  272. $('#gridtable').lrAuthorizeJfGrid({
  273. url: top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/GetPageListOfMerge',
  274. headData: [
  275. { label: "学年", name: "AcademicYearNo", width: 45, align: "left" },
  276. { label: "学期", name: "Semester", width: 35, align: "left" },
  277. { label: "课程号", name: "LessonNo", width: 100, align: "left" },
  278. //{
  279. // label: "课程名称", name: "LessonNo2", width: 170, align: "left",
  280. // formatterAsync: function (callback, value, row, op, $cell) {
  281. // learun.clientdata.getAsync('custmerData', {
  282. // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo',
  283. // key: value,
  284. // keyId: 'lessonno',
  285. // callback: function (_data) {
  286. // callback(_data['lessonname']);
  287. // }
  288. // });
  289. // }
  290. //},
  291. {
  292. label: "课程名称", name: "LessonName", width: 170, align: "left"
  293. },
  294. {
  295. label: "上课节次", name: "LessonSection", width: 100, align: "left",
  296. formatter: function (cellvalue, row) {
  297. if (cellvalue.indexOf(',') == -1)
  298. return "星期" + weekChina[cellvalue.slice(0, 1) - 1] + "第" + cellvalue.slice(1) + "节";
  299. else {
  300. return "星期" + weekChina[cellvalue.slice(0, 1) - 1] + "第" + cellvalue.slice(1, 2) + "、" + cellvalue.slice(4) + "节";
  301. }
  302. }
  303. },
  304. { label: "上课时间", name: "LessonTime", width: 150, align: "left" },
  305. { label: "学分", name: "StudyScore", width: 50, align: "left" },
  306. { label: "教师号", name: "EmpNo", width: 75, align: "left" },
  307. {
  308. label: "教师姓名", name: "EmpNo2", width: 100, align: "left",
  309. formatterAsync: function (callback, value, row, op, $cell) {
  310. learun.clientdata.getAsync('custmerData', {
  311. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo',
  312. key: value,
  313. keyId: 'empno',
  314. callback: function (_data) {
  315. callback(_data['empname']);
  316. }
  317. });
  318. }
  319. },
  320. {
  321. label: "教室", name: "ClassRoomNo", width: 60, align: "left",
  322. formatterAsync: function (callback, value, row, op, $cell) {
  323. learun.clientdata.getAsync('custmerData', {
  324. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'ClassRoomInfo',
  325. key: value,
  326. keyId: 'classroomno',
  327. callback: function (_data) {
  328. callback(_data['classroomname']);
  329. }
  330. });
  331. }
  332. },
  333. { label: "人数上限", name: "StuNumMax", width: 60, align: "left" },
  334. { label: "已报人数", name: "StuNumOfApply", width: 60, align: "left" },
  335. { label: "通过人数", name: "StuNum", width: 60, align: "left" },
  336. { label: "已报人数(预)", name: "StuNumOfApplyPre", width: 80, align: "left" },
  337. { label: "通过人数(预)", name: "StuNumPre", width: 80, align: "left" },
  338. {
  339. label: "是否已选专业", name: "IsElectiveMajor", width: 100, align: "left", formatter: function (cellvalue, row) {
  340. if (!!row.ElectiveMajorList && row.ElectiveMajorList.length > 0) {
  341. return "<span class=\"label label-success\">是</span>";
  342. } else {
  343. return "<span class=\"label label-default\">否</span>";
  344. }
  345. }
  346. },
  347. {
  348. label: "选课专业", name: "ElectiveMajorList", width: 150, align: "left", formatter: function (cellvalue, row) {
  349. var str = "";
  350. if (!!cellvalue && cellvalue.length > 0) {
  351. for (var i = 0; i < cellvalue.length; i++) {
  352. str += cellvalue[i].Grade + "级" + cellvalue[i].MajorName;
  353. if (i != cellvalue.length - 1) {
  354. str += ",";
  355. }
  356. }
  357. }
  358. return str;
  359. }
  360. }
  361. ],
  362. mainId: 'Id',
  363. isPage: true,
  364. isMultiselect: true,
  365. sidx: 'AcademicYearNo DESC, Semester DESC, LessonName ASC',
  366. sord: 'desc'
  367. });
  368. //page.search();
  369. },
  370. search: function (param) {
  371. param = param || {};
  372. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  373. }
  374. };
  375. refreshGirdData = function () {
  376. page.search();
  377. };
  378. page.init();
  379. }