diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/TimeTableController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/TimeTableController.cs index 55fc52ecc..597827508 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/TimeTableController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/TimeTableController.cs @@ -139,6 +139,67 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers { return View(); } + + public class WeekDate + { + public int week { get; set; } + public string startdate { get; set; } + public string enddate { get; set; } + public string textweek { get; set; } + } + + [HttpGet] + [AjaxOnly] + public ActionResult GetWeeksData() + { + var weekdatelist = new List(); + var yearsemester = Common.GetSemesterAndYear(); + var arrangelessonlist = arrangeLessonTermIBLL.GetListForTimeTable("{\"AcademicYearNo\":\"" + yearsemester.AcademicYearShort + "\",\"Semester\":\"" + yearsemester.Semester + "\"}").OrderBy(m => m.LessonDate); + if (arrangelessonlist.Any()) + { + var firstday = arrangelessonlist.First(); + var lastday = arrangelessonlist.Last(); + var monday = firstday.LessonDate.Value.AddDays(-Convert.ToInt32(firstday.LessonDate.Value.DayOfWeek) + 1); + var sunday = lastday.LessonDate.Value.AddDays(7 - Convert.ToInt32(lastday.LessonDate.Value.DayOfWeek)); + //总周数 + var weekCount = Math.Ceiling(Convert.ToDouble((sunday - monday).Days+1) / 7); + for (var i = 0; i < weekCount; i++) + { + var wentity = new WeekDate(); + wentity.week = i + 1; + wentity.startdate = monday.AddDays(i * 7).ToString("yyyy-MM-dd"); + wentity.enddate = monday.AddDays(i * 7+6).ToString("yyyy-MM-dd"); + wentity.textweek = "第" + wentity.week + "周 (" + wentity.startdate + "~" + wentity.enddate + ")"; + weekdatelist.Add(wentity); + } + return Success(weekdatelist); + } + else + return Success(new { }); + } + + /// + /// 获取当前日期是第几周 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetCurrentWeek() + { + var yearsemester = Common.GetSemesterAndYear(); + var arrangelessonlist = arrangeLessonTermIBLL.GetListForTimeTable("{\"AcademicYearNo\":\"" + yearsemester.AcademicYearShort + "\",\"Semester\":\"" + yearsemester.Semester + "\"}").OrderBy(m => m.LessonDate); + if (arrangelessonlist.Any()) + { + var firstday = arrangelessonlist.First(); + var lastday = arrangelessonlist.Last(); + var monday = firstday.LessonDate.Value.AddDays(-(Convert.ToInt32(firstday.LessonDate.Value.DayOfWeek) == 0 ? 7 : Convert.ToInt32(firstday.LessonDate.Value.DayOfWeek)) + 1); + var sunday = lastday.LessonDate.Value.AddDays(7 - (Convert.ToInt32(lastday.LessonDate.Value.DayOfWeek) == 0 ? 7 : Convert.ToInt32(lastday.LessonDate.Value.DayOfWeek))); + var currentweek = Util.Time.GetWeekOfDay(monday, sunday); + return Success(currentweek); + } + return Success(1); + } + /// /// 获取表单数据 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/ClassIndexInEducation.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/ClassIndexInEducation.cshtml index 4a794077d..395274828 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/ClassIndexInEducation.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/ClassIndexInEducation.cshtml @@ -110,7 +110,7 @@
-
+
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/ClassIndexInEducation.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/ClassIndexInEducation.js index 472359edf..3f9c15b4f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/ClassIndexInEducation.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/ClassIndexInEducation.js @@ -105,48 +105,48 @@ var bootstrap = function ($, learun) { $('#lr_refresh').on('click', function () { location.reload(); }); - $('#datesearch').lrdate({ - dfdata: [ - { - name: '上周', - begin: function () { return learun.getTime(7); }, - end: function () { - return learun.getTime(1); - } - }, - { - name: '本周', - begin: function () { return learun.getTime(0); }, - end: function () { - return learun.getTime(-6); - } - }, - { - name: '下周', - begin: function () { return learun.getTime(-7); }, - end: function () { - return learun.getTime(-13); - } - }], - // 月 - mShow: false, - premShow: false, - // 季度 - jShow: false, - prejShow: false, - // 年 - ysShow: false, - yxShow: false, - preyShow: false, - yShow: false, - // 默认 - dfvalue: 'currentWeek', - selectfn: function (begin, end) { - startTime = begin; - endTime = end; - page.search(); - } - }); + //$('#datesearch').lrdate({ + // dfdata: [ + // { + // name: '上周', + // begin: function () { return learun.getTime(7); }, + // end: function () { + // return learun.getTime(1); + // } + // }, + // { + // name: '本周', + // begin: function () { return learun.getTime(0); }, + // end: function () { + // return learun.getTime(-6); + // } + // }, + // { + // name: '下周', + // begin: function () { return learun.getTime(-7); }, + // end: function () { + // return learun.getTime(-13); + // } + // }], + // // 月 + // mShow: false, + // premShow: false, + // // 季度 + // jShow: false, + // prejShow: false, + // // 年 + // ysShow: false, + // yxShow: false, + // preyShow: false, + // yShow: false, + // // 默认 + // dfvalue: 'currentWeek', + // selectfn: function (begin, end) { + // startTime = begin; + // endTime = end; + // page.search(); + // } + //}); //查询 $('#lr_search').on('click', function () { var p = {}; @@ -190,6 +190,26 @@ var bootstrap = function ($, learun) { value: 'value', text: 'text' }); + $("#datesearch").lrselect({ + placeholder: "请选择周次", + width: "250px", + allowSearch: true, + url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetWeeksData', + value: 'week', + text: 'textweek', + select: function (item) { + if (!!item) { + startTime = item.startdate; + endTime = item.enddate; + } + } + }); + $.get('/PersonnelManagement/TimeTable/GetCurrentWeek', function (ref) { + if (ref.code == "200") { + console.log(ref.data); + $('#datesearch').lrselectSet(ref.data); + } + }.bind(this), "json"); }, search: function (param) { param = param || {}; diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/Index.cshtml index 65c711228..3b3d7f665 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/Index.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/Index.cshtml @@ -111,7 +111,7 @@
-
+
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/Index.js index 56a1d195d..5388ed57f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/Index.js @@ -143,48 +143,69 @@ var bootstrap = function ($, learun) { }); }, bind: function () { - $('#datesearch').lrdate({ - dfdata: [ - { - name: '上周', - begin: function () { return learun.getTime(7); }, - end: function () { - return learun.getTime(1); - } - }, - { - name: '本周', - begin: function () { return learun.getTime(0); }, - end: function () { - return learun.getTime(-6); - } - }, - { - name: '下周', - begin: function () { return learun.getTime(-7); }, - end: function () { - return learun.getTime(-13); - } - }], - // 月 - mShow: false, - premShow: false, - // 季度 - jShow: false, - prejShow: false, - // 年 - ysShow: false, - yxShow: false, - preyShow: false, - yShow: false, - // 默认 - dfvalue: 'currentWeek', - selectfn: function (begin, end) { - startTime = begin; - endTime = end; - page.search(); + $("#datesearch").lrselect({ + placeholder: "请选择周次", + width: "250px", + allowSearch: true, + url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetWeeksData', + value: 'week', + text: 'textweek', + select: function (item) { + if (!!item) { + startTime = item.startdate; + endTime = item.enddate; + page.search(); + } } }); + $.get('/PersonnelManagement/TimeTable/GetCurrentWeek', function (ref) { + if (ref.code == "200") { + console.log(ref.data); + $('#datesearch').lrselectSet(ref.data); + } + }.bind(this), "json"); + //$('#datesearch').lrdate({ + // dfdata: [ + // { + // name: '上周', + // begin: function () { return learun.getTime(7); }, + // end: function () { + // return learun.getTime(1); + // } + // }, + // { + // name: '本周', + // begin: function () { return learun.getTime(0); }, + // end: function () { + // return learun.getTime(-6); + // } + // }, + // { + // name: '下周', + // begin: function () { return learun.getTime(-7); }, + // end: function () { + // return learun.getTime(-13); + // } + // }], + // // 月 + // mShow: false, + // premShow: false, + // // 季度 + // jShow: false, + // prejShow: false, + // // 年 + // ysShow: false, + // yxShow: false, + // preyShow: false, + // yShow: false, + // // 默认 + // dfvalue: 'currentWeek', + // selectfn: function (begin, end) { + // startTime = begin; + // endTime = end; + // page.search(); + // } + //}); $('#perBtn').on('click', function () { AddPrintContent(); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducation.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducation.cshtml index 9ad72d93a..947a1ae2d 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducation.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducation.cshtml @@ -110,9 +110,8 @@
-
+
-
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducation.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducation.js index 4c8301684..e9fb9c6ec 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducation.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducation.js @@ -30,7 +30,7 @@ var bootstrap = function ($, learun) { $('.personT').text(data.schoolName); $('.perSemester').text(data.semester); $('.perFestivalsBox table').html(html); - + function flogs(num, data, obj) { var flog = false; $.each(data, @@ -105,48 +105,49 @@ var bootstrap = function ($, learun) { $('#lr_refresh').on('click', function () { location.reload(); }); - $('#datesearch').lrdate({ - dfdata: [ - { - name: '上周', - begin: function () { return learun.getTime(7); }, - end: function () { - return learun.getTime(1); - } - }, - { - name: '本周', - begin: function () { return learun.getTime(0); }, - end: function () { - return learun.getTime(-6); - } - }, - { - name: '下周', - begin: function () { return learun.getTime(-7); }, - end: function () { - return learun.getTime(-13); - } - }], - // 月 - mShow: false, - premShow: false, - // 季度 - jShow: false, - prejShow: false, - // 年 - ysShow: false, - yxShow: false, - preyShow: false, - yShow: false, - // 默认 - dfvalue: 'currentWeek', - selectfn: function (begin, end) { - startTime = begin; - endTime = end; - //page.search(); - } - }); + //$('#datesearch').lrdate({ + // dfdata: [ + // { + // name: '上周', + // begin: function () { return learun.getTime(7); }, + // end: function () { + // return learun.getTime(1); + // } + // }, + // { + // name: '本周', + // begin: function () { return learun.getTime(0); }, + // end: function () { + // return learun.getTime(-6); + // } + // }, + // { + // name: '下周', + // begin: function () { return learun.getTime(-7); }, + // end: function () { + // return learun.getTime(-13); + // } + // }], + // // 月 + // mShow: false, + // premShow: false, + // // 季度 + // jShow: false, + // prejShow: false, + // // 年 + // ysShow: false, + // yxShow: false, + // preyShow: false, + // yShow: false, + // // 默认 + // dfvalue: 'currentWeek', + // selectfn: function (begin, end) { + // startTime = begin; + // endTime = end; + // //page.search(); + // } + //}); + //查询 $('#lr_search').on('click', function () { var p = {}; @@ -295,6 +296,26 @@ var bootstrap = function ($, learun) { value: 'value', text: 'text' }); + $("#datesearch").lrselect({ + placeholder: "请选择周次", + width:"250px", + allowSearch: true, + url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetWeeksData', + value: 'week', + text: 'textweek', + select: function (item) { + if (!!item) { + startTime = item.startdate; + endTime = item.enddate; + } + } + }); + $.get('/PersonnelManagement/TimeTable/GetCurrentWeek', function (ref) { + if (ref.code == "200") { + console.log(ref.data); + $('#datesearch').lrselectSet(ref.data); + } + }.bind(this), "json"); }, search: function (param) { param = param || {}; diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducationModify.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducationModify.cshtml index 8237fd685..fa6441fb9 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducationModify.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducationModify.cshtml @@ -126,7 +126,7 @@
-
+
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducationModify.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducationModify.js index 00e7d75ab..39cb6c0e9 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducationModify.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducationModify.js @@ -105,48 +105,48 @@ var bootstrap = function ($, learun) { $('#lr_refresh').on('click', function () { location.reload(); }); - $('#datesearch').lrdate({ - dfdata: [ - { - name: '上周', - begin: function () { return learun.getTime(7); }, - end: function () { - return learun.getTime(1); - } - }, - { - name: '本周', - begin: function () { return learun.getTime(0); }, - end: function () { - return learun.getTime(-6); - } - }, - { - name: '下周', - begin: function () { return learun.getTime(-7); }, - end: function () { - return learun.getTime(-13); - } - }], - // 月 - mShow: false, - premShow: false, - // 季度 - jShow: false, - prejShow: false, - // 年 - ysShow: false, - yxShow: false, - preyShow: false, - yShow: false, - // 默认 - dfvalue: 'currentWeek', - selectfn: function (begin, end) { - startTime = begin; - endTime = end; - page.search(); - } - }); + //$('#datesearch').lrdate({ + // dfdata: [ + // { + // name: '上周', + // begin: function () { return learun.getTime(7); }, + // end: function () { + // return learun.getTime(1); + // } + // }, + // { + // name: '本周', + // begin: function () { return learun.getTime(0); }, + // end: function () { + // return learun.getTime(-6); + // } + // }, + // { + // name: '下周', + // begin: function () { return learun.getTime(-7); }, + // end: function () { + // return learun.getTime(-13); + // } + // }], + // // 月 + // mShow: false, + // premShow: false, + // // 季度 + // jShow: false, + // prejShow: false, + // // 年 + // ysShow: false, + // yxShow: false, + // preyShow: false, + // yShow: false, + // // 默认 + // dfvalue: 'currentWeek', + // selectfn: function (begin, end) { + // startTime = begin; + // endTime = end; + // page.search(); + // } + //}); //查询 $('#lr_search').on('click', function () { var p = {}; @@ -200,6 +200,26 @@ var bootstrap = function ($, learun) { value: 'value', text: 'text' }); + $("#datesearch").lrselect({ + placeholder: "请选择周次", + width: "250px", + allowSearch: true, + url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetWeeksData', + value: 'week', + text: 'textweek', + select: function (item) { + if (!!item) { + startTime = item.startdate; + endTime = item.enddate; + } + } + }); + $.get('/PersonnelManagement/TimeTable/GetCurrentWeek', function (ref) { + if (ref.code == "200") { + console.log(ref.data); + $('#datesearch').lrselectSet(ref.data); + } + }.bind(this), "json"); }, search: function (param) { param = param || {}; diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducationSelect.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducationSelect.cshtml index b8b2375d7..5a24f02da 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducationSelect.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducationSelect.cshtml @@ -126,7 +126,7 @@
-
+
@*
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducationSelect.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducationSelect.js index 722d279d3..c0a3f57e2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducationSelect.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducationSelect.js @@ -107,48 +107,48 @@ var bootstrap = function ($, learun) { $('#lr_refresh').on('click', function () { location.reload(); }); - $('#datesearch').lrdate({ - dfdata: [ - { - name: '上周', - begin: function () { return learun.getTime(7); }, - end: function () { - return learun.getTime(1); - } - }, - { - name: '本周', - begin: function () { return learun.getTime(0); }, - end: function () { - return learun.getTime(-6); - } - }, - { - name: '下周', - begin: function () { return learun.getTime(-7); }, - end: function () { - return learun.getTime(-13); - } - }], - // 月 - mShow: false, - premShow: false, - // 季度 - jShow: false, - prejShow: false, - // 年 - ysShow: false, - yxShow: false, - preyShow: false, - yShow: false, - // 默认 - dfvalue: 'currentWeek', - selectfn: function (begin, end) { - startTime = begin; - endTime = end; - page.search(); - } - }); + //$('#datesearch').lrdate({ + // dfdata: [ + // { + // name: '上周', + // begin: function () { return learun.getTime(7); }, + // end: function () { + // return learun.getTime(1); + // } + // }, + // { + // name: '本周', + // begin: function () { return learun.getTime(0); }, + // end: function () { + // return learun.getTime(-6); + // } + // }, + // { + // name: '下周', + // begin: function () { return learun.getTime(-7); }, + // end: function () { + // return learun.getTime(-13); + // } + // }], + // // 月 + // mShow: false, + // premShow: false, + // // 季度 + // jShow: false, + // prejShow: false, + // // 年 + // ysShow: false, + // yxShow: false, + // preyShow: false, + // yShow: false, + // // 默认 + // dfvalue: 'currentWeek', + // selectfn: function (begin, end) { + // startTime = begin; + // endTime = end; + // page.search(); + // } + //}); //查询 $('#lr_search').on('click', function () { var p = {}; @@ -225,6 +225,26 @@ var bootstrap = function ($, learun) { value: 'value', text: 'text' }); + $("#datesearch").lrselect({ + placeholder: "请选择周次", + width: "250px", + allowSearch: true, + url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetWeeksData', + value: 'week', + text: 'textweek', + select: function (item) { + if (!!item) { + startTime = item.startdate; + endTime = item.enddate; + } + } + }); + $.get('/PersonnelManagement/TimeTable/GetCurrentWeek', function (ref) { + if (ref.code == "200") { + console.log(ref.data); + $('#datesearch').lrselectSet(ref.data); + } + }.bind(this), "json"); }, search: function (param) { param = param || {}; diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/SchoolLesson.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/SchoolLesson.cshtml index 1097c7a23..cd55c858a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/SchoolLesson.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/SchoolLesson.cshtml @@ -53,7 +53,7 @@
-
+
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/SchoolLesson.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/SchoolLesson.js index 570c79305..b911b76a3 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/SchoolLesson.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/SchoolLesson.js @@ -107,48 +107,48 @@ var bootstrap = function ($, learun) { $('#lr_refresh').on('click', function () { location.reload(); }); - $('#datesearch').lrdate({ - dfdata: [ - { - name: '上周', - begin: function () { return learun.getTime(7); }, - end: function () { - return learun.getTime(1); - } - }, - { - name: '本周', - begin: function () { return learun.getTime(0); }, - end: function () { - return learun.getTime(-6); - } - }, - { - name: '下周', - begin: function () { return learun.getTime(-7); }, - end: function () { - return learun.getTime(-13); - } - }], - // 月 - mShow: false, - premShow: false, - // 季度 - jShow: false, - prejShow: false, - // 年 - ysShow: false, - yxShow: false, - preyShow: false, - yShow: false, - // 默认 - dfvalue: 'currentWeek', - selectfn: function (begin, end) { - startTime = begin; - endTime = end; - page.search(); - } - }); + //$('#datesearch').lrdate({ + // dfdata: [ + // { + // name: '上周', + // begin: function () { return learun.getTime(7); }, + // end: function () { + // return learun.getTime(1); + // } + // }, + // { + // name: '本周', + // begin: function () { return learun.getTime(0); }, + // end: function () { + // return learun.getTime(-6); + // } + // }, + // { + // name: '下周', + // begin: function () { return learun.getTime(-7); }, + // end: function () { + // return learun.getTime(-13); + // } + // }], + // // 月 + // mShow: false, + // premShow: false, + // // 季度 + // jShow: false, + // prejShow: false, + // // 年 + // ysShow: false, + // yxShow: false, + // preyShow: false, + // yShow: false, + // // 默认 + // dfvalue: 'currentWeek', + // selectfn: function (begin, end) { + // startTime = begin; + // endTime = end; + // page.search(); + // } + //}); //查询 $('#lr_search').on('click', function () { var p = {}; @@ -264,6 +264,26 @@ var bootstrap = function ($, learun) { value: 'value', text: 'text' }); + $("#datesearch").lrselect({ + placeholder: "请选择周次", + width: "250px", + allowSearch: true, + url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetWeeksData', + value: 'week', + text: 'textweek', + select: function (item) { + if (!!item) { + startTime = item.startdate; + endTime = item.enddate; + } + } + }); + $.get('/PersonnelManagement/TimeTable/GetCurrentWeek', function (ref) { + if (ref.code == "200") { + console.log(ref.data); + $('#datesearch').lrselectSet(ref.data); + } + }.bind(this), "json"); }, search: function (param) { param = param || {}; diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermBLL.cs index 7b105a54f..0bd240547 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermBLL.cs @@ -43,7 +43,24 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } } - + public IEnumerable GetListForTimeTable(string queryJson) + { + try + { + return arrangeLessonTermService.GetListForTimeTable(queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } /// /// 获取列表分页数据 /// 分页参数 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermIBLL.cs index 83ae4c390..caa1deec0 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermIBLL.cs @@ -48,6 +48,8 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// /// IEnumerable GetList(string queryJson); + + IEnumerable GetListForTimeTable(string queryJson); Task AsyncArrangeLessonData(); Task AsyncModifyArrangeLessonData(); diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs index ec7ee51f3..0dbfe10a1 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs @@ -139,6 +139,75 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + public IEnumerable GetListForTimeTable(string queryJson) + { + try + { + //参考写法 + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + + var strSql = new StringBuilder(); + strSql.Append("SELECT LessonDate,AcademicYearNo,Semester"); + strSql.Append(" FROM ArrangeLessonTerm t where 1=1 "); + + if (!queryParam["AcademicYearNo"].IsEmpty()) + { + dp.Add("AcademicYearNo", queryParam["AcademicYearNo"].ToString(), DbType.String); + strSql.Append(" AND t.AcademicYearNo = @AcademicYearNo "); + } + if (!queryParam["Semester"].IsEmpty()) + { + dp.Add("Semester", queryParam["Semester"].ToString(), DbType.String); + strSql.Append(" AND t.Semester = @Semester "); + } + if (!queryParam["DeptNo"].IsEmpty()) + { + dp.Add("DeptNo", queryParam["DeptNo"].ToString(), DbType.String); + strSql.Append(" AND t.DeptNo = @DeptNo "); + } + if (!queryParam["MajorNo"].IsEmpty()) + { + dp.Add("MajorNo", queryParam["MajorNo"].ToString(), DbType.String); + strSql.Append(" AND t.MajorNo = @MajorNo "); + } + if (!queryParam["LessonNo"].IsEmpty()) + { + dp.Add("LessonNo", queryParam["LessonNo"].ToString(), DbType.String); + strSql.Append(" AND t.LessonNo = @LessonNo "); + } + if (!queryParam["TeachClassNo"].IsEmpty()) + { + dp.Add("TeachClassNo", "%" + queryParam["TeachClassNo"].ToString(), DbType.String); + strSql.Append(" AND t.TeachClassNo like @TeachClassNo "); + } + if (!queryParam["EmpNo"].IsEmpty()) + { + dp.Add("EmpNo", queryParam["EmpNo"].ToString(), DbType.String); + strSql.Append(" AND t.EmpNo = @EmpNo "); + } + if (!queryParam["ClassroomNo"].IsEmpty()) + { + dp.Add("ClassroomNo", queryParam["ClassroomNo"].ToString(), DbType.String); + strSql.Append(" AND t.ClassroomNo = @ClassroomNo "); + } + + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + internal IEnumerable GetListByEmpNo(List empNos) { try @@ -1694,16 +1763,18 @@ group by AcademicYearNo,Semester,DeptNo,MajorNo,LessonNo,TeachClassNo,EmpNo,Les try { //前五年-后五年 - var preYear = DateTime.Now.AddYears(-5).Year; - var nextYear = DateTime.Now.AddYears(5).Year; + var preYear = DateTime.Now.AddYears(-1).Year; + var nextYear = DateTime.Now.AddYears(1).Year; var yearList = new List(); for (int i = preYear; i <= nextYear; i++) { - yearList.Add(string.Format("{0}-{1}", i.ToString().Substring(2), (i + 1).ToString().Substring(2))); + yearList.Add(string.Format("'{0}-{1}'", i.ToString().Substring(2), (i + 1).ToString().Substring(2))); } var aa = new List(); //必修课 - var teacherData = this.BaseRepository("CollegeMIS").FindList(x => yearList.Contains(x.AcademicYearNo)); + //var teacherData = this.BaseRepository("CollegeMIS").FindList(x => yearList.Contains(x.AcademicYearNo)); + var teacherData = this.BaseRepository("CollegeMIS").FindList("select EmpNo,EmpName,F_SchoolId from ArrangeLessonTerm where AcademicYearNo in(" + string.Join(",", yearList) + ") "); + if (!string.IsNullOrEmpty(schoolId)) { teacherData = teacherData.Where(x => x.F_SchoolId == schoolId); diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamStudent/Exam_ExamStudentEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamStudent/Exam_ExamStudentEntity.cs index c0239280f..97dfa62e7 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamStudent/Exam_ExamStudentEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamStudent/Exam_ExamStudentEntity.cs @@ -24,6 +24,9 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// [Column("CLASSNO")] public string ClassNo { get; set; } + + [Column("DEPTNO")] + public string DeptNo { get; set; } /// /// 学年 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamStudent/Exam_ExamStudentService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamStudent/Exam_ExamStudentService.cs index 37c225767..054a36b78 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamStudent/Exam_ExamStudentService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_ExamStudent/Exam_ExamStudentService.cs @@ -370,8 +370,8 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration if (ESType == "1") { strSql.Append( - $@"insert into Exam_ExamStudent(ESId,ClassNo,AcademicYearNo,Semester,StuNo,StuName,ESType,ESEnabled,Grade) - select newid(), a.classno, '{AcademicYearNo}', '{Semester}', a.stuno, a.stuname, '{ESType}', 1,a.Grade + $@"insert into Exam_ExamStudent(ESId,ClassNo,DeptNo,AcademicYearNo,Semester,StuNo,StuName,ESType,ESEnabled,Grade) + select newid(), a.classno,DeptNo, '{AcademicYearNo}', '{Semester}', a.stuno, a.stuname, '{ESType}', 1,a.Grade from StuInfoBasic a where CheckMark = '1' and (ChangeStatus is null or len(ChangeStatus)=0 or ChangeStatus='0') and stuno not in (select stuno from Exam_ExamStudent where AcademicYearNo = '{AcademicYearNo}' and Semester = '{Semester}' and ESType = '1' diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_InvigilateTeacher/Exam_InvigilateTeacherEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_InvigilateTeacher/Exam_InvigilateTeacherEntity.cs index 5ca90ec91..2db0315e2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_InvigilateTeacher/Exam_InvigilateTeacherEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_InvigilateTeacher/Exam_InvigilateTeacherEntity.cs @@ -39,6 +39,9 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// [Column("EMPNO")] public string EmpNo { get; set; } + + [Column("DEPTNO")] + public string DeptNo { get; set; } /// /// 排序号 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_InvigilateTeacher/Exam_InvigilateTeacherService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_InvigilateTeacher/Exam_InvigilateTeacherService.cs index 28a2fa132..e953c0666 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_InvigilateTeacher/Exam_InvigilateTeacherService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/Exam_InvigilateTeacher/Exam_InvigilateTeacherService.cs @@ -364,9 +364,10 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration ,[Semester] ,[EmpName] ,[EmpNo] + ,[DeptNo] ,[ITOrder] ,[ITEnabled]) -select newid(),'{AcademicYearNo}','{Semester}',empname,empno,0,1 from empinfo where checkmark=1 and IsHasLesson=1 and IsInActiveStatus=1 +select newid(),'{AcademicYearNo}','{Semester}',empname,empno,DeptNo,0,1 from empinfo where checkmark=1 and IsHasLesson=1 and IsInActiveStatus=1 and empno not in (select empno from Exam_InvigilateTeacher where AcademicYearNo='{AcademicYearNo}' and Semester='{Semester}') "; return this.BaseRepository("CollegeMIS").ExecuteBySql(sql); diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Time/Time.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Time/Time.cs index f0eaa54f6..12e7f01aa 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Time/Time.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Time/Time.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Globalization; namespace Learun.Util @@ -368,9 +369,10 @@ namespace Learun.Util //当年的第一天是星期几 int firstOfWeek = Convert.ToInt32(firstDay.DayOfWeek); - + if (firstOfWeek == 0) + firstOfWeek = 7; //计算当年第一周的起止日期,可能跨年 - int dayDiff = (-1) * firstOfWeek + 1; + int dayDiff = (-1) * firstOfWeek-1; int dayAdd = 7 - firstOfWeek; firstDate = firstDay.AddDays(dayDiff).Date; @@ -503,6 +505,64 @@ namespace Learun.Util return strDate; } #endregion + + + /// + /// 获取当前日期在指定时间范围内是第几周 + /// + /// + /// + /// + public static int GetWeekOfDay(DateTime start, DateTime end) + { + //总周数 + var weekCount = Math.Ceiling(Convert.ToDouble((end - start).Days / 7)); + //用于存储日期 + var weekDic = new Dictionary(); + + var today = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")); + + for (var i = 0; i < weekCount; i++) + { + for (var j = 0; j < 7; j++) + { + weekDic.Add(start.AddDays(i * 7 + j), i + 1); + } + } + + return weekDic.ContainsKey(today) ? weekDic[today] : 1; + } + + /// + /// 根据开始日期和结束日期返回这段时间的周数 + /// 过周日算一周 + /// + /// 开始日期 + /// 结束日期 + /// + public static int GetWeekCount(DateTime startTime, DateTime endTime) + { + //获取开始时间的星期一 + int startWeek = Convert.ToInt32(startTime.DayOfWeek); + //因为是以星期一为第一天,所以要判断weeknow等于0时,要向前推6天。 + startWeek = (startWeek == 0 ? (7 - 1) : (startWeek - 1)); + int daydiff = (-1) * startWeek; + string firstDay = startTime.AddDays(daydiff).ToString("yyyy-MM-dd"); + DateTime startMonday = Convert.ToDateTime(firstDay); + //获取结束时间的星期日 + int lastWeek = Convert.ToInt32(endTime.DayOfWeek); + int daydiff1 = 0; + if (lastWeek != 0) + { + daydiff1 = 7 - lastWeek; + } + //本周最后一天 + string lastDay = endTime.AddDays(daydiff1).ToString("yyyy-MM-dd"); + DateTime lastSunday = Convert.ToDateTime(lastDay); + TimeSpan timeSpan = (lastSunday - startMonday); + //返回总周数 + return Convert.ToInt32(timeSpan.Days + 1) / 7; + } /// /// 获取当前日期是星期几 /// diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js index 5cad72901..11fb89502 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js @@ -16,7 +16,7 @@ export default { // "http://localhost:8088/" // ], "apiHost": [ - "http://10.30.0.10:9002/" + "http://localhost:31173/" // "/api/", ], "webHost":"http://10.30.0.10:8000/",