123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354 |
- var url = CMS_SystemConfig.VirtualDirectoryPath + "/PersonalScore/Edit";
- var mnu = "";
- //加载
- $(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");
- $.post(CMS_SystemConfig.VirtualDirectoryPath + '/PersonalScore/CoursematerialList', { 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 = "<div id='divScroll' style='width: " + a + "%'>";
- 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 += "<table cellpadding='0' cellspacing='0' style='width: " + width + "; margin-bottom: 5px; float:left;' class='Coursematerialtable'>";
- html += "<tr>";
- html += "<td align='center' colspan='3' style='background-color: #F0F0F0'>" + listCourseGradeView[0].StarttermName + "</td>";
- html += "</tr>";
- html += "<tr>";
- html += "<td align='center' style='background-color: #F0F0F0'>课程名称</td>";
- html += "<td align='center' style='background-color: #F0F0F0'>总成绩</td>";
- html += "<td align='center' style='background-color: #F0F0F0'>学分</td>";
- html += "</tr>";
- for (var j = 0; j < listCourseGradeView.length; j++) {
- var color = "'" + listCourseGradeView[j].CourseTypeColour + "'"
- html += "<tr>";
- if (listCourseGradeView[j].Club == null)
- {
- html += "<td style='background-color:" + listCourseGradeView[j].CourseTypeColour + "'" + " align=\"center\"><a href=\"#this\" onclick=\"return LoadScore('" + listCourseGradeView[j].CoursematerialID + "','" + listCourseGradeView[j].SchoolyearID + "','" + listCourseGradeView[j].UserID + "','" + data[0].ListStarttermID[i] + "');\"><font color=blue>" + listCourseGradeView[j].CourseName + "</font></a></td>";
- } else
- {
- html += "<td style='background-color:#32CD32' align=\"center\"><a href=\"#this\" onclick=\"return LoadScore('" + listCourseGradeView[j].CoursematerialID + "','" + listCourseGradeView[j].SchoolyearID + "','" + listCourseGradeView[j].UserID + "','" + data[0].ListStarttermID[i] + "');\"><font color=blue>" + listCourseGradeView[j].CourseName + "</font></a></td>";
- }
- if (listCourseGradeView[j].TotalScore < 60 || listCourseGradeView[j].TotalScore == "")
- html += "<td align='center' style='color:Red'>" + listCourseGradeView[j].TotalScoreStr + "</td>";
- else
- html += "<td align='center' >" + listCourseGradeView[j].TotalScoreStr + "</td>";
- html += "<td align='center'>" + isEmpty(listCourseGradeView[j].ScoreCredit) + "</td>";
- html += "</tr>";
- }
- html += "</table>";
- }
- html += "</div>";
- $("#search_list").html(html);
- }
- else {
- StudentCoursematerialtable(data[0]);
- var html = " <p style='color:Red;'>选择的学生成绩库中无成绩,请检查。</p>"
- $("#search_list").html(html);
- }
- });
- }
- function reloadBack() {
- $("#display_search_list").css('display', 'none');
- var userID = $("#StudentsComboGrid").combogridX("getValue");
- $.post(CMS_SystemConfig.VirtualDirectoryPath + '/PersonalScore/CoursematerialList', { 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 = "<div id='divScroll' style='width: " + a + "%'>";
- 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 += "<table cellpadding='0' cellspacing='0' style='width: " + width + "; margin-bottom: 5px; float:left;' class='Coursematerialtable'>";
- html += "<tr>";
- html += "<td align='center' colspan='3' style='background-color: #F0F0F0'>" + listCourseGradeView[0].StarttermName + "</td>";
- html += "</tr>";
- html += "<tr>";
- html += "<td align='center' style='background-color: #F0F0F0'>课程名称</td>";
- html += "<td align='center' style='background-color: #F0F0F0'>总成绩</td>";
- html += "<td align='center' style='background-color: #F0F0F0'>学分</td>";
- html += "</tr>";
- for (var j = 0; j < listCourseGradeView.length; j++) {
- var color = "'" + listCourseGradeView[j].CourseTypeColour + "'"
- html += "<tr>";
- if (listCourseGradeView[j].Club == null) {
- html += "<td style='background-color:" + listCourseGradeView[j].CourseTypeColour + "'" + " align=\"center\"><a href=\"#this\" onclick=\"return LoadScore('" + listCourseGradeView[j].CoursematerialID + "','" + listCourseGradeView[j].SchoolyearID + "','" + listCourseGradeView[j].UserID + "','" + data[0].ListStarttermID[i] + "');\"><font color=blue>" + listCourseGradeView[j].CourseName + "</font></a></td>";
- } else {
- html += "<td style='background-color:#32CD32' align=\"center\"><a href=\"#this\" onclick=\"return LoadScore('" + listCourseGradeView[j].CoursematerialID + "','" + listCourseGradeView[j].SchoolyearID + "','" + listCourseGradeView[j].UserID + "','" + data[0].ListStarttermID[i] + "');\"><font color=blue>" + listCourseGradeView[j].CourseName + "</font></a></td>";
- }
- if (listCourseGradeView[j].TotalScore < 60 || listCourseGradeView[j].TotalScore == "")
- html += "<td align='center' style='color:Red'>" + listCourseGradeView[j].TotalScoreStr + "</td>";
- else
- html += "<td align='center' >" + listCourseGradeView[j].TotalScoreStr + "</td>";
- html += "<td align='center'>" + isEmpty(listCourseGradeView[j].ScoreCredit) + "</td>";
- html += "</tr>";
- }
- html += "</table>";
- }
- html += "</div>";
- $("#search_list").html(html);
- }
- else {
- StudentCoursematerialtable(data[0]);
- var html = " <p style='color:Red;'>请选择您要查看成绩的学生学号。</p>"
- $("#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 += "<label><b>姓名:</b></label>";
- html += " <label><b>" + data.UserName + "</b></label>";
- html += "  <label><b>院系所:</b></label>";
- html += " <label><b>" + data.CollegeName + "</b></label>";
- html += "  <label><b>班级名称:</b></label>";
- html += " <label><b>" + data.ClassName + "</b></label>";
- html += "  <label><b>毕业时间:</b></label>";
- html += "<label><b>" + (data.PlanningGraduateDate == null ? "" : ChangeDateFormat(data.PlanningGraduateDate)) + "</b></label>";
- var html1 = "";
- html1 += "<label><b>门数:</b></label>";
- html1 += " <label><b>" + data.CoursematerialCount + "</b></label>";
- html1 += "  <label'><b>平均成绩:</b></label>";
- html1 += " <label><b>" + (data.AVGScore == null ? 0 : data.AVGScore.toFixed(1)) + "</b></label>";
- html1 += "  <label><b>总学分:</b></label>";
- html1 += " <label><b>" + (data.TotalCredit == null ? 0 : data.TotalCredit.toFixed(1)) + "</b></label>";
-
- // html += "<tr>";
- // html += "<td style='background-color: #F0F0F0; '>姓   名</td>";
- // html += "<td>" + data.UserName + "</td>";
- // html += "<td style='background-color: #F0F0F0'>院系</td>";
- // html += "<td>" + data.CollegeName + "</td>";
- // html += "<td style='background-color: #F0F0F0'>班   级</td>";
- // html += "<td>" + data.ClassName + "</td>";
- // html += "</tr>";
- // html += "<tr>";
- // html += "<td style='background-color: #F0F0F0'>毕业时间</td>";
- // html += "<td>" + (data.PlanningGraduateDate == null ? "" : ChangeDateFormat(data.PlanningGraduateDate)) + "</td>";
- // html += "<td style='background-color: #F0F0F0'>门数</td>";
- // html += "<td>" + data.CoursematerialCount + "</td>";
- // html += "<td style='background-color: #F0F0F0'>平均成绩</td>";
- // html += "<td>" + (data.AVGScore == null ? 0 : data.AVGScore.toFixed(1)) + "</td>";
- // html += "</tr>";
- // html += "<tr>";
- // html += "<td style='background-color: #F0F0F0'>总 学 分</td>";
- // html += "<td>" + (data.TotalCredit == null ? 0 : data.TotalCredit.toFixed(1)) + "</td>";
- // html += "<td style='background-color: #F0F0F0'></td>";
- // html += "<td></td>";
- // html += "<td style='background-color: #F0F0F0'></td>";
- // html += "<td></td>";
- // html += "</tr>";
- $("#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, null, null);
- } 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 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) {
- $.post(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() {
- if ($("#StudentsComboGrid").combogridX("getValue") == null || $("#StudentsComboGrid").combogridX("getValue") == "" || $("#StudentsComboGrid").combogridX("getText") == "") {
- $.messager.alert("系统提示", "请选择要查看成绩报表的学生学号。");
- return;
- }
- var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/PersonalScore/StudentScoreReport?LoginID=" + $("#StudentsComboGrid").combogridX("getText")+"&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 = '<iframe scrolling="auto" frameborder="0" src="' + url + '" style="width:100%;height:100%;"></iframe>';
- $('#index_center').tabs('add', {
- title: title,
- content: content,
- closable: true
- });
- }
- }
- //列表字体颜色设置为红色
- function SetRedColumn(index, row, value) {
- return " <span style=\"color: red;\">" + value + "</span>";
- }
|