Browse Source

学生学籍打印打印失败

临城职教中职
ndbs 2 years ago
parent
commit
830bd328e2
1 changed files with 179 additions and 172 deletions
  1. +179
    -172
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/printxjk.cshtml

+ 179
- 172
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuInfoBasic/printxjk.cshtml View File

@@ -45,6 +45,8 @@
border: 1px solid #222;
border-top: none;
border-bottom: none;
border-collapse:collapse;
border-spacing:0px;
}

td {
@@ -53,34 +55,24 @@
border: 1px solid #222;
text-align: center;
}

#headerInfo td {
width: 15%;
height: 44px;
border: 1px solid #222;
text-align: center;
/* word-wrap: break-word;
word-break: normal; */
page-break-after: always;
}

.pageBreak {
page-break-after: always;
}

.noPrint {
display: none;
.btn {
width: 100px;
height: 34px;
line-height: 34px;
text-align: center;
margin: 30px auto;
border: 1px solid #ccc;
cursor: pointer;
border-radius: 4px;
}

.pageBreak {
page-break-after: always;
.tableBox {
width: 90%;
margin: 30px auto;
}

/* .tablehtml{
width: 100%;
height: 2000px;
background: rgb(221, 161, 161);
} */
</style>
</head>

@@ -161,173 +153,188 @@
</tr>
</table>
<div class="tablehtml">

</div>
<div class="btn">打印</div>
</div>
<script src="~/Content/jquery/plugin/fullcalendar/js/jquery-1.7.2.min.js"></script>
<script src="~/Content/jquery/plugin/jqprint/jquery.jqprint-0.3.js"></script>
<script>
//绑定字典或源的值
function GetDataSourceStr(code, value, text, valueStr, box) {
$(box).html("");
$.ajax({
url: "/OnlineRegistrate/GetDataSourceMap?code=" + code,
async: false,
success: function (msg) {
var msgObject = $.parseJSON(msg);
if (msgObject.code == 200) {
$.each(msgObject.data, function (i, item) {
if (item[value] == valueStr) {
$(box).html(item[text]);
return;
}
});
} else {
layer.msg(msgObject.info);
}
},
});
return;
};
function GetDataItemStr(code, valueStr, box) {
$(box).html("");
$.ajax({
url: "/OnlineRegistrate/GetDataItemMap?code=" + code,
async: false,
success: function (msg) {
var msgObject = $.parseJSON(msg);
if (msgObject.code == 200) {
$.each(msgObject.data, function (i, item) {
if (item["F_ItemValue"] == valueStr) {
$(box).html(item["F_ItemName"]);
return;
}
});
} else {
layer.msg(msgObject.info);
}
},
});
return;
};
GetDataItemStr("usersexbit", "@Model.GenderNo.ToString().ToLower()", "#GenderNo");
GetDataItemStr("National", "@Model.NationalityNo", "#NationalityNo");
GetDataItemStr("PolityStatus", "@Model.PartyFaceNo", "#PartyFaceNo");
GetDataItemStr("StudyModality", "@Model.StudyModality", "#StudyModality");
GetDataSourceStr("CdMajorInfo", "majorno", "majorname", "@Model.MajorNo", "#MajorNo");
GetDataSourceStr("bjsj", "classno", "classname", "@Model.ClassNo", "#ClassNo");
$(window).load(function () {
var listData1 = "@Model.StuScoreClassOneList.ToJson()";
var listData = JSON.parse(listData1.replace(/&quot;/g, "\""));
// 有六个学期
var tableHtml = ""
var str = ""
var std = ""
for (var j = 0; j < listData.length; j++) {
var str = ""
var std = ""
tableHtml += "<table cellpadding='0' cellspacing='0' id='table"+j+"'>"
// 循环其五行tr
for (var i = 0; i < listData[j].StuScoreList.length; i++) {
std = ""
str+="<tr>"
for(var k =0;k<7;k++){
// std +=`<td rowspan='5'>第${j}学期</td>`
if(k==0){
if(i==0){
std +=`<td rowspan='5'>第${j+1}学期</td>`
}
$('.btn').click(function () {
window.print()
})
</script>
<script>
//绑定字典或源的值
function GetDataSourceStr(code, value, text, valueStr, box) {
$(box).html("");
$.ajax({
url: "/OnlineRegistrate/GetDataSourceMap?code=" + code,
async: false,
success: function (msg) {
var msgObject = $.parseJSON(msg);
if (msgObject.code == 200) {
$.each(msgObject.data, function (i, item) {
if (item[value] == valueStr) {
$(box).html(item[text]);
return;
}
});
} else {
layer.msg(msgObject.info);
}
},
});
return;
};
function GetDataItemStr(code, valueStr, box) {
$(box).html("");
$.ajax({
url: "/OnlineRegistrate/GetDataItemMap?code=" + code,
async: false,
success: function (msg) {
var msgObject = $.parseJSON(msg);
if (msgObject.code == 200) {
$.each(msgObject.data, function (i, item) {
if (item["F_ItemValue"] == valueStr) {
$(box).html(item["F_ItemName"]);
return;
}
});
} else {
layer.msg(msgObject.info);
}
},
});
return;
};
GetDataItemStr("usersexbit", "@Model.GenderNo.ToString().ToLower()", "#GenderNo");
GetDataItemStr("National", "@Model.NationalityNo", "#NationalityNo");
GetDataItemStr("PolityStatus", "@Model.PartyFaceNo", "#PartyFaceNo");
GetDataItemStr("StudyModality", "@Model.StudyModality", "#StudyModality");
GetDataSourceStr("CdMajorInfo", "majorno", "majorname", "@Model.MajorNo", "#MajorNo");
GetDataSourceStr("bjsj", "classno", "classname", "@Model.ClassNo", "#ClassNo");
$(window).load(function () {
var listData1 = "@Model.StuScoreClassOneList.ToJson()";
var listData = JSON.parse(listData1.replace(/&quot;/g, "\""));
// 有六个学期
var tableHtml = ""
for (var j = 0; j < listData.length; j++) {

}else{
if (k % 2 == 0) {
std += `<td>${listData[j].StuScoreList[i].Score}</td>`
tableHtml += "<table cellpadding='0' cellspacing='0' id='table" + j + "'>"
var trNum = Math.ceil(listData[j].StuScoreList.length / 3)
// 代表当前有几行 不确定是否每行都是满的
var str = ""
// 循环其行tr
for (var i = 0; i < trNum; i++) {
var std = ""
str += "<tr>"
// 开始循环6列 三门成绩
// 循环3次td每次两个
for (var k = 0; k < 2; k++) {
if(k==0){
// 如果是第一列
if(i==0){
// 如果是第一行的第一列
std += `<td rowspan='5'>第${j + 1}学期</td>`
}else{
// 如果是不是第一行的第一列 则什么都不加
}
}else{
std += `<td>${listData[j].StuScoreList[i].LessonName}</td>`
// 如果不是第一列
// i是第几行 i*3-1 (i-1)*3
var startNum = (i)*3
var endNum = (i+1)*3-1
// 控制单元格从第几个开始,到底几个结束
for(var tdsNum = startNum;tdsNum<=endNum;tdsNum++){
// console.log(tdsNum,'222',listData[j].StuScoreList[3]['text'])
// 有取到数据
if(listData[j].StuScoreList[tdsNum]){
std += `<td>${listData[j].StuScoreList[tdsNum]['LessonName']}</td><td>${listData[j].StuScoreList[tdsNum]['Score']}</td>`
}else{
// 无数据
std +=`<td></td><td></td>`
}
}
}
// if(k==2){
// std +=`<td>${listData[j].text}</td>`
// }
// std +=`<td></td>`
}

str += std + "</tr>"
}
str+= std + "</tr>"
tableHtml += str + "</table>"
}
tableHtml+= str + "</table>"
}
$(".tablehtml").html(tableHtml)
setTimeout(() => {
$(".tablehtml").html(tableHtml)
},100)

var yiH = $("#table0").height()
var erH = $("#table1").height()
var sanH = $("#table2").height()
var siH = $("#table3").height()
var wuH = $("#table4").height()
var liuH = $("#table5").height()
var siNumH = erH + sanH + siH
// erDom.classList.add("pageBreak")
$("#table1").addClass("pageBreak")
// removeClass()
if(yiH>300){
var yiH = $("#table0").height()
var erH = $("#table1").height()
var sanH = $("#table2").height()
var siH = $("#table3").height()
var wuH = $("#table4").height()
var liuH = $("#table5").height()
var siNumH = erH + sanH + siH
// erDom.classList.add("pageBreak")
$("#table1").addClass("pageBreak")
// removeClass()
if (yiH > 300) {

$("#table0").addClass("pageBreak")
$("#table5").addClass("pageBreak")
}
$("#table0").addClass("pageBreak")
$("#table5").addClass("pageBreak")
}

if(erH > 300){
$("#table0").addClass("pageBreak")
$("#table1").removeClass("pageBreak")
}
if (erH > 300) {
$("#table0").addClass("pageBreak")
$("#table1").removeClass("pageBreak")
}

if(sanH > 300){
$("#table1").removeClass("pageBreak")
$("#table2").addClass("pageBreak")
$("#table3").removeClass("pageBreak")
$("#table4").removeClass("pageBreak")
}
if(siH > 400){
$("#table3").addClass("pageBreak")
$("#table5").removeClass("pageBreak")
$("#table4").removeClass("pageBreak")
}
if(wuH > 400){
$("#table4").addClass("pageBreak")
liuDom.removeClass("pageBreak")
if (sanH > 300) {
$("#table1").removeClass("pageBreak")
$("#table2").addClass("pageBreak")
$("#table3").removeClass("pageBreak")
$("#table4").removeClass("pageBreak")
}
if (siH > 400) {
$("#table3").addClass("pageBreak")
$("#table5").removeClass("pageBreak")
$("#table4").removeClass("pageBreak")
}
if (wuH > 400) {
$("#table4").addClass("pageBreak")
liuDom.removeClass("pageBreak")

}
if(liuH > 400){
$("#table4").addClass("pageBreak")
}
if (liuH > 400) {
$("#table4").addClass("pageBreak")

}
if((yiH + erH)>200){
$("#table1").addClass("pageBreak")
$("#table2").removeClass("pageBreak")
$("#table3").removeClass("pageBreak")
$("#table4").removeClass("pageBreak")
$("#table5").removeClass("pageBreak")
}
if((erH + sanH)>600){
$("#table2").addClass("pageBreak")
$("#table3").removeClass("pageBreak")
$("#table4").removeClass("pageBreak")
$("#table5").removeClass("pageBreak")
}
if((sanH +siH)>700){
// siDom.classList.add("pageBreak")
$("#table4").removeClass("pageBreak")
$("#table5").removeClass("pageBreak")
}
}
if ((yiH + erH) > 200) {
$("#table1").addClass("pageBreak")
$("#table2").removeClass("pageBreak")
$("#table3").removeClass("pageBreak")
$("#table4").removeClass("pageBreak")
$("#table5").removeClass("pageBreak")
}
if ((erH + sanH) > 600) {
$("#table2").addClass("pageBreak")
$("#table3").removeClass("pageBreak")
$("#table4").removeClass("pageBreak")
$("#table5").removeClass("pageBreak")
}
if ((sanH + siH) > 700) {
// siDom.classList.add("pageBreak")
$("#table4").removeClass("pageBreak")
$("#table5").removeClass("pageBreak")
}

if((siH + wuH) >700){
$("#table4").addClass("pageBreak")
$("#table5").removeClass("pageBreak")
}
if ((siH + wuH) > 700) {
$("#table4").addClass("pageBreak")
$("#table5").removeClass("pageBreak")
}

if((erH + sanH + siH)>700){
$("#table2").addClass("pageBreak")
$("#table3").removeClass("pageBreak")
$("#table4").classList.add("pageBreak")
}
})
if ((erH + sanH + siH) > 700) {
$("#table2").addClass("pageBreak")
$("#table3").removeClass("pageBreak")
$("#table4").classList.add("pageBreak")
}
})
</script>
</body>



Loading…
Cancel
Save