|
- /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
- * Copyright (c) 2013-2018 北京泉江科技有限公司
- * 创建人:超级管理员
- * 日 期:2019-05-14 10:02
- * 描 述:选课中心
- */
- var weekChina = ["一", "二", "三", "四", "五", "六", "日"];
- var refreshGirdData;
- //点击课程名称
- function LessonIntroduction(lessonno) {
- var html = "";
- top.learun.httpAsyncGet(top.$.rootUrl + '/EducationalAdministration/LessonInfo/GetLessonInfoEntityByLessonNo?lessonNo=' + lessonno, function (result) {
- if (result.code == 200) {
- if (result.data.Introduction == null) {
- top.learun.alert.warning("暂无课程简介。");
- return;
- }
- html = result.data.Introduction;
- layer.open({
- type: 1,
- closeBtn: 2,
- title: "课程简介",
- area: ['800px', '60%'],
- content: html
- });
- } else {
- top.learun.alert.warning("暂无课程简介。");
- }
- });
- }
- //点击教师名称
- function EmpIntroduction(empno) {
- var html = "";
- top.learun.httpAsyncGet(top.$.rootUrl + '/EducationalAdministration/EmpInfo/GetEmpInfoEntityByEmpNo?empNo=' + empno, function (result) {
- if (result.code == 200) {
- if (result.data.resume == null) {
- top.learun.alert.warning("暂无教师简介。");
- return;
- }
- html = result.data.resume;
- layer.open({
- type: 1,
- closeBtn: 2,
- title: "教师简介",
- area: ['800px', '60%'],
- content: html
- });
- } else {
- top.learun.alert.warning("暂无教师简介。");
- }
- });
- }
- var bootstrap = function ($, learun) {
- "use strict";
- var page = {
- init: function () {
- //是否为选课时间
- learun.httpAsyncGet(top.$.rootUrl + '/EducationalAdministration/LessonInfoOfElectiveOnline/IsSelectElectiveLesson', function (result) {
- if (result.code == 200) {//选课还未开始
- learun.alert.warning("当前时间不是线上选课时间!");
- return;
- } else {//选课已经开始
- 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_apply').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('Id');
- if (learun.checkrow(keyValue)) {
- var Status = $('#gridtable').jfGridValue('Status');
- if (Status == "1" || Status == "2") {//审核中、报名成功
- learun.alert.warning("系统不记录重复报名数据!");
- return false;
- }
- learun.layerConfirm('是否确认报名该课程!', function (res) {
- if (res) {
- //模式二:
- var _postData = {};
- _postData.keyValue = keyValue;
- _postData.StuNo = learun.clientdata.get(['userinfo']).enCode;
- $.ajax({
- url: WebApiUrl + '/Learun/LessonInfoOfElectiveOnline/SignIn',
- data: _postData,
- type: "POST",
- dataType: "json",
- async: false,
- cache: false,
- success: function (res) {
- if (res.code == 200) {
- learun.loading(true, '正在提交报名数据');
- //判断队列结果
- var timer = setInterval(function () {
- $.ajax({
- url: top.$.rootUrl + '/EducationalAdministration/LessonInfoOfElectiveOnline/GetApplyResult',
- data: { keyValue: keyValue },
- type: "POST",
- dataType: "json",
- async: false,
- cache: false,
- success: function (res) {
- if (res.code == 200) {
- refreshGirdData();
- clearInterval(timer);
- learun.loading(false);
- learun.alert.warning(res.info);
- }
- },
- error: function (XMLHttpRequest, textStatus, errorThrown) {
- learun.alert.warning("网络出错,请刷新!");
- },
- });
- }, 5000);
-
- } else {
- learun.alert.warning("系统异常,请稍后!");
- return false;
- }
- },
- error: function (XMLHttpRequest, textStatus, errorThrown) {
- learun.alert.warning("网络出错,请刷新!");
- },
- });
-
- }
- });
- }
- });
- //取消报名
- $('#lr_cancel').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('Id');
- if (learun.checkrow(keyValue)) {
- var Status = $('#gridtable').jfGridValue('Status');
- if (Status == "2") {//报名成功
- learun.alert.warning("当前课程已报名成功,无法取消!");
- return false;
- }
- if (Status != "1") {//审核中
- learun.alert.warning("当前课程未报名或者报名失败,无法取消!");
- return false;
- }
- learun.layerConfirm('是否确认取消报名该课程!', function (res) {
- if (res) {
- learun.postForm(top.$.rootUrl + '/EducationalAdministration/LessonInfoOfElectiveOnline/CancelApply', { keyValue: keyValue }, function () {
- refreshGirdData();
- });
- }
- });
- }
- });
- },
- // 初始化列表
- initGird: function () {
- $('#gridtable').jfGrid({
- url: top.$.rootUrl + '/EducationalAdministration/LessonInfoOfElectiveOnline/GetPageListOfStudent',
- headData: [
- { label: "学年", name: "AcademicYearNo", width: 100, align: "left" },
- { label: "学期", name: "Semester", width: 100, align: "left" },
- { label: "课程编号", name: "LessonNo", width: 150, align: "left" },
- { label: "课程名称", name: "LessonName", width: 150, align: "left" },
- { label: "建课教师", name: "EmpNo", width: 100, align: "left" },
- {
- label: "建课学校", name: "F_SchoolId", width: 150, align: "left"
- },
- //{ label: "报名人数上限", name: "StuNumMax", width: 100, align: "left" },
- { label: "已报人数", name: "StuNumOfApply", width: 100, align: "left" },
- {
- label: "报名状态", name: "Status", width: 100, align: "left",
- formatter: function (cellvalue, row) {
- if (cellvalue == 1) {
- return '<span class=\"label label-primary\">审核中</span>';
- } else if (cellvalue == 2) {
- return '<span class=\"label label-success\">报名成功</span>';
- } else if (cellvalue == 3) {
- return '<span class=\"label label-warning\">报名失败</span>';
- } else {
- return '<span class=\"label label-default\">未报名</span>';
- }
- }
- },
- ],
- mainId: 'Id',
- isPage: true,
- sidx: 'AcademicYearNo DESC, Semester DESC, LessonNo ASC'
- });
- page.search();
- },
- search: function (param) {
- param = param || {};
- param.StuNo = learun.clientdata.get(['userinfo']).enCode;
- param.StuMajorNo = StuMajorNo;
- param.StuGrade = StuGrade;
- $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
- }
- };
- refreshGirdData = function () {
- page.search();
- };
- page.init();
- }
|