diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/ArrangeLessonTermController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/ArrangeLessonTermController.cs index 0877ea46a..c74836263 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/ArrangeLessonTermController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/ArrangeLessonTermController.cs @@ -33,6 +33,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers private WeChatTempletIBLL weChatTempletIbll = new WeChatTempletBLL(); private SchoolCalendarIBLL schoolCalendarIbll = new SchoolCalendarBLL(); private StuInfoBasicIBLL stuInfoBasicIbll = new StuInfoBasicBLL(); + private EmpInfoIBLL empInfoIbll = new EmpInfoBLL(); #region 视图功能 @@ -82,14 +83,39 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers { return View(); } + /// + /// 学生课表 + /// + /// [HttpGet] public ActionResult IndexLessonTermStu() { var LogInfo = LoginUserInfo.Get(); - var StuInfo = stuInfoBasicIbll.GetAllList().Where(x => x.StuNo == LogInfo.account); - if (StuInfo != null) + if (LogInfo.Description == "学生") + { + var StuInfo = stuInfoBasicIbll.GetAllList().Where(x => x.StuNo == LogInfo.account); + if (StuInfo != null) + { + ViewBag.ClassNo = StuInfo.FirstOrDefault().ClassNo; + } + } + return View(); + } + /// + /// 教师课表 + /// + /// + [HttpGet] + public ActionResult IndexLessonTermTeach() + { + var LogInfo = LoginUserInfo.Get(); + if (LogInfo.Description=="教师") { - ViewBag.ClassNo = StuInfo.FirstOrDefault().ClassNo; + var empInfo = empInfoIbll.GetAllList().Where(x => x.EmpNo == LogInfo.account); + if (empInfo != null) + { + ViewBag.EmpNo = empInfo.FirstOrDefault().EmpNo; + } } return View(); } @@ -260,9 +286,12 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers var strSemester = semesterAndYear.Semester; if (string.IsNullOrEmpty(classNo)) { - var res = new - { schoolName = "课程表", semester = $"{strAcademicYear}学年度 第{strSemester}学期", weekList = "" }; - return JsonResult(res); + if (userInfo.Description != "教师") + { + var res = new + { schoolName = "课程表", semester = $"{strAcademicYear}学年度 第{strSemester}学期", weekList = "" }; + return JsonResult(res); + } } //校历 @@ -281,6 +310,24 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers var timeTableList = new List(); //课程表 var data = arrangeLessonTermIBLL.GetTimeTableInEducation(startDate, endDate, classNo, "", ""); + + if (userInfo.Description == "学生") + { + data = arrangeLessonTermIBLL.GetTimeTableInEducation(startDate, endDate, classNo, "", ""); + } + else if (userInfo.Description == "教师") + { + var empInfo = empInfoIbll.GetAllList().Where(x => x.EmpNo == userInfo.account); + if (empInfo != null) + { + data = arrangeLessonTermIBLL.GetTimeTableInEducation(startDate, endDate, "", empInfo.FirstOrDefault().EmpNo, ""); + } + } + else + { + data = arrangeLessonTermIBLL.GetTimeTableInEducation(startDate, endDate, classNo, "", ""); + } + timeTableList.AddRange(data); //选修课课程表 //var dataOfElective = arrangeLessonTermOfElectiveIBLL.GetTimeTableInEducation(startDate, endDate, classNo, "", ""); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/IndexLessonTermTeach.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/IndexLessonTermTeach.cshtml new file mode 100644 index 000000000..4ab6317c3 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/IndexLessonTermTeach.cshtml @@ -0,0 +1,168 @@ +@{ + ViewBag.Title = "课程表"; + Layout = "~/Views/Shared/_Index.cshtml"; +} + + + + + +
+
+
+
+
+
+
+ +
+
+
周次:
+
+
+
+
+
+
+
+
+
+
+@Html.AppendJsFile("/Areas/EducationalAdministration/Views/ArrangeLessonTerm/IndexLessonTermTeach.js") + + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/IndexLessonTermTeach.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/IndexLessonTermTeach.js new file mode 100644 index 000000000..8d9c74e08 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/IndexLessonTermTeach.js @@ -0,0 +1,217 @@ +var refreshGirdData; +var bootstrap = function ($, learun) { + var classNo = EmpNo; + var curWeek; + var weekList; + var page = { + init: function () { + page.bind(); + //page.bindSelect(); + }, + loadData: function (param) { + $.lrSetFormWithParam(top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTerm/GetDataInEducation', param, + function (data) { + //console.log('res', data); + // 数据处理 + var html = '节次/星期星期一星期二星期三星期四星期五星期六星期日星期八星期九星期十'; + var weekLists = data.weekList; + //十节课 + for (var i = 1; i < 11; i++) { + (function (arg) { + var args = arg - 1; + var datas = flogs(arg, weekLists, 'time'); + //console.log('datas', datas); + html += ' ' + arg + '节'; + if (datas) { + var lists = datas.list; + html += tdHandles(lists); + } else { + html += tdHandle(arg); + } + html += ''; + })(i); //调用时参数 + } + $('.personT').text(data.schoolName); + $('.perSemester').text(data.semester); + $('.perFestivalsBox table').html(html); + + function flogs(num, data, obj) { + var flog = false; + $.each(data, + function (i, n) { + if (n[obj] == num) { + flog = n; + return; + } + }) + return flog; + } + function flogs2(num, data, obj) { + var arr = new Array(); + $.each(data, + function (i, n) { + if (n[obj] == num) { + arr.push(n); + } + }) + return arr; + } + + //某节课空 + function tdHandle() { + var html = ''; + for (var j = 0; j < 10; j++) { + html += '
'; + } + return html; + } + + //某节课不空 + function tdHandles(lists) { + var html = ''; + for (var k = 1; k < 11; k++) { + (function (arg) { + var args = arg - 1; + var datas = flogs2(arg, lists, 'day'); + if (datas.length > 0) { + html += ''; + $.each(datas, function (i, item) { + if (i > 0) { + html += '
'; + } + html += '
' + + item.curriculum + + '
' + + '
' + + item.teacher + + '
' + + '
' + + item.classRoom + + '
'; + //html += '
课程:' + + // item.curriculum + + // '
' + + // '
教师:' + + // item.teacher + + // '
' + + // '
班级:' + + // item.className + + // '
' + + // '
教室:' + + // item.classRoom + + // '
'; + }); + html += ''; + + } else { + html += '
'; + } + + })(k); + } + return html; + } + }); + }, + bind: function () { + //获取周次 + learun.httpAsyncGet(top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTerm/GetWeekTime', function (res) { + if (res.code == 200) { + weekList = res.data.weekList; + $('#WeekTimes').lrRadioCheckbox({ + type: 'radio', + data: res.data.weekList, + value: 'value', + text: 'text' + }); + curWeek = res.data.curWeek; + if (!$('#WeekTimes').find('input[value="' + res.data.curWeek + '"]').is(":checked")) { + $('#WeekTimes').find('input[value="' + res.data.curWeek + '"]').trigger('click'); + } + //周次 + $('#WeekTimeSelect').lrselect({ + placeholder: "请选择周次", + maxHeight: 300, + allowSearch: true, + type: 'multiple', + //data: res.data.weekList, + value: 'value', + text: 'text' + }); + $('#WeekTimeSelect').lrselectRefresh({ + data: res.data.weekList + } + ); + } + + }); + ////切换周次 + //$('#WeekTimes').change(function () { + // curWeek = $('#WeekTimes input[name="WeekTimes"]:checked ').val(); + // page.search(); + //}); + // 刷新 + //$('#lr_refresh').on('click', function () { + // location.reload(); + //}); + //查询 + $('#lr_search').on('click', function () { + var p = {}; + p.schoolId = $('#F_SchoolId').lrselectGet(); + p.ClassNo = $('#ClassNo').lrselectGet(); + p.EmpNo = $('#EmpNo').lrselectGet(); + page.search(p); + }); + + //打印课程表 + $('#perBtn').on('click', + function () { + AddPrintContent(); + }); + var LODOP, P_ID = "", TaskID1, TaskID2, t, waiting = false, c = 0, loop = 0; //声明为全局变量 + + function AddPrintContent() { + var myHtml = myHtml = $('.personalBox').html(); + var strBodyStyle = ""; + var strFormHtml = strBodyStyle + "" + myHtml + ""; + + LODOP = getLodop(); + LODOP.PRINT_INIT("个人授课表"); + LODOP.SET_PRINT_PAGESIZE(2, 0, 0, "A4"); + + LODOP.SET_PRINT_MODE("PRINT_DUPLEX", 2); + LODOP.SET_PRINT_MODE("PRINT_DEFAULTSOURCE", 7); + + LODOP.ADD_PRINT_HTM(10, 10, '284mm', '185mm', strFormHtml); + //打印预览 + LODOP.SET_SHOW_MODE("LANDSCAPE_DEFROTATED", 1); //横向时的正向显示 + var TaskID1 = LODOP.PREVIEW(); + // 直接打印 + // var TaskID1=LODOP.PRINT(); + + } + }, + search: function (param) { + param = param || {}; + //当前第几周 + param.curWeek = curWeek; + //班级 + param.EmpNo = EmpNo;//'202010';// + page.loadData(param); + + $('#WeekTimeSelect').lrselectRefresh({ + data: weekList + }); + $('#LessonInfo').lrselectSet(''); + $('#EmpInfo').lrselectSet(''); + $('#ClassroomInfo').lrselectSet(''); + $('#WeekTimeSelect').lrselectSet(''); + $('#WeekSelect').lrselectSet(''); + $('#NodeSelect').lrselectSet(''); + } + }; + refreshGirdData = function () { + page.search(); + }; + page.init(); +}; diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj index f33d9fcee..c635205cf 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj @@ -994,6 +994,7 @@ + @@ -1116,6 +1117,7 @@ +