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.
 
 
 
 
 
 

455 lines
21 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_StuSelectCount').on('click', function () {
  160. learun.layerForm({
  161. id: 'StuSelectCountIndex',
  162. title: '学生选课次数',
  163. url: top.$.rootUrl + '/EducationalAdministration/OLPElectiveStuSelectCount/Index',
  164. width: 1000,
  165. height: 700,
  166. btn: null,
  167. end: function () {
  168. //refreshGirdData();
  169. }
  170. });
  171. });
  172. //审核学生
  173. $('#lr_audit').on('click', function () {
  174. var keyValue = $('#gridtable').jfGridValue('Id');
  175. if (learun.checkrow(keyValue)) {
  176. learun.layerForm({
  177. id: 'form',
  178. title: '审核学生',
  179. url: top.$.rootUrl + '/EducationalAdministration/StuSelectLessonListOfElective/AuditIndex?OLPEId=' + keyValue,
  180. width: 1000,
  181. height: 700,
  182. btn: null,
  183. end: function () {
  184. refreshGirdData();
  185. }
  186. });
  187. }
  188. });
  189. //查看已审学生(预)
  190. $('#lr_viewPre').on('click', function () {
  191. var keyValue = $('#gridtable').jfGridValue('Id');
  192. if (learun.checkrow(keyValue)) {
  193. learun.layerForm({
  194. id: 'form',
  195. title: '查看学生',
  196. url: top.$.rootUrl + '/EducationalAdministration/StuSelectLessonListOfElectivePre/FinishIndex?OLPEId=' + keyValue,
  197. width: 1000,
  198. height: 700,
  199. btn: null,
  200. end: function () {
  201. refreshGirdData();
  202. }
  203. });
  204. }
  205. });
  206. //审核学生(预)
  207. $('#lr_auditPre').on('click', function () {
  208. var keyValue = $('#gridtable').jfGridValue('Id');
  209. if (learun.checkrow(keyValue)) {
  210. learun.layerForm({
  211. id: 'form',
  212. title: '审核学生',
  213. url: top.$.rootUrl + '/EducationalAdministration/StuSelectLessonListOfElectivePre/AuditIndex?OLPEId=' + keyValue,
  214. width: 1000,
  215. height: 700,
  216. btn: null,
  217. end: function () {
  218. refreshGirdData();
  219. }
  220. });
  221. }
  222. });
  223. //编辑
  224. $('#lr_modify').on('click', function () {
  225. var keyValue = $('#gridtable').jfGridValue('Id');
  226. if (learun.checkrow(keyValue)) {
  227. learun.layerForm({
  228. id: 'OpenLessonPlanOfElectiveModifyForm',
  229. title: '编辑',
  230. url: top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/ModifyForm?keyValue=' + keyValue,
  231. width: 600,
  232. height: 400,
  233. callBack: function (id) {
  234. return top[id].acceptClick(refreshGirdData);
  235. }
  236. });
  237. }
  238. });
  239. //初始化学生选课记录
  240. $('#lr_initStuSelectLesson').on('click', function () {
  241. var keyValue = $('#gridtable').jfGridValue('Id');
  242. if (learun.checkrow(keyValue)) {
  243. //选课专业
  244. var ElectiveMajorList = $('#gridtable').jfGridValue('ElectiveMajorList');
  245. if (ElectiveMajorList.length <= 0) {
  246. return learun.alert.warning("请先管理选课专业!");
  247. }
  248. learun.layerConfirm('是否确认初始化学生选课记录!', function (res) {
  249. if (res) {
  250. learun.postForm(top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/InitStuSelectLesson', { keyValue: keyValue }, function () {
  251. refreshGirdData();
  252. });
  253. }
  254. });
  255. }
  256. });
  257. //删除
  258. $('#lr_delete').on('click', function () {
  259. var keyValue = $('#gridtable').jfGridValue('Id');
  260. if (learun.checkrow(keyValue)) {
  261. var rowdata = $('#gridtable').jfGridGet('rowdata');
  262. try {
  263. rowdata.forEach(function (item, index, row) {
  264. if (!!item.StuNumMax || !!item.StuNumOfApply || !!item.StuNum) {
  265. throw learun.alert.warning("人数上限、已报人数、通过人数大于0的不能删除!");
  266. }
  267. if (!!item.ElectiveMajorList && item.ElectiveMajorList.length > 0) {
  268. throw learun.alert.warning("已选专业的数据不允许删除!");
  269. }
  270. });
  271. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/DeleteElective', { keyValue: keyValue },
  272. function () {
  273. refreshGirdData();
  274. });
  275. } catch (e) {
  276. }
  277. }
  278. });
  279. //设置可选
  280. $('#lr_AllowSelect').on('click', function () {
  281. var keyValue = $('#gridtable').jfGridValue('Id');
  282. if (learun.checkrow(keyValue)) {
  283. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/SetUpIsAllowSelect', { keyValue: keyValue, IsAllowSelect: 1 },
  284. function () {
  285. refreshGirdData();
  286. });
  287. }
  288. });
  289. //取消可选
  290. $('#lr_CancelSelect').on('click', function () {
  291. var keyValue = $('#gridtable').jfGridValue('Id');
  292. if (learun.checkrow(keyValue)) {
  293. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/SetUpIsAllowSelect', { keyValue: keyValue, IsAllowSelect: 0 },
  294. function () {
  295. refreshGirdData();
  296. });
  297. }
  298. });
  299. },
  300. bindSemesterAndYear: function () {
  301. $.ajax({
  302. url: top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/GetSemesterAndYear',
  303. type: "GET",
  304. dataType: "json",
  305. async: false,
  306. cache: false,
  307. success: function (res) {
  308. var data = res.data;
  309. if (!!data) {
  310. $('#AcademicYearNo').lrselectSet(data.AcademicYearShort);
  311. var Semester = data.Semester;
  312. $('#Semester').lrselectSet(Semester);
  313. var param = { "AcademicYearNo": data.AcademicYearShort, "Semester": data.Semester };
  314. page.search(param);
  315. }
  316. },
  317. error: function (XMLHttpRequest, textStatus, errorThrown) {
  318. learun.httpErrorLog(textStatus);
  319. },
  320. beforeSend: function () {
  321. },
  322. complete: function () {
  323. }
  324. });
  325. },
  326. // 初始化列表
  327. initGird: function () {
  328. $('#gridtable').jfGrid({
  329. url: top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/GetPageListOfMerge',
  330. headData: [
  331. { label: "学年", name: "AcademicYearNo", width: 45, align: "left" },
  332. { label: "学期", name: "Semester", width: 35, align: "left" },
  333. { label: "课程号", name: "LessonNo", width: 100, align: "left" },
  334. //{
  335. // label: "课程名称", name: "LessonNo2", width: 170, align: "left",
  336. // formatterAsync: function (callback, value, row, op, $cell) {
  337. // learun.clientdata.getAsync('custmerData', {
  338. // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo',
  339. // key: value,
  340. // keyId: 'lessonno',
  341. // callback: function (_data) {
  342. // callback(_data['lessonname']);
  343. // }
  344. // });
  345. // }
  346. //},
  347. {
  348. label: "课程名称", name: "LessonName", width: 170, align: "left"
  349. },
  350. {
  351. label: "上课节次", name: "LessonSection", width: 100, align: "left",
  352. formatter: function (cellvalue, row) {
  353. if (cellvalue.indexOf(',') == -1)
  354. return "星期" + weekChina[cellvalue.slice(0, 1) - 1] + "第" + cellvalue.slice(1) + "节";
  355. else {
  356. return "星期" + weekChina[cellvalue.slice(0, 1) - 1] + "第" + cellvalue.slice(1, 2) + "、" + cellvalue.slice(4) + "节";
  357. }
  358. }
  359. },
  360. { label: "上课时间", name: "LessonTime", width: 150, align: "left" },
  361. { label: "学分", name: "StudyScore", width: 50, align: "left" },
  362. { label: "教师号", name: "EmpNo", width: 75, align: "left" },
  363. {
  364. label: "教师姓名", name: "EmpNo2", width: 100, align: "left",
  365. formatterAsync: function (callback, value, row, op, $cell) {
  366. learun.clientdata.getAsync('custmerData', {
  367. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo',
  368. key: row.EmpNo,
  369. keyId: 'empno',
  370. callback: function (_data) {
  371. callback(_data['empname']);
  372. }
  373. });
  374. }
  375. },
  376. {
  377. label: "教室", name: "ClassRoomNo", width: 60, align: "left",
  378. formatterAsync: function (callback, value, row, op, $cell) {
  379. learun.clientdata.getAsync('custmerData', {
  380. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'ClassRoomInfo',
  381. key: value,
  382. keyId: 'classroomno',
  383. callback: function (_data) {
  384. callback(_data['classroomname']);
  385. }
  386. });
  387. }
  388. },
  389. { label: "人数上限", name: "StuNumMax", width: 60, align: "left" },
  390. { label: "已报人数", name: "StuNumOfApply", width: 60, align: "left" },
  391. { label: "通过人数", name: "StuNum", width: 60, align: "left" },
  392. { label: "已报人数(预)", name: "StuNumOfApplyPre", width: 80, align: "left" },
  393. { label: "通过人数(预)", name: "StuNumPre", width: 80, align: "left" },
  394. {
  395. label: "是否可选", name: "IsAllowSelect", width: 80, align: "left",
  396. formatter: function (cellvalue, rowObject) {
  397. return cellvalue == 1 ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  398. }
  399. },
  400. {
  401. label: "是否已选专业", name: "IsElectiveMajor", width: 100, align: "left", formatter: function (cellvalue, row) {
  402. if (!!row.ElectiveMajorList && row.ElectiveMajorList.length > 0) {
  403. return "<span class=\"label label-success\">是</span>";
  404. } else {
  405. return "<span class=\"label label-default\">否</span>";
  406. }
  407. }
  408. },
  409. {
  410. label: "选课专业", name: "ElectiveMajorList", width: 150, align: "left", formatter: function (cellvalue, row) {
  411. var str = "";
  412. if (!!cellvalue && cellvalue.length > 0) {
  413. for (var i = 0; i < cellvalue.length; i++) {
  414. str += cellvalue[i].Grade + "级" + cellvalue[i].MajorName;
  415. if (i != cellvalue.length - 1) {
  416. str += ",";
  417. }
  418. }
  419. }
  420. return str;
  421. }
  422. }
  423. ],
  424. mainId: 'Id',
  425. isPage: true,
  426. isMultiselect: true,
  427. sidx: 'AcademicYearNo DESC, Semester DESC, LessonName ASC',
  428. sord: 'desc'
  429. });
  430. //page.search();
  431. },
  432. search: function (param) {
  433. param = param || {};
  434. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  435. }
  436. };
  437. refreshGirdData = function () {
  438. page.search();
  439. };
  440. page.init();
  441. }