var isFirstLoadGradeYear = true;
var isFirstLoadClassmajor = true;
var isPageLoad = true;
function SpecialityScoreSumTable() {
var collegeID = $("#CollegeDropdown").combobox("getValue");
var standardID = $("#DictionaryStandard").combogridX("getValue");
var classmajorID = $("#ClassmajorDropdown").combogridX("getValue");
var yearID = $("#DictionarySchoolyear").combobox("getValue");
var schoolyearNumID = $("#DictionarySchoolyearNum").combobox("getValue");
var schoolcodeID = $("#DictionarySchoolcode").combobox("getValue");
//var InSchoolStatus = $("#InSchoolStatusDictionaryDropDown").combobox("getValue");
var courseTypeIDs = document.getElementsByName("CourseTypeID");
var Credit = $("#IsCredit").is(':checked')
var courseTypeIDList = "";
for (i = 0; i < courseTypeIDs.length; i++) {
if (courseTypeIDs[i].checked) {
var courseType = courseTypeIDs[i].value;
courseTypeIDList = courseTypeIDList + courseType + ',';
}
}
$.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/SpecialityScoreSum/SpecialityScoreByScoreList', { collegeID: collegeID, standardID: standardID, classmajorID: classmajorID, yearID: yearID, schoolyearNumID: schoolyearNumID, schoolcodeID: schoolcodeID, CourseTypeID: courseTypeIDList },
function (data) {
$("#SpecialityScoreSumtable").find("tr.row").remove();
if (data) {
var d = [];
var firstRow = [];
var secondRow = [];
var secondRow1 = [];
var secondRow2 = [];
var secondRow3 = [];
var thirdRow = [];
var forthRow = [];
var detailRow = [];
//生成第一、二、三行表头,学年和学期和课程
//第一行(左上角)开头
var containerWidth = $("#SpecialityScoreSumtable").width() - 210;
firstRow.push("
");
firstRow.push("");
firstRow.push("学期 | ");
firstRow.push("
");
firstRow.push("");
firstRow.push("次序 | ");
firstRow.push("学号 | ");
firstRow.push("姓名 | ");
firstRow.push("
");
firstRow.push("");
firstRow.push(" | ");
firstRow.push(" | ");
firstRow.push(" | ");
firstRow.push("
");
firstRow.push("");
firstRow.push(" | ");
firstRow.push(" | ");
firstRow.push(" | ");
firstRow.push("
");
firstRow.push("
");
//第二行(右上角)开头(表头后补,因为长度未知,高度定292)
secondRow.push("");
secondRow1.push("
");
secondRow2.push("
");
secondRow3.push("
");
if (Credit) {
secondRow.push("学分统计 | ");
secondRow1.push("总学分 | ");
secondRow1.push("必修学分 | ");
secondRow1.push("限选学分 | ");
secondRow1.push("通识教育 | ");
secondRow1.push("任选学分 | ");
secondRow1.push("方向选修 | ");
secondRow1.push("公共选修 | ");
secondRow1.push("实践环节 | ");
secondRow1.push("俱乐部(含校本) | ");
secondRow1.push("平均分 | ");
secondRow2.push(" | ");
secondRow2.push(" | ");
secondRow2.push(" | ");
secondRow2.push(" | ");
secondRow2.push(" | ");
secondRow2.push(" | ");
secondRow2.push(" | ");
secondRow2.push(" | ");
secondRow2.push(" | ");
secondRow2.push(" | ");
secondRow3.push(" | ");
secondRow3.push(" | ");
secondRow3.push(" | ");
secondRow3.push(" | ");
secondRow3.push(" | ");
secondRow3.push(" | ");
secondRow3.push(" | ");
secondRow3.push(" | ");
secondRow3.push(" | ");
secondRow3.push(" | ");
}
//第三行(左下角)开头
thirdRow.push("");
//第四行(右下角)(表头后补,因为长度未知)
for (var i = 0; i < data.StudentList.length; i++) {
var student = data.StudentList[i];
var credit = data.SpecialityCreditView[i];
var tmpThirdRow = [];
tmpThirdRow.push("");
tmpThirdRow.push("" + (i + 1).toString() + " | ");
tmpThirdRow.push("" + student.LoginID + " | ");
tmpThirdRow.push("" + student.UserName + " | ");
tmpThirdRow.push("
");
thirdRow.push(tmpThirdRow.join(''));
forthRow[i] = [];
forthRow[i].push("");
if (Credit && credit != null) {
forthRow[i].push("" + credit.TotalCredit + " | ");
forthRow[i].push("" + credit.RequiredCredit + " | ");
forthRow[i].push("" + credit.OptionalCourseCredit + " | ");
forthRow[i].push("" + credit.GeneralEducationCredit + " | ");
forthRow[i].push("" + credit.FreeSelectionCourseCredit + " | ");
forthRow[i].push("" + credit.ElectiveCredit + " | ");
forthRow[i].push("" + credit.ElectivePublicCredit + " | ");
forthRow[i].push("" + credit.PractiseNotCredit + " | ");
forthRow[i].push("" + credit.ClubWithSchoolbasedCredit + " | ");
forthRow[i].push("" + credit.AvgScore + " | ");
}
else if (Credit && credit == null) {
forthRow[i].push("0 | ");
forthRow[i].push("0 | ");
forthRow[i].push("0 | ");
forthRow[i].push("0 | ");
forthRow[i].push("0 | ");
forthRow[i].push("0 | ");
forthRow[i].push("0 | ");
forthRow[i].push("0 | ");
forthRow[i].push("0 | ");
forthRow[i].push("0 | ");
}
}
thirdRow.push("
");
var totalWidth = 208;
if (Credit) {
totalWidth += 400;
}
//前三行明细
for (var i = 0; i < data.SchoolyearNums.length; i++) {
var schoolyearWidth = data.SchoolyearNums[i].CoursematerialNum * 30;
totalWidth += schoolyearWidth + 2;
var schoolyearNum = data.SchoolyearNums[i];
for (var j = 0; j < schoolyearNum.SchoolCodeView.length; j++) {
var schoolcode = schoolyearNum.SchoolCodeView[j];
var schoolcodeWidth = schoolcode.CoursematerialList.length * 30;
secondRow.push("" + schoolcode.Title + " | ");
for (var k = 0; k < schoolcode.CoursematerialList.length; k++) {
var coursematerial = schoolcode.CoursematerialList[k];
if (coursematerial.Title.length <= 12) {
secondRow1.push("" + coursematerial.Title.split('').join(' ') + " | ");
} else {
var str = coursematerial.Title.substring(0, 12) + "...";
secondRow1.push("" + str.split('').join(' ') + " | ");
}
secondRow2.push("" + coursematerial.Tag + " | ");
secondRow3.push("" + coursematerial.Credit + " | ");
for (var l = 0; l < coursematerial.ScoreList.length; l++) {
var score = coursematerial.ScoreList[l];
var index = -1;
for (var m = 0; m < data.StudentList.length; m++) {
if (data.StudentList[m].UserID == score.UserID) {
index = m;
}
}
if (index < 0) continue;
if (score.Score != null && score.Score != "") {
if (score.Score >= 60)
forthRow[index].push("" + score.Score + " | ");
else
forthRow[index].push("" + score.Score + " | ");
}
else if (score.Score == 0) {
forthRow[index].push("" + score.Score + " | ");
}
else {
forthRow[index].push(" | ");
}
}
}
}
}
secondRow.push("
");
secondRow1.push("");
secondRow2.push("");
secondRow3.push("");
//扣除滚动条宽度
containerWidth -= 16;
d.push(firstRow.join(""));
d.push("");
d.push(secondRow.join(""));
d.push(secondRow1.join(""));
d.push(secondRow2.join(""));
d.push(secondRow3.join(""));
d.push("
");
d.push(thirdRow.join(""));
d.push("");
for (var i = 0; i < data.StudentList.length; i++) {
d.push(forthRow[i].join(""));
d.push("");
}
d.push("
");
// totalWidth = totalWidth + 16;
// d.push("");
// // for (var i = 0; i < data.StudentList.length; i++) {
// // d.push(forthRow[i].join(""));
// // d.push("");
// // }
// d.push("
");
$("#SpecialityScoreSumtable").html(d.join(""));
resizeGrids();
$("#divScore").scroll(scoreOnScroll);
} else {
$.messager.alert("系统提示", "对不起,未找到数据!");
}
});
}
function resizeGrids() {
var scoreList = $("#divScore table tr");
var studentsList = $("#divStudents table tr");
var connerDiv = $("#divConner");
var studentsDiv = $("#divStudents");
var labelsDiv = $("#divLabels");
var scoreDiv = $("#divScore");
var scoreTable = $("#divScore table");
var studentsTable = $("#divStudents table");
var connerFirstRow = $("#divConner table tr:eq(0) td");
var labelsFirstRow = $("#divLabels table tr:eq(0) td");
var isIE = navigator.userAgent.indexOf("compatible") > -1 && navigator.userAgent.indexOf("MSIE") > -1 && navigator.userAgent.indexOf("Opera") <= -1;
var labelsFirstRowHeight = labelsFirstRow.height();
if (isIE) {
labelsFirstRowHeight += 2;
}
connerFirstRow.height(labelsFirstRowHeight);
connerDiv.height(labelsDiv.height());
labelsDiv.height(labelsDiv.height());
// if (isIE) {
// studentsDiv.css("margin-top", (labelsFirstRowHeight - 16) + "px");
// } else {
// studentsDiv.css("margin-top", (labelsFirstRowHeight - 18) + "px");
// }
//studentsTable.height(scoreTable.height());
//scoreTable.height(studentsTable.height());
for (var i = 0; i < scoreList.length; i++) {
// var studentRowOffset = $(studentsList[i]).find("td:eq(0)").offset();
// var scoreRowOffset = $(scoreList[i]).find("td:eq(0)").offset();
// $(studentsList[i]).find("td:eq(0)").offset({
// top: scoreRowOffset.top,
// left: studentRowOffset.left
// });
if (!isIE) {
$(studentsList[i]).find("td").height($(scoreList[i]).find("td:eq(0)").height());
$(scoreList[i]).find("td:eq(0)").height($(studentsList[i]).find("td:eq(0)").height());
$(studentsList[i]).height($(scoreList[i]).height());
$(scoreList[i]).height($(studentsList[i]).height());
} else {
$(studentsList[i]).find("td:eq(0)").height($(scoreList[i]).find("td:eq(0)").height());
//$(scoreList[i]).find("td:eq(0)").height($(studentsList[i]).find("td:eq(0)").height());
$(studentsList[i]).height($(scoreList[i]).height());
//$(scoreList[i]).height($(studentsList[i]).height());
var studentsListOffset = $(studentsList[i]).offset();
var scoreListOffset = $(scoreList[i]).offset();
if (studentsListOffset.top > scoreListOffset.top) {
$(scoreList[i]).find("td:eq(0)").css("padding-top", (1 + studentsListOffset.top - scoreListOffset.top) + "px");
} else if (studentsListOffset.top < scoreListOffset.top) {
$(studentsList[i]).find("td:eq(0)").css("padding-top", (1 + scoreListOffset.top - studentsListOffset.top) + "px");
}
}
}
resizeDiv();
}
function scoreOnScroll() {
var scoreDiv = $("#divScore");
var labelsDiv = $("#divLabels");
var studentsDiv = $("#divStudents");
studentsDiv.scrollTop(scoreDiv.scrollTop());
labelsDiv.scrollLeft(scoreDiv.scrollLeft());
}
function switchPanel() {
var showDivs = $("#formQuery div");
if (showDivs.css("display") == "none") {
showDivs.show();
$("#divDownIcon").show();
$("#divUpIcon").hide();
} else {
showDivs.hide();
$("#divDownIcon").hide();
$("#divUpIcon").show();
}
resizeDiv();
}
function resizeDiv() {
var scoreDiv = $("#divScore");
var labelsDiv = $("#divLabels");
var studentsDiv = $("#divStudents");
if (labelsDiv.length > 0) {
var contentHeight = $(window).height() - $("#SpecialityScoreSumtable").offset().top - labelsDiv.height() - 2;
scoreDiv.height(contentHeight);
studentsDiv.height(contentHeight);
}
}
//个人成绩报表(松山、工大、科大等)
function StudentScore_Report() {
var classmajorID = $("#ClassmajorDropdown").combogridX("getValue");
if (classmajorID == "") {
$.messager.alert("系统提示", "请选择班级!");
return;
}
var InSchoolStatus = $("#InSchoolStatusDictionaryDropDown").combobox("getValue");
var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/SpecialityScoreSum/StudentScoreReport?MNU=' + mnu
+ "&ClassmajorID=" + classmajorID + "&InSchoolStatus=" + InSchoolStatus;
$.popupTopWindow('学生成绩表', redirectTo, 1100, 550, null, null);
}
//个人成绩报表(广体等)
function StudentScore_NewReport() {
var courseTypeIDs = document.getElementsByName("CourseTypeID");
var courseTypeIDList = "";
for (i = 0; i < courseTypeIDs.length; i++) {
if (courseTypeIDs[i].checked) {
var courseType = courseTypeIDs[i].value;
courseTypeIDList = courseTypeIDList + courseType + ',';
}
}
courseTypeIDList = courseTypeIDList.substring(0, courseTypeIDList.length - 1);
var collegeID = $("#CollegeDropdown").combobox("getValue");
var standardID = $("#DictionaryStandard").combogridX("getValue");
var yearID = $("#DictionarySchoolyear").combobox("getValue");
var schoolyearNumID = $("#DictionarySchoolyearNum").combobox("getValue");
var schoolcodeID = $("#DictionarySchoolcode").combobox("getValue");
var classmajorID = $("#ClassmajorDropdown").combogridX("getValue");
// if (classmajorID == "") {
// $.messager.alert("系统提示", "请选择班级!");
// return;
// }
var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/SpecialityScoreSum/StudentScoreNewReport?MNU=' + mnu
+ "&CollegeID=" + collegeID + "&StandardID=" + standardID + "&YearID=" + yearID
+ "&SchoolyearNumID=" + schoolyearNumID + "&SchoolcodeID=" + schoolcodeID + "&ClassmajorID=" + classmajorID + "&CourseTypeID=" + courseTypeIDList;
$.popupTopWindow('成绩报表', redirectTo, 1000, 550, null, null);
}
function QueryCollegeDropdownList(data) {
if (((data.length && data.length > 0) || data)
&& $("#DictionarySchoolyear").length > 0 && $.data($("#DictionarySchoolyear")[0], "combobox")) {
var url = CMS_SystemConfig.VirtualDirectoryPath + "/Common/SchoolYearDropDown?bindType=2";
$("#DictionarySchoolyear").combobox("reload", url);
}
}
function QueryYearDropdownList(data) {
if (((data.length && data.length > 0) || data)
&& $("#DictionaryStandard").length > 0 && $.data($("#DictionaryStandard")[0], "combogridX")) {
reloadStandard();
}
}
function reloadStandard() {
var url = CMS_SystemConfig.VirtualDirectoryPath + "/Facultymajor/BindStandardDropDownList?bindType=0";
var collegeID = $("#CollegeDropdown").combobox("getValue");
if (collegeID != nonSelect) url += "&collegeID=" + collegeID;
$("#DictionaryStandard").combobox("reload", url);
}
function QueryStandardComboGrid(data) {
if (((data.length && data.length > 0) || data)
&& $("#ClassmajorDropdown").length > 0 && $.data($("#ClassmajorDropdown")[0], "combobox")) {
reloadClassmajor();
}
}
//function reloadClassmajor() {
// var url = CMS_SystemConfig.VirtualDirectoryPath + "/Classmajor/BindDropdownList?bindType=2";
// var college = $("#CollegeDropdown").combobox("getValue");
// var year = $("#DictionarySchoolyear").combobox("getValue");
// var standard = $("#DictionaryStandard").combobox("getValue");
// if (college != nonSelect) url += "&collegeID=" + college;
// if (year != nonSelect) url += "&schoolYear=" + year;
// if (standard != nonSelect) url += "&standardID=" + standard;
// $("#ClassmajorDropdown").combobox("clear");
// $("#ClassmajorDropdown").combobox("reload", url);
//}
//function QueryClassmajorDropdownList(data) {
// if (((data.length && data.length > 0) || data)) {
// if (isFirstLoadClassmajor) {
// isFirstLoadClassmajor = false;
// } else if (!isPageLoad) {
// if (data.length > 0) {
// $("#ClassmajorDropdown").combobox("setValue", data[0].Value);
// } else {
// $("#ClassmajorDropdown").combobox("clear");
// }
// }
// }
//}
function reload() {
// var collegeID = $("#CollegeDropdown").combobox("getValue");
var classmajorID = $("#ClassmajorDropdown").combogridX("getValue");
// var specialtyID = $("#DictionaryStandard").combogridX("getValue");
// var schoolyear = $("#DictionarySchoolyear").combobox("getValue");
// if (collegeID == "") {
// $.messager.alert("系统提示", "请选择" + EMIS_CollegeLabel + "!");
// return;
// }
// if (schoolyear == "-1") {
// $.messager.alert("系统提示", "请选择年级!");
// return;
// }
// if (specialtyID == "") {
// $.messager.alert("系统提示", "请选择专业!");
// return;
// }
//if (classmajorID == "") {
// $.messager.alert("系统提示", "请选择班级!");
// return;
//}
SpecialityScoreSumTable();
}
function getExcel() {
var collegeID = $("#CollegeDropdown").combobox("getValue");
var classmajorID = $("#ClassmajorDropdown").combogridX("getValue");
var specialtyID = $("#DictionaryStandard").combogridX("getValue");
var schoolyear = $("#DictionarySchoolyear").combobox("getValue");
var courseTypeIDs = document.getElementsByName("CourseTypeID");
var Credit = $("#IsCredit").is(':checked')
var courseTypeIDList = "";
for (i = 0; i < courseTypeIDs.length; i++) {
if (courseTypeIDs[i].checked) {
var courseType = courseTypeIDs[i].value;
courseTypeIDList = courseTypeIDList + courseType + ',';
}
}
if (collegeID == "") {
$.messager.alert("系统提示", "请选择" + EMIS_CollegeLabel + "!");
return;
}
if (schoolyear == "-1") {
$.messager.alert("系统提示", "请选择年级!");
return;
}
if (specialtyID == "") {
$.messager.alert("系统提示", "请选择专业!");
return;
}
document.getElementById("formQuery").action = "GTExcel?CourseTypeIDs=" + courseTypeIDList + "&IsCredit=" + Credit;
document.getElementById("formQuery").submit();
}
function queryStandard(data) {
queryClass();
}
function queryClass() {
var jsonString = "";
var parameterString = "";
//var campusID = $("#CampusDropdown").combogridX("getValue");
var collegeID = $("#CollegeDropdown").combobox("getValue");
var standardID = $("#DictionaryStandard").combogridX("getValue");
var schoolyearID = $("#DictionarySchoolyear").combobox("getValue");
if (schoolyearID != nonSelect) parameterString += "DictionaryGrade|*|" + schoolyearID + "|@|";
//if (campusID != nonSelect) parameterString += "CampusDropdown|*|" + campusID + "|@|";
if (collegeID != nonSelect) parameterString += "CollegeDropdown|*|" + collegeID + "|@|";
if (standardID != nonSelect) parameterString += "DictionaryStandard|*|" + standardID + "|@|";
if (parameterString != "") {
jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
$("#ClassmajorDropdown").combogridX("reload", eval(jsonString));
$("#DictionaryStandard").combogridX("reload", eval(jsonString));
} else {
$("#ClassmajorDropdown").combogridX("reload");
$("#DictionaryStandard").combogridX("reload", eval(jsonString));
}
//reload();
}