@@ -121,7 +121,24 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||
{ | |||
return View(); | |||
} | |||
/// <summary> | |||
/// 表单--修改教师所带的课程【教务】 | |||
/// <summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult SchoolLesson() | |||
{ | |||
return View(); | |||
} | |||
/// <summary> | |||
/// 表单--修改教师所带的课程【教务】 | |||
/// <summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult PrintSchedule() | |||
{ | |||
return View(); | |||
} | |||
/// <summary> | |||
/// 获取表单数据 | |||
/// <summary> | |||
@@ -337,7 +354,7 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||
//最大节次 | |||
int maxlessontime = timeTables.Max(m =>Convert.ToInt32(m.LessonTime.Substring(1))); | |||
//班级列表 | |||
var classinfolist = timeTables.Select(m => new {m.TeachClassNo, m.ClassName}).OrderBy(m => m.TeachClassNo).GroupBy(m=>new {m.TeachClassNo,m.ClassName}); | |||
var classinfolist = timeTables.Select(m => new { m.TeachClassNo, m.ClassName}).OrderBy(m => m.TeachClassNo).GroupBy(m=>new {m.TeachClassNo,m.ClassName}); | |||
var formatData = from d in timeTables | |||
let tt = d.LessonTime.Substring(1) | |||
group d by tt into g | |||
@@ -0,0 +1,204 @@ | |||
<!DOCTYPE html> | |||
<html> | |||
<head> | |||
<meta charset="utf-8"> | |||
<title>课程表打印</title> | |||
</head> | |||
<body> | |||
<style> | |||
#table td { | |||
text-align: center; | |||
width: 100px; | |||
} | |||
#pdfDom { | |||
/* width: 100%; */ | |||
/* overflow-x: auto; */ | |||
} | |||
#table { | |||
width: 100%; | |||
/* overflow-x: auto; */ | |||
border-spacing: 0; | |||
} | |||
#table tr { | |||
} | |||
#exportReport { | |||
background-color: #409eff; | |||
border-radius: 4px; | |||
width: 100px; | |||
height: 40px; | |||
color: white; | |||
text-align: center; | |||
line-height: 40px; | |||
margin: 50px auto 0; | |||
} | |||
#exportReport:hover { | |||
cursor: pointer; | |||
background-color: #66b1ff; | |||
} | |||
</style> | |||
<div id="pdfDom"> | |||
<table id="table" border="1"></table> | |||
</div> | |||
<div id="exportReport">导出</div> | |||
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script> | |||
<script src="~/Content/js/PrintLesson/debug.js"></script> | |||
<script src="~/Content/js/PrintLesson/html2canvas.js"></script> | |||
<script> | |||
var url = '/PersonnelManagement/TimeTable/GetDataInEducation?' | |||
var search = window.location.href.split('?')[1].split('&') | |||
for (var i = 0; i < search.length; i++) { | |||
var data = search[i].split('=') | |||
url += data[0] + '=' + data[1] + '&' | |||
} | |||
url = url.slice(0, url.length - 1) | |||
$.get(window.origin + url, function (result) { | |||
var data = JSON.parse(result).data | |||
var classList = data.classinfolist; | |||
var classListNow = []; | |||
for (var i = 0; i < classList.length; i++) { | |||
classListNow.push(classList[i][0]); | |||
} | |||
data.classinfolist = classListNow; | |||
var dom = '<tr><td></td>' | |||
var week = 7 | |||
var weekObj = { | |||
0: '一', | |||
1: '二', | |||
2: '三', | |||
3: '四', | |||
4: '五', | |||
5: '六', | |||
6: '日', | |||
} | |||
// 生成一周七天表头 | |||
for (var i = 0; i < week; i++) { | |||
dom += '<td colspan=' + data.maxlessontime + '>星期' + weekObj[i] + '</td>' | |||
} | |||
dom += '</tr><tr><td>班级|节次</td>' | |||
// 生成课程节次表头 | |||
for (var j = 0; j < week; j++) { | |||
var index = 0 | |||
for (var i = 0; i < data.maxlessontime; i++) { | |||
index++ | |||
dom += '<td>' + (index) + '</td>' | |||
} | |||
} | |||
dom += '</tr>' | |||
// 生成每个班级的课程 | |||
for (var i = 0; i < data.classinfolist.length; i++) { | |||
var classMsg = data.classinfolist[i] | |||
dom += '<tr classId=' + classMsg.TeachClassNo + '><td>' + classMsg.ClassName + '</td>' | |||
for (var j = 0; j < week; j++) { | |||
var index = 0 | |||
for (var k = 0; k < data.maxlessontime; k++) { | |||
index++ | |||
dom += '<td classId=' + classMsg.TeachClassNo + ' week=' + (j + 1) + ' time=' + index + '></td>' | |||
} | |||
} | |||
dom += '</td>' | |||
} | |||
table.innerHTML = dom | |||
var tableWidth = data.maxlessontime * 7 * 100 | |||
table.style.width = tableWidth + 'px' | |||
// 开始渲染数据 | |||
var domObj = {} | |||
var trsObj = {} | |||
var trs = document.getElementsByTagName('tr') | |||
for (var j = 0; j < trs.length; j++) { | |||
var id = trs[j].getAttribute('classId') | |||
if (id) { | |||
trsObj[id] = trs[j] | |||
} | |||
} | |||
//console.log(trsObj,'trsObj') | |||
for (var i = 0; i < data.weekList.length; i++) { | |||
var weekObj = data.weekList[i] | |||
for (var j = 0; j < weekObj.list.length; j++) { | |||
var weekList = weekObj.list[j] | |||
weekList['time'] = weekObj.time | |||
var tds = trsObj[weekList.teachClassNo].getElementsByTagName('td') | |||
for (var k = 0; k < tds.length; k++) { | |||
var time = tds[k].getAttribute('time') | |||
var classId = tds[k].getAttribute('classId') | |||
var week = tds[k].getAttribute('week') | |||
if (week == weekList.day && classId == weekList.teachClassNo && time == weekList.time) { | |||
tds[k].innerHTML = '<div>课程:' + weekList.curriculum + '</div><div>教师:' + weekList.teacher + '</div><div>教室:' + weekList.classRoom + '</div>' | |||
} | |||
} | |||
} | |||
} | |||
var downPdf = document.getElementById("exportReport"); //点击导出事件 | |||
//console.log(downPdf, 'downPdf') | |||
function htmlToPdf() { | |||
html2canvas(document.body, { | |||
onrendered: function (canvas) { | |||
var contentWidth = canvas.width; | |||
var contentHeight = canvas.height; | |||
// 竖版打印 | |||
// var a4Width = 592.28 | |||
// var a4Height = 841.89 | |||
// 横板打印 | |||
var a4Height = 592.28 | |||
var a4Width = 841.89 | |||
//一页pdf显示html页面生成的canvas高度; | |||
var pageHeight = contentWidth / a4Width * a4Height; | |||
//未生成pdf的html页面高度 | |||
var leftHeight = contentHeight; | |||
//pdf页面偏移 | |||
var position = 0; | |||
//a4纸的尺寸[595.28,841.89],html页面生成的canvas在pdf中图片的宽高 | |||
var imgWidth = a4Width; | |||
var imgHeight = a4Width / contentWidth * contentHeight; | |||
var pageData = canvas.toDataURL('image/jpeg', 1.0); | |||
var pdf = new jsPDF('l', 'pt', 'a4'); | |||
//console.log(imgWidth, imgHeight, '===') | |||
//有两个高度需要区分,一个是html页面的实际高度,和生成pdf的页面高度(841.89) | |||
//当内容未超过pdf一页显示的范围,无需分页 | |||
if (leftHeight < pageHeight) { | |||
pdf.addImage(pageData, 'JPEG', 0, 0, imgWidth, imgHeight); | |||
} else { | |||
while (leftHeight > 0) { | |||
pdf.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight) | |||
leftHeight -= pageHeight; | |||
position -= a4Height; | |||
//避免添加空白页 | |||
if (leftHeight > 0) { | |||
pdf.addPage(); | |||
} | |||
} | |||
} | |||
pdf.save('课程表.pdf'); | |||
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引 | |||
parent.layer.close(index); //再执行关闭 | |||
parent.layer.msg('导出成功', { | |||
icon: 1 | |||
}); | |||
} | |||
}) | |||
} | |||
downPdf.onclick = htmlToPdf | |||
}); | |||
</script> | |||
</body> | |||
</html> |
@@ -0,0 +1,88 @@ | |||
@{ | |||
ViewBag.Title = "课程表"; | |||
Layout = "~/Views/Shared/_Index.cshtml"; | |||
} | |||
<link href="~/Content/static/css/TimeTable.css" rel="stylesheet" /> | |||
<script src="~/Content/static/js/LodopFuncs.js"></script> | |||
<style> | |||
#table td { | |||
text-align: center !important; | |||
width: 150px !important; | |||
padding: 10px 0; | |||
} | |||
#pdfDom { | |||
/* width: 100%; */ | |||
/* overflow-x: auto; */ | |||
} | |||
#table { | |||
width: 100%; | |||
/* overflow-x: auto; */ | |||
border-spacing: 0; | |||
} | |||
#table tr { | |||
} | |||
#exportReport { | |||
background-color: #409eff; | |||
border-radius: 4px; | |||
width: 100px; | |||
height: 40px; | |||
color: white; | |||
text-align: center; | |||
line-height: 40px; | |||
margin: 50px auto 0; | |||
} | |||
#exportReport:hover { | |||
cursor: pointer; | |||
background-color: #66b1ff; | |||
} | |||
</style> | |||
<style> | |||
.lr-select { | |||
width: 150px; | |||
} | |||
</style> | |||
<div class="lr-layout "> | |||
<div class="lr-layout-center"> | |||
<div class="lr-layout-wrap lr-layout-wrap-notitle "> | |||
<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> | |||
<div class="lr-layout-tool-item"> | |||
<div id="F_SchoolId" type="lrselect" class="lr-select"></div> | |||
</div> | |||
<div class="lr-layout-tool-item"> | |||
<div id="ClassNo" type="lrselect" class="lr-select"></div> | |||
</div> | |||
<div class="lr-layout-tool-item"> | |||
<div id="EmpNo" type="lrselect" class="lr-select"></div> | |||
</div> | |||
<div class="lr-layout-tool-item"> | |||
<a id="lr_search" class="btn btn-primary">查询</a> | |||
</div> | |||
</div> | |||
<div class="lr-layout-tool-right"> | |||
<div class=" btn-group btn-group-sm"> | |||
<a id="lr_refresh" class="btn btn-default"><i class="fa fa-refresh"></i></a> | |||
<a id="lr_export" class="btn btn-default"><i class="fa fa-sign-out"> 导出</i></a> | |||
</div> | |||
</div> | |||
</div> | |||
<div class="lr-layout-body" style="overflow: auto;"> | |||
<div id="pdfDom"> | |||
<table id="table" border="1" style="background: #fff"></table> | |||
</div> | |||
@*<div id="exportReport">导出</div>*@ | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
@Html.AppendJsFile("/Areas/PersonnelManagement/Views/TimeTable/SchoolLesson.js") | |||
@@ -0,0 +1,276 @@ | |||
var refreshGirdData; | |||
var bootstrap = function ($, learun) { | |||
var startTime; | |||
var endTime; | |||
var Printdata; | |||
var page = { | |||
init: function () { | |||
page.bind(); | |||
page.bindSelect(); | |||
}, | |||
loadData: function (param) { | |||
$.lrSetFormWithParam(top.$.rootUrl + '/PersonnelManagement/TimeTable/GetDataInEducation', param, | |||
function (data) { | |||
Printdata = ''; | |||
for (var key in param) { | |||
Printdata += key + '=' + param[key]+'&' | |||
} | |||
//console.log(data, "data") | |||
var classList = data.classinfolist; | |||
var classListNow = []; | |||
if (classList == '' || classList == undefined) { | |||
learun.alert.warning('未查询到数据,请更换搜索条件'); | |||
return | |||
} | |||
for (var i = 0; i < classList.length; i++) { | |||
classListNow.push(classList[i][0]); | |||
} | |||
data.classinfolist = classListNow; | |||
var dom = '<tr><td></td>' | |||
var week = 7 | |||
var weekObj = { | |||
0: '一', | |||
1: '二', | |||
2: '三', | |||
3: '四', | |||
4: '五', | |||
5: '六', | |||
6: '日', | |||
} | |||
// 生成一周七天表头 | |||
for (var i = 0; i < week; i++) { | |||
dom += '<td colspan=' + data.maxlessontime + '>星期' + weekObj[i] + '</td>' | |||
} | |||
dom += '</tr><tr><td>班级|节次</td>' | |||
// 生成课程节次表头 | |||
for (var j = 0; j < week; j++) { | |||
var index = 0 | |||
for (var i = 0; i < data.maxlessontime; i++) { | |||
index++ | |||
dom += '<td>' + (index) + '</td>' | |||
} | |||
} | |||
dom += '</tr>' | |||
// 生成每个班级的课程 | |||
for (var i = 0; i < data.classinfolist.length; i++) { | |||
var classMsg = data.classinfolist[i] | |||
dom += '<tr classId=' + classMsg.TeachClassNo + '><td>' + classMsg.ClassName + '</td>' | |||
for (var j = 0; j < week; j++) { | |||
var index = 0 | |||
for (var k = 0; k < data.maxlessontime; k++) { | |||
index++ | |||
dom += '<td classId=' + classMsg.TeachClassNo + ' week=' + (j + 1) + ' time=' + index + '></td>' | |||
} | |||
} | |||
dom += '</td>' | |||
} | |||
table.innerHTML = dom | |||
var tableWidth = data.maxlessontime * 7 * 100 | |||
table.style.width = tableWidth + 'px' | |||
// 开始渲染数据 | |||
var domObj = {} | |||
var trsObj = {} | |||
var trs = document.getElementsByTagName('tr') | |||
for (var j = 0; j < trs.length; j++) { | |||
var id = trs[j].getAttribute('classId') | |||
if (id) { | |||
trsObj[id] = trs[j] | |||
} | |||
} | |||
//console.log(trsObj,'trsObj') | |||
for (var i = 0; i < data.weekList.length; i++) { | |||
var weekObj = data.weekList[i] | |||
for (var j = 0; j < weekObj.list.length; j++) { | |||
var weekList = weekObj.list[j] | |||
weekList['time'] = weekObj.time | |||
var tds = trsObj[weekList.teachClassNo].getElementsByTagName('td') | |||
for (var k = 0; k < tds.length; k++) { | |||
var time = tds[k].getAttribute('time') | |||
var classId = tds[k].getAttribute('classId') | |||
var week = tds[k].getAttribute('week') | |||
if (week == weekList.day && classId == weekList.teachClassNo && time == weekList.time) { | |||
tds[k].innerHTML = '<div>课程:' + weekList.curriculum + '</div><div>教师:' + weekList.teacher + '</div><div>教室:' + weekList.classRoom + '</div>' | |||
} | |||
} | |||
} | |||
} | |||
} | |||
); | |||
}, | |||
bind: function () { | |||
// 刷新 | |||
$('#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(); | |||
} | |||
}); | |||
//查询 | |||
$('#lr_search').on('click', function () { | |||
var p = {}; | |||
p.schoolId = $('#F_SchoolId').lrselectGet(); | |||
p.ClassNo = $('#ClassNo').lrselectGet(); | |||
p.EmpNo = $('#EmpNo').lrselectGet(); | |||
page.search(p); | |||
}); | |||
// 按条件清空排课数据 | |||
$('#emptyByCondition').on('click', function () { | |||
learun.layerForm({ | |||
id: 'EmptyByConditionForm', | |||
title: '按条件清空排课数据', | |||
url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTerm/EmptyByConditionForm', | |||
width: 600, | |||
height: 400, | |||
callBack: function (id) { | |||
return top[id].acceptClick(refreshGirdData); | |||
} | |||
}); | |||
}); | |||
// 按条件同步排课数据 | |||
$('#syncByCondition').on('click', function () { | |||
learun.layerForm({ | |||
id: 'SyncByConditionForm', | |||
title: '按条件同步排课数据', | |||
url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTerm/SyncByConditionForm', | |||
width: 600, | |||
height: 400, | |||
callBack: function (id) { | |||
return top[id].acceptClick(refreshGirdData); | |||
} | |||
}); | |||
}); | |||
//按条件重置基础数据同步状态 | |||
$('#initByCondition').on('click', function () { | |||
learun.layerForm({ | |||
id: 'SyncByConditionForm', | |||
title: '按条件重置基础数据同步状态', | |||
url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTerm/ClearByConditionForm', | |||
width: 600, | |||
height: 400, | |||
callBack: function (id) { | |||
return top[id].acceptClick(); | |||
} | |||
}); | |||
}); | |||
$('#lr_export').on('click', | |||
function () { | |||
window.open(window.origin+"/PersonnelManagement/TimeTable/PrintSchedule?" + Printdata.slice(0, Printdata.length-1)); | |||
//console.log(Printdata, "data"); | |||
}); | |||
}, | |||
bindSelect: function () { | |||
//校区 | |||
$('#F_SchoolId').lrDataSourceSelect({ | |||
code: 'company', value: 'f_companyid', text: 'f_fullname', select: function (item) { | |||
if (!!item) { | |||
// 班级 | |||
$('#ClassNo').lrselectRefresh({ | |||
placeholder: "请选择班级", | |||
allowSearch: true, | |||
url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetClassData', | |||
param: { schoolId: item.f_companyid }, | |||
value: 'value', | |||
text: 'text' | |||
}); | |||
// 教师 | |||
$('#EmpNo').lrselectRefresh({ | |||
placeholder: "请选择教师", | |||
allowSearch: true, | |||
url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetTeacherData', | |||
param: { schoolId: item.f_companyid }, | |||
value: 'value', | |||
text: 'text' | |||
}); | |||
} else { | |||
//班级 | |||
$('#ClassNo').lrselectRefresh({ | |||
placeholder: "请选择班级", | |||
allowSearch: true, | |||
url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetClassData', | |||
param: { schoolId: "" }, | |||
value: 'value', | |||
text: 'text' | |||
}); | |||
//教师 | |||
$('#EmpNo').lrselectRefresh({ | |||
placeholder: "请选择教师", | |||
allowSearch: true, | |||
url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetTeacherData', | |||
param: { schoolId: "" }, | |||
value: 'value', | |||
text: 'text' | |||
}); | |||
} | |||
} | |||
}); | |||
//班级 | |||
$('#ClassNo').lrselect({ | |||
placeholder: "请选择班级", | |||
allowSearch: true, | |||
url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetClassData', | |||
value: 'value', | |||
text: 'text' | |||
}); | |||
//教师 | |||
$('#EmpNo').lrselect({ | |||
placeholder: "请选择教师", | |||
allowSearch: true, | |||
url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetTeacherData', | |||
value: 'value', | |||
text: 'text' | |||
}); | |||
}, | |||
search: function (param) { | |||
param = param || {}; | |||
param.StartTime = startTime; | |||
param.EndTime = endTime; | |||
page.loadData(param); | |||
} | |||
}; | |||
page.init(); | |||
}; |
@@ -1606,6 +1606,7 @@ | |||
<Content Include="Areas\PersonnelManagement\Views\TeacherLeaveManagement\FormView.js" /> | |||
<Content Include="Areas\PersonnelManagement\Views\TeacherOvertimeManagement\FormView.js" /> | |||
<Content Include="Areas\PersonnelManagement\Views\TimeTable\ClassIndexInEducation.js" /> | |||
<Content Include="Areas\PersonnelManagement\Views\TimeTable\SchoolLesson.js" /> | |||
<Content Include="Areas\PersonnelManagement\Views\WorkStudyPositionApply\CheckIndex.js" /> | |||
<Content Include="Areas\PersonnelManagement\Views\WorkStudyPositionApply\Form.js" /> | |||
<Content Include="Areas\PersonnelManagement\Views\WorkStudyPositionApply\FormView.js" /> | |||
@@ -3299,6 +3300,8 @@ | |||
<Content Include="Content\js\OnlineRegistrate\scripts.js" /> | |||
<Content Include="Content\js\OnlineRegistrate\tooltips.js" /> | |||
<Content Include="Content\js\popper.js" /> | |||
<Content Include="Content\js\PrintLesson\debug.js" /> | |||
<Content Include="Content\js\PrintLesson\html2canvas.js" /> | |||
<Content Include="Content\js\qrcode.min.js" /> | |||
<Content Include="Content\js\swiper.min.js" /> | |||
<Content Include="Content\js\swiper.min1.js" /> | |||
@@ -7930,6 +7933,8 @@ | |||
<Content Include="Areas\EducationalAdministration\Views\StuEnrollPhone\StuRecruitmentBrochure.cshtml" /> | |||
<Content Include="Areas\EducationalAdministration\Views\VaccinationInfo\TeachForm.cshtml" /> | |||
<Content Include="Areas\EducationalAdministration\Views\VaccinationInfo\TeachIndex.cshtml" /> | |||
<Content Include="Areas\PersonnelManagement\Views\TimeTable\SchoolLesson.cshtml" /> | |||
<Content Include="Areas\PersonnelManagement\Views\TimeTable\PrintSchedule.cshtml" /> | |||
<None Include="Properties\PublishProfiles\CustomProfile.pubxml" /> | |||
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" /> | |||
<Content Include="Views\Login\Default-beifen.cshtml" /> | |||