var url = CMS_SystemConfig.VirtualDirectoryPath + "/Score/Edit"; var customerUrl = $(CMS_SystemConfig.GetConfig()).find("configuration>customUrls>add[key='Score']"); if (customerUrl.attr("value")) { url = CMS_SystemConfig.VirtualDirectoryPath + customerUrl.attr("value"); } var mnu = ""; var isFirstLoadBuilding = true; //加载 $(function () { mnu = $.SystemGeneral.getUrlParam("MNU"); }) function reload() { $("#dgScoreList").cmsXDataTable("load", $.getDataGridParams("dgScoreList")); } //获取选中的数据 function validChoose() { var d = []; $.each($("#dgScoreList").cmsXDataTable("getSelections"), function (index) { d.push(this.FinalExaminationID); }); return d; } function validChooseStatus() { var d = []; $.each($("#dgScoreList").cmsXDataTable("getSelections"), function (index) { d.push(this.ApprovalStatusName); }); return d; } function ApprovalStatus() { var d = 0; $.each($("#dgScoreList").cmsXDataTable("getSelections"), function (index) { d = this.ApprovalStatus; }); return d; } function StudentCount() { var d = 0; $.each($("#dgScoreList").cmsXDataTable("getSelections"), function (index) { d = this.StudentCount; }); return d; } //点击列表更新 function edit(rowindex, rowdata) { var username = $("#hid_UserName").val(); if (username != rowdata.CreatorUserName) { $.messager.alert("系统提示", "对不起,您没权限进行成绩录入。"); return; } if (rowdata.EntryDeadlineTime != null) { var dt1 = new Date(); var dtime = new Date(dt1.getFullYear(), dt1.getMonth(), dt1.getDate()); var dt2 = getDate(rowdata.EntryDeadlineTime); if (dtime > dt2) { $.messager.alert("系统提示", "对不起,该成绩已超过录入截止时间,不能进行录入操作。"); return; } } var redirectTo = url + "?finalExaminationID=" + rowdata.FinalExaminationID + "&MNU=" + mnu; var windowDiv = $.popupTopWindow('成绩录入信息', redirectTo, window.screen.availWidth-200, window.screen.availHeight - 200, scoreEditClosed); var isWindowCanClose = false; windowDiv.panel({ onBeforeClose: function () { if (!isWindowCanClose) { if (windowDiv.find('iframe')[0].contentWindow.isWindowCanClose) { isWindowCanClose = true; windowDiv.dialog("close"); } else { windowDiv.find('iframe')[0].contentWindow.$.messager.confirm("系统提示", "数据并未保存,是否需要退出?", function (r) { if (r) { isWindowCanClose = true; windowDiv.dialog("close"); } }); } } return isWindowCanClose; } }); } function scoreEditClosed() { top.clearInterval(top.ScoreEditSetInterval); reload(); } function SelectCollegeComboGrid() { var collegeID = $("#CollegeComboGrid").combogridX("getValue"); if (collegeID != nonSelect) { var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + collegeID + "|@|'})"; $("#DepartmentComboGrid").combogridX("reload", eval(jsonString)); } reload(); } //学生成绩录入名单 function StudentList(rowindex, rowdata) { var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/FinalExamination/StudentList?finalExaminationID=" + rowdata.FinalExaminationID + "&MNU=" + mnu; $.popupTopWindow('学生成绩录入名单', redirectTo, 850, 480, null, null); } function Score_Excel() { $("#formQuery").submit(); } function editDetails(rowindex, rowdata) { var redirectTo = url + "?finalExaminationID=" + rowdata.FinalExaminationID + "&Isdisplay=false&MNU=" + mnu; $.popupTopWindow('成绩录入信息', redirectTo, window.screen.availWidth-200, window.screen.availHeight -200, null, null); } function Score_Rebut(rowrindex, rowdata) { var username = $("#hid_UserName").val(); var CreatorUserName = []; $.each($("#dgScoreList").cmsXDataTable("getSelections"), function (index) { CreatorUserName.push(this.CreatorUserName); }); var ApprovalEndStatus = []; $.each($("#dgScoreList").cmsXDataTable("getSelections"), function (index) { ApprovalEndStatus.push(this.ApprovalEndStatus); }); var ApprovalStatus = []; $.each($("#dgScoreList").cmsXDataTable("getSelections"), function (index) { ApprovalStatus.push(this.ApprovalStatus); }); var d = validChoose(); if (d.length == 0) { $.messager.alert("系统提示", "请选择您要申请重录的信息。"); return; } else if (d.length > 1) { $.messager.alert("系统提示", "只能对单个信息进行申请重录。"); return; } for (var i = 0; i < CreatorUserName.length; i++) { if (CreatorUserName[i] != "") { if (CreatorUserName[i] != username) { $.messager.alert("系统提示", "对不起,您没权限进行申请重录!"); return; } } } for (var i = 0; i < ApprovalEndStatus.length; i++) { if (ApprovalEndStatus[i] != "") { if (ApprovalEndStatus[i] != ApprovalStatus[i]) { $.messager.alert("系统提示", "只能对已通过状态的信息进行申请重录。"); return; } } } // if (username != CreatorUserName) { // $.messager.alert("系统提示", "对不起,您没权限进行申请重录!"); // return; // } // if (validChooseStatus() != ApprovalEndStatus) { // $.messager.alert("系统提示", "只能对审核通过数据进行操作!"); // return; // } // if (validChooseStatus() != "已审核") { // $.messager.alert("系统提示", "只能对已通过状态的信息进行申请重录。"); // return; // } var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/Score/RebutSubmit" + "?finalExaminationID=" + d + "&MNU=" + mnu; $.popupTopWindow('成绩录入信息', redirectTo, window.screen.availWidth, window.screen.availHeight - 60, null, null); } function Score_Report() { var d = validChoose(); if (d == "") { $.messager.alert("系统提示", "请选择您要查看的成绩录入信息。"); return; } if (d.length > 1) { $.messager.alert("系统提示", "只能选择单个成绩录入信息。"); return; } var status = validChooseStatus(); if (status != "已通过" && status != "待审核" && status != "重录待审") { $.messager.alert("系统提示", "只能查看" + "已通过、待审核、重录待审" + "的学生课程成绩报表"); return; } var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/Score/Report?FinalExaminationID=" + d + "&MNU=" + mnu; $.popupTopWindow('学生课程成绩报表', redirectTo, 800, 600, null, null); } function Score_GroupReport() { var d = validChoose(); if (d == "") { $.messager.alert("系统提示", "请选择您要查看的成绩录入信息。"); return; } if (d.length > 1) { $.messager.alert("系统提示", "只能选择单个成绩录入信息。"); return; } var status = validChooseStatus(); if (status != "已通过") { $.messager.alert("系统提示", "只能查看\"已通过\"的学生课程成绩报表"); return; } var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/Score/ScoreReport?FinalExaminationID=" + d + "&MNU=" + mnu; $.popupTopWindow('学生课程成绩报表', redirectTo, 800, 600, null, null); } function Score_GroupReportHBKD() { var d = validChoose(); if (d == "") { $.messager.alert("系统提示", "请选择您要查看的成绩录入信息。"); return; } if (d.length > 1) { $.messager.alert("系统提示", "只能选择单个成绩录入信息。"); return; } var status = validChooseStatus(); if (status != "已通过") { $.messager.alert("系统提示", "只能查看\"已通过\"的学生课程成绩报表"); return; } var redirectTo = CMS_SystemConfig.ReportPagePath + "?ReportFolder=%2fEducationResult%2fHBKDStudentScoreView&FinalExaminationID_RAP=" + d; $.popupTopWindowOutsite('学生课程成绩报表', redirectTo, 800, 600, null, null); } function Score_GroupReportHBGD() { var d = validChoose(); if (d == "") { $.messager.alert("系统提示", "请选择您要查看的成绩录入信息。"); return; } if (d.length > 1) { $.messager.alert("系统提示", "只能选择单个成绩录入信息。"); return; } var status = validChooseStatus(); if (status != "已通过") { $.messager.alert("系统提示", "只能查看\"已通过\"的学生课程成绩报表"); return; } var redirectTo = CMS_SystemConfig.ReportPagePath + "?ReportFolder=%2fEducationResult%2fHBGDStudentScoreView&FinalExaminationID_RAP=" + d; $.popupTopWindowOutsite('学生课程成绩报表', redirectTo, 800, 600, null, null); } function checkBox() { var jsonString = "({'QueryParamsDatas':'IsCheck|*|" + document.getElementById("isCheck").checked + "|@|'})"; reload(); } //字符串转时间格式 function getDate(strDate) { var date = eval('new Date(' + strDate.replace(/\d+(?=-[^-]+$)/, function (a) { return parseInt(a, 10) - 1; }).match(/\d+/g) + ')'); return date; } //添加学生 function FinalExamination_AddStudent() { var d = validChoose(); var status = ApprovalStatus(); if (d == "") { $.messager.alert("系统提示", "请选择您要增加学生的信息。"); return; } if (d.length > 1) { $.messager.alert("系统提示", "只能选择单个记录。"); return; } if (status == "1" || status == "3" || status == "5") { var redirectTo = "/FinalExamination/StudentEdit?finalExamination=" + d + "&MNU=" + mnu; $.popupTopWindow('学生名单', redirectTo, 850, 480, reload); } else { $.messager.alert("系统提示", "该数据已经提交或已审核,不能添加学生!"); return; } } function GZMSScore_Report() { var d = validChoose().join(','); if (d == "") { $.messager.alert("系统提示", "请选择您要打印成绩单的录入信息。"); return; } $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/Score/StudentResult', { finalExaminationIDList: d }, function (data) { if (data.IsSuccess) { var redirectTo = "../../Scripts/pdf.js/web/viewer.html?file=" + data.Message; $.popupTopWindow('成绩单', redirectTo, 850, 480, reload); } else { $.messager.alert("系统提示", data); } }); }