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.

SetIndex.js 12 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2023-05-30 10:02
  5. * 描 述:线上选修课程设置
  6. */
  7. var refreshGirdData;
  8. var bootstrap = function ($, learun) {
  9. "use strict";
  10. var page = {
  11. init: function () {
  12. page.initGird();
  13. page.bind();
  14. page.bindSemesterAndYear();
  15. },
  16. bind: function () {
  17. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  18. page.search(queryJson);
  19. }, 220, 400);
  20. // 刷新
  21. $('#lr_refresh').on('click', function () {
  22. location.reload();
  23. });
  24. $('#AcademicYearNo').lrselect({
  25. placeholder: "学年",
  26. allowSearch: false,
  27. url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo',
  28. value: 'value',
  29. text: 'text'
  30. });
  31. //学期
  32. $('#Semester').lrselect({
  33. placeholder: "学期",
  34. allowSearch: false,
  35. url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetSemester',
  36. value: 'value',
  37. text: 'text'
  38. });
  39. $('#LessonName').lrDataSourceSelect({ code: 'LessonInfoOfElectiveOnline', value: 'lessonno', text: 'lessonname' });
  40. //设置选课专业
  41. $('#lr_editMajor').on('click', function () {
  42. var keyValue = $('#gridtable').jfGridValue('Id');
  43. if (learun.checkrow(keyValue)) {
  44. var rowdata = $('#gridtable').jfGridGet('rowdata');
  45. //判断选中记录是否可以批量管理专业
  46. $.ajax({
  47. url: top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/IsBatchEditMajor',
  48. data: { data: JSON.stringify(rowdata) },
  49. type: "post",
  50. dataType: "json",
  51. async: false,
  52. cache: false,
  53. success: function (data) {
  54. if (data.data == true) {
  55. learun.layerForm({
  56. id: 'formMajor',
  57. title: '管理选课专业',
  58. url: top.$.rootUrl + '/EducationalAdministration/ElectiveMajorOnline/Index?LIOEOId=' + keyValue,
  59. width: 1000,
  60. height: 700,
  61. callBack: function (id) {
  62. return top[id].acceptClick(refreshGirdData);
  63. }
  64. });
  65. } else {
  66. return learun.alert.warning('只有同学期同课程支持批量管理专业!');
  67. }
  68. },
  69. error: function (XMLHttpRequest, textStatus, errorThrown) {
  70. learun.httpErrorLog(textStatus);
  71. },
  72. beforeSend: function () {
  73. },
  74. complete: function () {
  75. }
  76. });
  77. }
  78. });
  79. //设置人数
  80. $('#lr_edit').on('click', function () {
  81. var keyValue = $('#gridtable').jfGridValue('Id');
  82. if (learun.checkrow(keyValue)) {
  83. learun.layerForm({
  84. id: 'formNum',
  85. title: '设置人数',
  86. url: top.$.rootUrl + '/EducationalAdministration/LessonInfoOfElectiveOnline/FormNum?keyValue=' + keyValue,
  87. width: 400,
  88. height: 300,
  89. callBack: function (id) {
  90. return top[id].acceptClick(refreshGirdData);
  91. }
  92. });
  93. }
  94. });
  95. //查看已审学生
  96. $('#lr_view').on('click', function () {
  97. var keyValue = $('#gridtable').jfGridValue('Id');
  98. if (learun.checkrow(keyValue)) {
  99. if (keyValue.indexOf(',') != -1) {
  100. learun.alert.warning("只能选择一条记录进行查看!");
  101. return;
  102. }
  103. learun.layerForm({
  104. id: 'form',
  105. title: '查看学生',
  106. url: top.$.rootUrl + '/EducationalAdministration/StuSelectLessonListOfElectiveOnline/FinishIndex?LIOEOId=' + keyValue,
  107. width: 1000,
  108. height: 700,
  109. btn: null,
  110. end: function () {
  111. refreshGirdData();
  112. }
  113. });
  114. }
  115. });
  116. //审核学生
  117. $('#lr_audit').on('click', function () {
  118. var keyValue = $('#gridtable').jfGridValue('Id');
  119. if (learun.checkrow(keyValue)) {
  120. if (keyValue.indexOf(',') != -1) {
  121. learun.alert.warning("只能选择一条记录进行查看!");
  122. return;
  123. }
  124. learun.layerForm({
  125. id: 'form',
  126. title: '审核学生',
  127. url: top.$.rootUrl + '/EducationalAdministration/StuSelectLessonListOfElectiveOnline/AuditIndex?LIOEOId=' + keyValue,
  128. width: 1000,
  129. height: 700,
  130. btn: null,
  131. end: function () {
  132. refreshGirdData();
  133. }
  134. });
  135. }
  136. });
  137. //设置可选
  138. $('#lr_AllowSelect').on('click', function () {
  139. var keyValue = $('#gridtable').jfGridValue('Id');
  140. if (learun.checkrow(keyValue)) {
  141. learun.postForm(top.$.rootUrl + '/EducationalAdministration/LessonInfoOfElectiveOnline/SetUpIsAllowSelect', { keyValue: keyValue, IsAllowSelect: 1 },
  142. function () {
  143. refreshGirdData();
  144. });
  145. }
  146. });
  147. //取消可选
  148. $('#lr_CancelSelect').on('click', function () {
  149. var keyValue = $('#gridtable').jfGridValue('Id');
  150. if (learun.checkrow(keyValue)) {
  151. learun.postForm(top.$.rootUrl + '/EducationalAdministration/LessonInfoOfElectiveOnline/SetUpIsAllowSelect', { keyValue: keyValue, IsAllowSelect: 0 },
  152. function () {
  153. refreshGirdData();
  154. });
  155. }
  156. });
  157. },
  158. bindSemesterAndYear: function () {
  159. $.ajax({
  160. url: top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/GetSemesterAndYear',
  161. type: "GET",
  162. dataType: "json",
  163. async: false,
  164. cache: false,
  165. success: function (res) {
  166. var data = res.data;
  167. if (!!data) {
  168. $('#AcademicYearNo').lrselectSet(data.AcademicYearShort);
  169. var Semester = data.Semester;
  170. $('#Semester').lrselectSet(Semester);
  171. var param = { "AcademicYearNo": data.AcademicYearShort, "Semester": data.Semester };
  172. page.search(param);
  173. }
  174. },
  175. error: function (XMLHttpRequest, textStatus, errorThrown) {
  176. learun.httpErrorLog(textStatus);
  177. },
  178. beforeSend: function () {
  179. },
  180. complete: function () {
  181. }
  182. });
  183. },
  184. // 初始化列表
  185. initGird: function () {
  186. $('#gridtable').jfGrid({
  187. url: top.$.rootUrl + '/EducationalAdministration/LessonInfoOfElectiveOnline/GetPageList',
  188. headData: [
  189. { label: "课程编号", name: "LessonNo", width: 150, align: "left" },
  190. { label: "课程名称", name: "LessonName", width: 150, align: "left" },
  191. { label: "学年", name: "AcademicYearNo", width: 100, align: "left" },
  192. { label: "学期", name: "Semester", width: 100, align: "left" },
  193. {
  194. label: "建课教师", name: "EmpNo", width: 150, align: "left"
  195. },
  196. {
  197. label: "建课学校", name: "F_SchoolId", width: 150, align: "left"
  198. },
  199. { label: "人数上限", name: "StuNumMax", width: 60, align: "left" },
  200. { label: "已报人数", name: "StuNumOfApply", width: 60, align: "left" },
  201. { label: "通过人数", name: "StuNum", width: 60, align: "left" },
  202. {
  203. label: "是否可选", name: "IsAllowSelect", width: 80, align: "left",
  204. formatter: function (cellvalue, rowObject) {
  205. return cellvalue == 1 ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  206. }
  207. },
  208. {
  209. label: "是否已选专业", name: "IsElectiveMajor", width: 100, align: "left", formatter: function (cellvalue, row) {
  210. if (!!row.ElectiveMajorOnlineList && row.ElectiveMajorOnlineList.length > 0) {
  211. return "<span class=\"label label-success\">是</span>";
  212. } else {
  213. return "<span class=\"label label-default\">否</span>";
  214. }
  215. }
  216. },
  217. {
  218. label: "选课专业", name: "ElectiveMajorOnlineList", width: 150, align: "left", formatter: function (cellvalue, row) {
  219. var str = "";
  220. if (!!cellvalue && cellvalue.length > 0) {
  221. for (var i = 0; i < cellvalue.length; i++) {
  222. str += cellvalue[i].Grade + "级" + cellvalue[i].MajorName;
  223. if (i != cellvalue.length - 1) {
  224. str += ",";
  225. }
  226. }
  227. }
  228. return str;
  229. }
  230. }
  231. ],
  232. mainId: 'Id',
  233. isPage: true,
  234. isMultiselect: true,
  235. sidx: 'AcademicYearNo DESC, Semester DESC, LessonNo ASC'
  236. });
  237. //page.search();
  238. },
  239. search: function (param) {
  240. param = param || {};
  241. param.CheckMark = "1";//已启用
  242. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  243. }
  244. };
  245. refreshGirdData = function () {
  246. var param = { "AcademicYearNo": $('#AcademicYearNo').lrselectGet(), "Semester": $('#Semester').lrselectGet() };
  247. page.search(param);
  248. };
  249. page.init();
  250. }