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");
$.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/SpecialityScoreSum/SpecialityScoreSumList', { collegeID: collegeID, standardID: standardID, classmajorID: classmajorID, yearID: yearID, schoolyearNumID: schoolyearNumID, schoolcodeID: schoolcodeID, InSchoolStatus: InSchoolStatus },
function (data) {
$("#SpecialityScoreSumtable").find("tr.row").remove();
if (data) {
var d = [];
var firstRow = [];
var secondRow = [];
var thirdRow = [];
var forthRow = [];
var detailRow = [];
//生成第一、二、三行表头,学年和学期和课程
//第一行开头
firstRow.push("
");
firstRow.push("学期 | ");
//第二行开头
secondRow.push("
");
//第三行开头
thirdRow.push("
");
thirdRow.push("次序 | ");
thirdRow.push("学号 | ");
thirdRow.push("姓名 | ");
for (var i = 0; i < data.StudentList.length; i++) {
var student = data.StudentList[i];
forthRow[i] = [];
forthRow[i].push("
");
forthRow[i].push("" + (i + 1).toString() + " | ");
forthRow[i].push("" + student.LoginID + " | ");
forthRow[i].push("" + student.UserName + " | ");
}
var totalWidth = 206;
//前三行明细
for (var i = 0; i < data.SchoolyearNums.length; i++) {
var schoolyearWidth = data.SchoolyearNums[i].CoursematerialNum * 22;
totalWidth += schoolyearWidth + 2;
firstRow.push("" + data.SchoolyearNums[i].Title + " | ");
var schoolyearNum = data.SchoolyearNums[i];
for (var j = 0; j < schoolyearNum.SchoolCodeView.length; j++) {
var schoolcode = schoolyearNum.SchoolCodeView[j];
var schoolcodeWidth = schoolcode.CoursematerialList.length * 22;
secondRow.push("" + schoolcode.Title + " | ");
for (var k = 0; k < schoolcode.CoursematerialList.length; k++) {
var coursematerial = schoolcode.CoursematerialList[k];
//thirdRow.push("" + coursematerial.Title.substring(0, 12).split('').join(' ') + " | ");
if (coursematerial.Title.length <= 12) {
thirdRow.push("" + coursematerial.Title.split('').join(' ') + " | ");
} else {
var str = coursematerial.Title.substring(0, 12) + "...";
thirdRow.push("" + str.split('').join(' ') + " | ");
}
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 + " | ");
//forthRow[index].push(" | ");
}
else {
forthRow[index].push(" | ");
//forthRow[index].push(" | ");
}
}
}
}
}
//第一行结尾
firstRow.push("
");
//第二行结尾
secondRow.push("");
//第三行结尾
thirdRow.push("");
totalWidth += 16;
d.push("");
d.push(firstRow.join(""));
d.push(secondRow.join(""));
d.push(thirdRow.join(""));
d.push("
");
d.push("");
for (var i = 0; i < data.StudentList.length; i++) {
d.push(forthRow[i].join(""));
d.push("");
}
d.push("
");
$("#SpecialityScoreSumtable").html(d.join(""));
resizeDiv();
} else {
$.messager.alert("系统提示", "对不起,未找到数据!");
}
});
}
function resizeDiv() {
var scoreDiv = $("#divScore");
var contentHeight = $(window).height() - $("#divScore").offset().top - 2;
scoreDiv.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 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;
$.popupTopWindow('学生个人成绩报表', redirectTo, 850, 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");
if (collegeID == "") {
$.messager.alert("系统提示", "请选择" + EMIS_CollegeLabel + "!");
return;
}
if (schoolyear == "-1") {
$.messager.alert("系统提示", "请选择年级!");
return;
}
if (specialtyID == "") {
$.messager.alert("系统提示", "请选择专业!");
return;
}
if (classmajorID == "") {
$.messager.alert("系统提示", "请选择班级!");
return;
}
$("#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();
}