var url = CMS_SystemConfig.VirtualDirectoryPath + "/PersonalScore/Edit"; var urlAdd = CMS_SystemConfig.VirtualDirectoryPath + "/PersonalScore/Add"; var mnu = ""; var changeUserID; //加载 $(function () { mnu = $.SystemGeneral.getUrlParam("MNU"); }) //获取选中的数据 function validChoose() { var d = []; $.each($("#dgCourseScheduleSettingList").cmsXDataTable("getSelections"), function (index) { d.push(this.SubmitedScoreID); }); return d; } function reload() { $("#display_search_list").css('display', 'none'); var userID = $("#StudentsComboGrid").combogridX("getValue"); var userIDByName = $("#StudentsByNameComboGrid").combogridX("getValue"); if (userIDByName != nonSelect && userIDByName != "") { $("#StudentsByNameComboGrid").combogridX("setValue", nonSelect); } $.post(CMS_SystemConfig.VirtualDirectoryPath + '/PersonalScore/NewCoursematerialList', { userID: userID }, function (data) { if (data.length > 0) { var count = data[0].ListStarttermID.length; var width = " 20%"; var a = "100%"; if (count > 5) { var height = 0; a = 100 + (count - 5) * 20; width = 100 / count + "%"; } $("#search_list").html(""); StudentCoursematerialtable(data[0]); var html = "
"; for (var i = 0; i < data[0].ListStarttermID.length; i++) { //PS:同一课程、可能开课学期不同~ var listCourseGradeView = $.grep(data[0].ListCourseGradeView, function (x) { return (x.StarttermID == data[0].ListStarttermID[i]); }); html += ""; html += ""; html += ""; html += ""; html += ""; html += ""; html += ""; html += ""; html += ""; for (var j = 0; j < listCourseGradeView.length; j++) { var color = "'" + listCourseGradeView[j].CourseTypeColour + "'" html += ""; if (listCourseGradeView[j].Club == null) { html += ""; } else { html += ""; } if (listCourseGradeView[j].TotalScore < 60 || listCourseGradeView[j].TotalScore == "") html += ""; else html += ""; html += ""; html += ""; } html += "
" + listCourseGradeView[0].StarttermName + "
课程名称总成绩学分
" + listCourseGradeView[j].CourseName + "" + listCourseGradeView[j].CourseName + "" + listCourseGradeView[j].TotalScoreStr + "" + listCourseGradeView[j].TotalScoreStr + "" + isEmpty(listCourseGradeView[j].ScoreCredit) + "
"; } html += "
"; $("#search_list").html(html); } else { StudentCoursematerialtable(data[0]); var html = "

选择的学生成绩库中无成绩,请检查。

" $("#search_list").html(html); } }); //reloadBack(); } function reloadByName() { $("#display_search_list").css('display', 'none'); var userID = $("#StudentsComboGrid").combogridX("getValue"); var userIDByName = $("#StudentsByNameComboGrid").combogridX("getValue"); if (userID != nonSelect && userID != "") { $("#StudentsComboGrid").combogridX("setValue", nonSelect); } $.post(CMS_SystemConfig.VirtualDirectoryPath + '/PersonalScore/NewCoursematerialList', { userID: userIDByName }, function (data) { if (data.length > 0) { var count = data[0].ListStarttermID.length; var width = " 20%"; var a = "100%"; if (count > 5) { var height = 0; a = 100 + (count - 5) * 20; width = 100 / count + "%"; } $("#search_list").html(""); StudentCoursematerialtable(data[0]); var html = "
"; for (var i = 0; i < data[0].ListStarttermID.length; i++) { //PS:同一课程、可能开课学期不同~ var listCourseGradeView = $.grep(data[0].ListCourseGradeView, function (x) { return (x.StarttermID == data[0].ListStarttermID[i]); }); html += ""; html += ""; html += ""; html += ""; html += ""; html += ""; html += ""; html += ""; html += ""; for (var j = 0; j < listCourseGradeView.length; j++) { var color = "'" + listCourseGradeView[j].CourseTypeColour + "'" html += ""; if (listCourseGradeView[j].Club == null) { html += ""; } else { html += ""; } if (listCourseGradeView[j].TotalScore < 60 || listCourseGradeView[j].TotalScore == "") html += ""; else html += ""; html += ""; html += ""; } html += "
" + listCourseGradeView[0].StarttermName + "
课程名称总成绩学分
" + listCourseGradeView[j].CourseName + "" + listCourseGradeView[j].CourseName + "" + listCourseGradeView[j].TotalScoreStr + "" + listCourseGradeView[j].TotalScoreStr + "" + isEmpty(listCourseGradeView[j].ScoreCredit) + "
"; } html += "
"; $("#search_list").html(html); } else { StudentCoursematerialtable(data[0]); var html = "

选择的学生成绩库中无成绩,请检查。

" $("#search_list").html(html); } }); //reloadBack(); } function reloadBack() { $("#display_search_list").css('display', 'none'); var userID = $("#StudentsComboGrid").combogridX("getValue"); $.post(CMS_SystemConfig.VirtualDirectoryPath + '/PersonalScore/NewCoursematerialList', { userID: userID }, function (data) { if (data.length > 0) { var count = data[0].ListStarttermID.length; var width = " 20%"; var a = "100%"; if (count > 5) { var height = 0; a = 100 + (count - 5) * 20; width = 100 / count + "%"; } $("#search_list").html(""); StudentCoursematerialtable(data[0]); var html = "
"; for (var i = 0; i < data[0].ListStarttermID.length; i++) { //PS:同一课程、可能开课学期不同~ var listCourseGradeView = $.grep(data[0].ListCourseGradeView, function (x) { return (x.StarttermID == data[0].ListStarttermID[i]); }); html += ""; html += ""; html += ""; html += ""; html += ""; html += ""; html += ""; html += ""; html += ""; for (var j = 0; j < listCourseGradeView.length; j++) { var color = "'" + listCourseGradeView[j].CourseTypeColour + "'" html += ""; if (listCourseGradeView[j].Club == null) { html += ""; } else { html += ""; } if (listCourseGradeView[j].TotalScore < 60 || listCourseGradeView[j].TotalScore == "") html += ""; else html += ""; html += ""; html += ""; } html += "
" + listCourseGradeView[0].StarttermName + "
课程名称总成绩学分
" + listCourseGradeView[j].CourseName + "" + listCourseGradeView[j].CourseName + "" + listCourseGradeView[j].TotalScoreStr + "" + listCourseGradeView[j].TotalScoreStr + "" + isEmpty(listCourseGradeView[j].ScoreCredit) + "
"; } html += "
"; $("#search_list").html(html); } else { StudentCoursematerialtable(data[0]); var html = "

请选择您要查看成绩的学生学号。

" $("#search_list").html(html); } }); } //验证是否为空。 function isEmpty(val) { switch (typeof (val)) { case 'string': return trim(val).length == 0 ? 0 : val; break; case 'number': return val == 0 ? 0 : val; break; case 'object': return val == null ? 0 : val; break; case 'array': return val.length == 0 ? 0 : val; break; default: return true; } }; function StudentCoursematerialtable(data) { if (data != null) { //$("#StudentCoursematerialtable").find("tr.row").remove(); var html = ""; html += ""; html += " "; html += "  "; html += " "; html += "  "; html += " "; html += "  "; html += ""; var html1 = ""; html1 += ""; html1 += " "; html1 += "  平均成绩:"; html1 += " "; html1 += "  "; html1 += " "; html1 += "  "; html1 += " "; html1 += "  "; html1 += " "; html1 += "  "; html1 += " "; html1 += "  "; html1 += " "; html1 += "  "; html1 += " "; html1 += "  "; html1 += " "; html1 += "  "; html1 += " "; // html += ""; // html += "姓   名"; // html += "" + data.UserName + ""; // html += "院系"; // html += "" + data.CollegeName + ""; // html += "班   级"; // html += "" + data.ClassName + ""; // html += ""; // html += ""; // html += "毕业时间"; // html += "" + (data.PlanningGraduateDate == null ? "" : ChangeDateFormat(data.PlanningGraduateDate)) + ""; // html += "门数"; // html += "" + data.CoursematerialCount + ""; // html += "平均成绩"; // html += "" + (data.AVGScore == null ? 0 : data.AVGScore.toFixed(1)) + ""; // html += ""; // html += ""; // html += "总 学 分"; // html += "" + (data.TotalCredit == null ? 0 : data.TotalCredit.toFixed(1)) + ""; // html += ""; // html += ""; // html += ""; // html += ""; // html += ""; $("#Studenttable").html(html); $("#StudentCoursematerialtable").html(html1); } else { $("#Studenttable").html(""); $("#StudentCoursematerialtable").html(""); } } function LoadScore(CoursematerialID, SchoolyearID, UserID, StarttermID) { $("#display_search_list").css('display', 'block'); $("#hid_SchoolyearID").val(SchoolyearID); $("#hid_CoursematerialID").val(CoursematerialID); $("#hid_UserID").val(UserID); $("#hid_StarttermID").val(StarttermID) $("#dgCourseScheduleSettingList").cmsXDataTable("load", { CoursematerialID: CoursematerialID, StarttermID: StarttermID, UserID: UserID }); } //转化json数据的日期 function ChangeDateFormat(jsondate) { jsondate = jsondate.replace("/Date(", "").replace(")/", ""); if (jsondate.indexOf("+") > 0) { jsondate = jsondate.substring(0, jsondate.indexOf("+")); } else if (jsondate.indexOf("-") > 0) { jsondate = jsondate.substring(0, jsondate.indexOf("-")); } //alert(jsondate); var date = new Date(parseInt(jsondate, 10)); //alert(date.getHours()); var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1; var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate(); //+ " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds(); 时分秒就不需要了~~ return date.getFullYear() + "-" + month + "-" + currentDate; } function PersonScore_Add() { var d = validChoose(); var SchoolyearID = $("#hid_SchoolyearID").val(); var CoursematerialID = $("#hid_CoursematerialID").val(); var UserID = $("#hid_UserID").val(); var StarttermID = $("#hid_StarttermID").val(); if (d.length > 0) { if (d.length > 1) { $.messager.alert("系统提示", "只能选择单个记录进行复制。"); return; } var redirectTo = url + "?SubmitedScoreID=" + d + "&SchoolyearID=" + SchoolyearID + "&CoursematerialID=" + CoursematerialID + "&UserID=" + UserID + "&StarttermID=" + StarttermID + "&atype=1&MNU=" + mnu + "&SaveType=Add"; $.popupTopWindow('学生成绩复制新增', redirectTo, 800, 480, AlertA); } else { var redirectTo = url + "?SubmitedScoreID=" + d + "&SchoolyearID=" + SchoolyearID + "&CoursematerialID=" + CoursematerialID + "&UserID=" + UserID + "&StarttermID=" + StarttermID + "&atype=1&MNU=" + mnu; $.popupTopWindow('学生成绩新增', redirectTo, 800, 480, null, null); } } function AlertA(data) { var changeUserID = data; if (changeUserID != null && changeUserID != "") { window.location.href = '/PersonalScore/NewList?MNU=' + mnu + "&UserID=" + changeUserID; } } function PersonScore_Update() { var d = validChoose(); var SchoolyearID = $("#hid_SchoolyearID").val(); var CoursematerialID = $("#hid_CoursematerialID").val(); var UserID = $("#hid_UserID").val(); var StarttermID = $("#hid_StarttermID").val(); if (d == "") { $.messager.alert("系统提示", "请选择您要修改的成绩基本信息。"); return; } if (d.length > 1) { $.messager.alert("系统提示", "只能选择单个记录进行修改。"); return; } var redirectTo = url + "?SubmitedScoreID=" + d + "&SchoolyearID=" + SchoolyearID + "&CoursematerialID=" + CoursematerialID + "&UserID=" + UserID + "&StarttermID=" + StarttermID + "&atype=2&MNU=" + mnu; $.popupTopWindow('学生成绩修改', redirectTo, 800, 480, null, null); } function PersonScore_Delete() { // var d = validChoose().join(','); // if (d == "") { // $.messager.alert("系统提示", "请选择您要删除的成绩基本信息!"); // return; // } // var schoolyearID = $("#hid_SchoolyearID").val(); // var coursematerialID = $("#hid_CoursematerialID").val(); // var userID = $("#hid_UserID").val(); // var starttermID = $("#hid_StarttermID").val(); // $.messager.confirm("系统提示", "您确定要删除该成绩基本信息?", function (r) { // if (r) { // $.post(CMS_SystemConfig.VirtualDirectoryPath + '/PersonalScore/Delete', { submitedScoreIDs: d, schoolyearID: schoolyearID, coursematerialID: coursematerialID, starttermID: starttermID, userID: userID }, function (data) { // if (data == "删除成功") { // $.messager.alert("系统提示", "删除成功!"); // $("#dgCourseScheduleSettingList").cmsXDataTable("load", { CoursematerialID: coursematerialID, SchoolyearID: schoolyearID, UserID: userID }); // reload(); //load页面 // } else { // $.messager.alert("系统提示", data); // } // }); // } // }); var d = validChoose().join(','); if (d == "") { $.messager.alert("系统提示", "请选择您要删除的学生成绩信息!"); return; } var schoolyearID = $("#hid_SchoolyearID").val(); var coursematerialID = $("#hid_CoursematerialID").val(); var userID = $("#hid_UserID").val(); var starttermID = $("#hid_StarttermID").val(); $.messager.confirm("系统提示", "您确定要删除该学生成绩信息?", function (r) { if (r) { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/StudentScore/Delete', { submitedScoreIDs: d }, function (data) { if (data == "删除成功") { $.messager.alert("系统提示", "删除成功!"); $("#dgCourseScheduleSettingList").cmsXDataTable("load", { CoursematerialID: coursematerialID, SchoolyearID: schoolyearID, UserID: userID }); reload(); //load页面 } else { $.messager.alert("系统提示", data); } }); } }); } function StudentScore_Report() { var UserID; if ($("#StudentsComboGrid").combogridX("getValue") != null && $("#StudentsComboGrid").combogridX("getValue") != "" && $("#StudentsComboGrid").combogridX("getValue") != nonSelect) UserID = $("#StudentsComboGrid").combogridX("getValue"); else if ($("#StudentsByNameComboGrid").combogridX("getValue") != null && $("#StudentsByNameComboGrid").combogridX("getValue") != "" && $("#StudentsByNameComboGrid").combogridX("getValue") != nonSelect) UserID = $("#StudentsByNameComboGrid").combogridX("getValue"); if (UserID == null) { $.messager.alert("系统提示", "请选择要查看成绩报表的学生学号或者姓名。"); return; } // if (($("#StudentsComboGrid").combogridX("getValue") == null || $("#StudentsComboGrid").combogridX("getValue") == "") && ($("#StudentsByNameComboGrid").combogridX("getValue") == null || $("#StudentsByNameComboGrid").combogridX("getValue")=="")) { // $.messager.alert("系统提示", "请选择要查看成绩报表的学生学号或者姓名。"); // return; // } var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/PersonalScore/StudentScoreReport?UserID=" + UserID; //$.System.addTab('学生个人成绩报表', redirectTo, 'StudentScore', false); //addTab('学生个人成绩报表', redirectTo); $.popupTopWindow('学生个人成绩报表', redirectTo, 850, 550, null, null); //var redirectTo = '/StudentScore/StudentScoreReport?MNU=' + "" + "&CollegeID=" //+ "&Years=&GrademajorID=&ClassmajorID=&Attribute=LoginID&Condition==&Value=" + $("#LoginID").val(); //$.popupTopWindow('学生个人成绩报表', redirectTo, 1100, 550, null, null); } function addTab(title, url) { if ($('#index_center').tabs('exists', title)) { $('#index_center').tabs('select', title); } else { var content = ''; $('#index_center').tabs('add', { title: title, content: content, closable: true }); } } //列表字体颜色设置为红色 function SetRedColumn(index, row, value) { return " " + value + ""; }