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.
 
 
 
 
 
 

180 lines
7.9 KiB

  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2019-08-26 16:58
  5. * 描 述:选修合班设置
  6. */
  7. var refreshGirdData;
  8. var bootstrap = function ($, learun) {
  9. "use strict";
  10. var page = {
  11. init: function () {
  12. //选课开始后无法进行编辑
  13. learun.httpAsyncGet(top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/IsSelectElectiveLesson', function (result) {
  14. if (result.code == 200) {
  15. } else {
  16. learun.alert.warning("学生选课已开始,合班编辑功能已停用。");
  17. $('#lr_add').hide();
  18. $('#lr_delete').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_add').on('click', function () {
  51. //选课开始后无法进行编辑
  52. learun.httpAsyncGet(top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/IsSelectElectiveLesson', function (result) {
  53. if (result.code == 200) {
  54. learun.layerForm({
  55. id: 'formmerge',
  56. title: '管理合班',
  57. url: top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/Index',
  58. width: 1200,
  59. height: 600,
  60. btn: null,
  61. end: function () {
  62. refreshGirdData();
  63. }
  64. });
  65. } else {
  66. learun.alert.warning("学生选课已开始,合班编辑功能已停用。");
  67. $('#lr_add').hide();
  68. $('#lr_delete').hide();
  69. }
  70. });
  71. });
  72. // 合班明细
  73. $('#lr_viewitem').on('click', function () {
  74. var keyValue = $('#gridtable').jfGridValue('EMId');
  75. var LessonName = $('#gridtable').jfGridValue('LessonName');
  76. var LessonNo = $('#gridtable').jfGridValue('LessonNo');
  77. if (learun.checkrow(keyValue)) {
  78. learun.layerForm({
  79. id: 'formitem',
  80. title: LessonName + '(' + LessonNo + ')合班明细',
  81. url: top.$.rootUrl + '/EducationalAdministration/ElectiveMergeItem/Index?EmId=' + keyValue,
  82. width: 1200,
  83. height: 600,
  84. btn: null
  85. });
  86. }
  87. });
  88. // 取消合班
  89. $('#lr_delete').on('click', function () {
  90. var keyValue = $('#gridtable').jfGridValue('EMId');
  91. if (learun.checkrow(keyValue)) {
  92. learun.httpAsyncGet(top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/IsSelectElectiveLesson', function (result) {
  93. if (result.code == 200) {
  94. learun.layerConfirm('是否确认取消合班!', function (res) {
  95. if (res) {
  96. learun.postForm(top.$.rootUrl + '/EducationalAdministration/ElectiveMerge/DeleteForm', { keyValue: keyValue }, function () {
  97. refreshGirdData();
  98. });
  99. }
  100. });
  101. } else {
  102. learun.alert.warning("学生选课已开始,合班编辑功能已停用。");
  103. $('#lr_add').hide();
  104. $('#lr_delete').hide();
  105. }
  106. });
  107. }
  108. });
  109. },
  110. // 初始化列表
  111. initGird: function () {
  112. $('#gridtable').lrAuthorizeJfGrid({
  113. url: top.$.rootUrl + '/EducationalAdministration/ElectiveMerge/GetPageList',
  114. headData: [
  115. { label: "学年", name: "AcademicYearNo", width: 80, align: "left" },
  116. { label: "学期", name: "Semester", width: 60, align: "left" },
  117. { label: "课程编号", name: "LessonNo", width: 100, align: "left" },
  118. {
  119. label: "课程名称", name: "LessonNo", width: 200, align: "left",
  120. formatterAsync: function (callback, value, row, op, $cell) {
  121. learun.clientdata.getAsync('custmerData', {
  122. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo',
  123. key: value,
  124. keyId: 'lessonno',
  125. callback: function (_data) {
  126. callback(_data['lessonname']);
  127. }
  128. });
  129. }
  130. },
  131. { label: "学分", name: "StudyScore", width: 60, align: "left" }
  132. ],
  133. mainId: 'EMId',
  134. isPage: true
  135. });
  136. //page.search();
  137. },
  138. bindSemesterAndYear: function () {
  139. $.ajax({
  140. url: top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/GetSemesterAndYear',
  141. type: "GET",
  142. dataType: "json",
  143. async: false,
  144. cache: false,
  145. success: function (res) {
  146. var data = res.data;
  147. if (!!data) {
  148. $('#AcademicYearNo').lrselectSet(data.AcademicYearShort);
  149. var Semester = data.Semester;
  150. $('#Semester').lrselectSet(Semester);
  151. var param = { "AcademicYearNo": data.AcademicYearShort, "Semester": data.Semester };
  152. page.search(param);
  153. }
  154. },
  155. error: function (XMLHttpRequest, textStatus, errorThrown) {
  156. learun.httpErrorLog(textStatus);
  157. },
  158. beforeSend: function () {
  159. },
  160. complete: function () {
  161. }
  162. });
  163. },
  164. search: function (param) {
  165. param = param || {};
  166. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  167. }
  168. };
  169. refreshGirdData = function () {
  170. var param = {};
  171. param.AcademicYearNo = $('#AcademicYearNo').lrselectGet();
  172. param.Semester = $('#Semester').lrselectGet();
  173. param.LessonName = $('#LessonName').lrselectGet();
  174. page.search(param);
  175. };
  176. page.init();
  177. }