@@ -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<WeekDate>(); | |||
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 { }); | |||
} | |||
/// <summary> | |||
/// 获取当前日期是第几周 | |||
/// </summary> | |||
/// <returns></returns> | |||
[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); | |||
} | |||
/// <summary> | |||
/// 获取表单数据 | |||
/// <summary> | |||
@@ -110,7 +110,7 @@ | |||
<div class="lr-layout-tool"> | |||
<div class="lr-layout-tool-left"> | |||
<div class="lr-layout-tool-item"> | |||
<div id="datesearch" class="lr-search-date"></div> | |||
<div id="datesearch" type="lrselect" class="lr-select" style="width: 250px;"></div> | |||
</div> | |||
<div class="lr-layout-tool-item"> | |||
@@ -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 || {}; | |||
@@ -111,7 +111,7 @@ | |||
<div class="lr-layout-tool"> | |||
<div class="lr-layout-tool-left"> | |||
<div class="lr-layout-tool-item"> | |||
<div id="datesearch" class="lr-search-date"></div> | |||
<div id="datesearch" type="lrselect" class="lr-select" style="width: 250px;"></div> | |||
</div> | |||
</div> | |||
<div class="lr-layout-tool-right"> | |||
@@ -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(); | |||
@@ -110,9 +110,8 @@ | |||
<div class="lr-layout-tool"> | |||
<div class="lr-layout-tool-left"> | |||
<div class="lr-layout-tool-item"> | |||
<div id="datesearch" class="lr-search-date"></div> | |||
<div id="datesearch" type="lrselect" class="lr-select" style="width: 250px;"></div> | |||
</div> | |||
<div class="lr-layout-tool-item"> | |||
<div id="F_SchoolId" type="lrselect" class="lr-select"></div> | |||
</div> | |||
@@ -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 || {}; | |||
@@ -126,7 +126,7 @@ | |||
<div class="lr-layout-tool"> | |||
<div class="lr-layout-tool-left"> | |||
<div class="lr-layout-tool-item"> | |||
<div id="datesearch" class="lr-search-date"></div> | |||
<div id="datesearch" type="lrselect" class="lr-select" style="width: 250px;"></div> | |||
</div> | |||
<div class="lr-layout-tool-item"> | |||
@@ -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 || {}; | |||
@@ -126,7 +126,7 @@ | |||
<div class="lr-layout-tool"> | |||
<div class="lr-layout-tool-left"> | |||
<div class="lr-layout-tool-item"> | |||
<div id="datesearch" class="lr-search-date"></div> | |||
<div id="datesearch" type="lrselect" class="lr-select" style="width: 250px;"></div> | |||
</div> | |||
@*<div class="lr-layout-tool-item"> | |||
@@ -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 || {}; | |||
@@ -53,7 +53,7 @@ | |||
<div class="lr-layout-tool"> | |||
<div class="lr-layout-tool-left"> | |||
<div class="lr-layout-tool-item"> | |||
<div id="datesearch" class="lr-search-date"></div> | |||
<div id="datesearch" type="lrselect" class="lr-select" style="width: 250px;"></div> | |||
</div> | |||
<div class="lr-layout-tool-item"> | |||
<div id="F_SchoolId" type="lrselect" class="lr-select"></div> | |||
@@ -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 || {}; | |||
@@ -43,7 +43,24 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
} | |||
public IEnumerable<ArrangeLessonTermEntity> GetListForTimeTable(string queryJson) | |||
{ | |||
try | |||
{ | |||
return arrangeLessonTermService.GetListForTimeTable(queryJson); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取列表分页数据 | |||
/// <param name="pagination">分页参数</param> | |||
@@ -48,6 +48,8 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// <summary> | |||
/// <returns></returns> | |||
IEnumerable<ArrangeLessonTermEntity> GetList(string queryJson); | |||
IEnumerable<ArrangeLessonTermEntity> GetListForTimeTable(string queryJson); | |||
Task<bool> AsyncArrangeLessonData(); | |||
Task<bool> AsyncModifyArrangeLessonData(); | |||
@@ -139,6 +139,75 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
} | |||
} | |||
public IEnumerable<ArrangeLessonTermEntity> 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<ArrangeLessonTermEntity>(strSql.ToString(), dp); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
internal IEnumerable<ArrangeLessonTermEntity> GetListByEmpNo(List<string> 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<string>(); | |||
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<SelectModel>(); | |||
//必修课 | |||
var teacherData = this.BaseRepository("CollegeMIS").FindList<ArrangeLessonTermEntity>(x => yearList.Contains(x.AcademicYearNo)); | |||
//var teacherData = this.BaseRepository("CollegeMIS").FindList<ArrangeLessonTermEntity>(x => yearList.Contains(x.AcademicYearNo)); | |||
var teacherData = this.BaseRepository("CollegeMIS").FindList<ArrangeLessonTermEntity>("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); | |||
@@ -24,6 +24,9 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// </summary> | |||
[Column("CLASSNO")] | |||
public string ClassNo { get; set; } | |||
[Column("DEPTNO")] | |||
public string DeptNo { get; set; } | |||
/// <summary> | |||
/// 学年 | |||
/// </summary> | |||
@@ -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' | |||
@@ -39,6 +39,9 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// </summary> | |||
[Column("EMPNO")] | |||
public string EmpNo { get; set; } | |||
[Column("DEPTNO")] | |||
public string DeptNo { get; set; } | |||
/// <summary> | |||
/// 排序号 | |||
/// </summary> | |||
@@ -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); | |||
@@ -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 | |||
/// <summary> | |||
/// 获取当前日期在指定时间范围内是第几周 | |||
/// </summary> | |||
/// <param name="start"></param> | |||
/// <param name="end"></param> | |||
/// <returns></returns> | |||
public static int GetWeekOfDay(DateTime start, DateTime end) | |||
{ | |||
//总周数 | |||
var weekCount = Math.Ceiling(Convert.ToDouble((end - start).Days / 7)); | |||
//用于存储日期 | |||
var weekDic = new Dictionary<DateTime, int>(); | |||
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; | |||
} | |||
/// <summary> | |||
/// 根据开始日期和结束日期返回这段时间的周数 | |||
/// 过周日算一周 | |||
/// </summary> | |||
/// <param name="startTime">开始日期</param> | |||
/// <param name="endTime">结束日期</param> | |||
/// <returns></returns> | |||
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; | |||
} | |||
/// <summary> | |||
/// 获取当前日期是星期几 | |||
/// </summary> | |||
@@ -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/", | |||