/* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) * Copyright (c) 2013-2018 北京泉江科技有限公司 * 创建人:超级管理员 * 日 期:2019-05-14 10:02 * 描 述:选修课课程信息 */ var weekChina = ["一", "二", "三", "四", "五", "六", "日"]; var refreshGirdData; var bootstrap = function ($, learun) { "use strict"; var page = { init: function () { //选课开始后无法进行编辑 //learun.httpAsyncGet(top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/IsSelectElectiveLesson', function (result) { // if (result.code == 200) { // } else { // learun.alert.warning("学生选课已开始,合班编辑功能已停用。"); // $('#lr_edit').hide(); // } //}); page.initGird(); page.bind(); }, bind: function () { $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { page.search(queryJson); }, 220, 400); // 刷新 $('#lr_refresh').on('click', function () { location.reload(); }); //设置选课专业 $('#lr_editMajor').on('click', function () { var keyValue = $('#gridtable').jfGridValue('Id'); if (learun.checkrow(keyValue)) { learun.layerForm({ id: 'formmajor', title: '管理选课专业', url: top.$.rootUrl + '/EducationalAdministration/ElectiveMajor/Index?OLPOEId=' + keyValue, width: 1000, height: 700, //btn: null callBack: function (id) { return top[id].acceptClick(refreshGirdData); } }); } }); //设置人数 $('#lr_edit').on('click', function () { var keyValue = $('#gridtable').jfGridValue('Id'); if (learun.checkrow(keyValue)) { //选课开始后无法进行编辑 //learun.httpAsyncGet(top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/IsSelectElectiveLesson', function (result) { // if (result.code == 200) { learun.layerForm({ id: 'OpenLessonPlanOfElectiveform', title: '设置人数', url: top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/Form?keyValue=' + keyValue, width: 600, height: 400, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } }); // } else { // learun.alert.warning("学生选课已开始,合班编辑功能已停用。"); // $('#lr_edit').hide(); // } //}); } }); //查看学生 $('#lr_view').on('click', function () { var keyValue = $('#gridtable').jfGridValue('Id'); if (learun.checkrow(keyValue)) { learun.layerForm({ id: 'form', title: '查看学生', url: top.$.rootUrl + '/EducationalAdministration/StuSelectLessonListOfElective/FinishIndex?OLPEId=' + keyValue, width: 1000, height: 700, btn: null, end: function () { refreshGirdData(); } }); } }); //审核学生 $('#lr_audit').on('click', function () { var keyValue = $('#gridtable').jfGridValue('Id'); if (learun.checkrow(keyValue)) { learun.layerForm({ id: 'form', title: '审核学生', url: top.$.rootUrl + '/EducationalAdministration/StuSelectLessonListOfElective/AuditIndex?OLPEId=' + keyValue, width: 1000, height: 700, btn: null, end: function () { refreshGirdData(); } }); } }); //查看已审学生(预) $('#lr_viewPre').on('click', function () { var keyValue = $('#gridtable').jfGridValue('Id'); if (learun.checkrow(keyValue)) { learun.layerForm({ id: 'form', title: '查看学生', url: top.$.rootUrl + '/EducationalAdministration/StuSelectLessonListOfElectivePre/FinishIndex?OLPEId=' + keyValue, width: 1000, height: 700, btn: null, end: function () { refreshGirdData(); } }); } }); //审核学生(预) $('#lr_auditPre').on('click', function () { var keyValue = $('#gridtable').jfGridValue('Id'); if (learun.checkrow(keyValue)) { learun.layerForm({ id: 'form', title: '审核学生', url: top.$.rootUrl + '/EducationalAdministration/StuSelectLessonListOfElectivePre/AuditIndex?OLPEId=' + keyValue, width: 1000, height: 700, btn: null, end: function () { refreshGirdData(); } }); } }); //编辑 $('#lr_modify').on('click', function () { var keyValue = $('#gridtable').jfGridValue('Id'); if (learun.checkrow(keyValue)) { learun.layerForm({ id: 'OpenLessonPlanOfElectiveModifyForm', title: '编辑', url: top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/ModifyForm?keyValue=' + keyValue, width: 600, height: 400, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } }); } }); }, // 初始化列表 initGird: function () { $('#gridtable').lrAuthorizeJfGrid({ url: top.$.rootUrl + '/EducationalAdministration/OpenLessonPlanOfElective/GetPageListOfMerge', headData: [ { label: "学年", name: "AcademicYearNo", width: 45, align: "left" }, { label: "学期", name: "Semester", width: 35, align: "left" }, { label: "课程号", name: "LessonNo", width: 70, align: "left" }, //{ // label: "课程名称", name: "LessonNo2", width: 170, align: "left", // formatterAsync: function (callback, value, row, op, $cell) { // learun.clientdata.getAsync('custmerData', { // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo', // key: value, // keyId: 'lessonno', // callback: function (_data) { // callback(_data['lessonname']); // } // }); // } //}, { label: "课程名称", name: "LessonName", width: 170, align: "left" }, { label: "上课节次", name: "LessonSection", width: 100, align: "left", formatter: function (cellvalue, row) { if (cellvalue.indexOf(',') == -1) return "星期" + weekChina[cellvalue.slice(0, 1) - 1] + "第" + cellvalue.slice(1) + "节"; else { return "星期" + weekChina[cellvalue.slice(0, 1) - 1] + "第" + cellvalue.slice(1, 2) + "、" + cellvalue.slice(4) + "节"; } } }, { label: "上课时间", name: "LessonTime", width: 150, align: "left" }, { label: "学分", name: "StudyScore", width: 50, align: "left" }, { label: "教师号", name: "EmpNo", width: 75, align: "left" }, { label: "教师姓名", name: "EmpNo2", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('custmerData', { url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo', key: value, keyId: 'empno', callback: function (_data) { callback(_data['empname']); } }); } }, { label: "教室", name: "ClassRoomNo", width: 60, align: "left", formatterAsync: function (callback, value, row, op, $cell) { learun.clientdata.getAsync('custmerData', { url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'ClassRoomInfo', key: value, keyId: 'classroomno', callback: function (_data) { callback(_data['classroomname']); } }); } }, { label: "人数上限", name: "StuNumMax", width: 60, align: "left" }, { label: "已报人数", name: "StuNumOfApply", width: 60, align: "left" }, { label: "通过人数", name: "StuNum", width: 60, align: "left" }, { label: "已报人数(预)", name: "StuNumOfApplyPre", width: 80, align: "left" }, { label: "通过人数(预)", name: "StuNumPre", width: 80, align: "left" }, { label: "是否已选专业", name: "IsElectiveMajor", width: 100, align: "left", formatter: function (cellvalue,row) { if (!!row.ElectiveMajorList && row.ElectiveMajorList.length > 0) { return ""; } else { return ""; } } }, { label: "选课专业", name: "ElectiveMajorList", width: 150, align: "left", formatter: function (cellvalue, row) { var str = ""; if (!!cellvalue && cellvalue.length > 0) { for (var i = 0; i < cellvalue.length; i++) { str += cellvalue[i].Grade + "级" + cellvalue[i].MajorName; if (i != cellvalue.length - 1) { str += ","; } } } return str; } } ], mainId: 'Id', isPage: true, sidx: 'AcademicYearNo DESC, Semester DESC, LessonName ASC', sord: 'desc' }); page.search(); }, search: function (param) { param = param || {}; $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); } }; refreshGirdData = function () { page.search(); }; page.init(); }