var url = CMS_SystemConfig.VirtualDirectoryPath + "/ResitExamination/Edit"; var mnu = ""; var isFirstLoadBuilding = true; //加载 $(function () { mnu = $.SystemGeneral.getUrlParam("MNU"); }) //补考设定导出 function ResitExamination_Export() { var d = validChoose().join(',') if (d != "") { document.getElementById("FinalExaminationID").value = d; } else { document.getElementById("FinalExaminationID").value = ""; } $("#formQuery").attr("action", CMS_SystemConfig.VirtualDirectoryPath + "/ResitExamination/Excel"); $("#formQuery").submit(); } //补考汇总名单导出 function ResitExaminationStudentDetails_Export() { var d = validChoose().join(',') if (d != "") { document.getElementById("FinalExaminationID").value = d; } else { document.getElementById("FinalExaminationID").value = ""; } $("#formQuery").attr("action", CMS_SystemConfig.VirtualDirectoryPath + "/ResitExamination/StudentDetails_Excel"); $("#formQuery").submit(); } //新增 function ResitExamination_Add() { var d = validChoose(); var redirectTo = url + "?finalExamination=" + d + "&MNU=" + mnu + "&aType=add"; if (d == "") { redirectTo = url + "?MNU=" + mnu + "&aType=add"; } if (d.length > 1) { $.messager.alert("系统提示", "只能选择单个记录进行复制新增。"); return; } $.popupTopWindow('补考设定新增', redirectTo, 750, 420, reload); } function reload() { $("#dgResitExaminationList").cmsXDataTable("load", $.getDataGridParams("dgResitExaminationList")); } //获取选中的数据 function validChoose() { var d = []; $.each($("#dgResitExaminationList").cmsXDataTable("getSelections"), function (index) { d.push(this.FinalExaminationID); }); return d; } function StudentCount() { var d = 0; $.each($("#dgResitExaminationList").cmsXDataTable("getSelections"), function (index) { d = this.StudentCount; }); return d; } function ApprovalStatusName() { var d = []; $.each($("#dgResitExaminationList").cmsXDataTable("getSelections"), function (index) { d.push(this.ApprovalStatusName); }); return d; } function ApprovalStatus() { var d = 0; $.each($("#dgResitExaminationList").cmsXDataTable("getSelections"), function (index) { d = this.ApprovalStatus; }); return d; } //明细 function edit(rowindex, rowdata) { var redirectTo = url + "?finalExamination=" + rowdata.FinalExaminationID + "&MNU=" + mnu + "&aType=update&isView=1"; $.popupTopWindow('补考设定信息', redirectTo, 750, 420, null, null); } //修改按钮 function ResitExamination_Update() { var d = validChoose(); if (d == "") { $.messager.alert("系统提示", "请选择您要修改的信息。"); return; } if (d.length > 1) { $.messager.alert("系统提示", "只能选择单个记录进行修改。"); return; } var redirectTo = url + "?finalExamination=" + d + "&MNU=" + mnu + "&aType=update"; $.popupTopWindow('补考设定修改', redirectTo, 750, 420, null, null); } //删除 function ResitExamination_Delete() { var d = validChoose().join(','); var count = StudentCount(); var statusName = ApprovalStatusName(); if (d == "") { $.messager.alert("系统提示", "请选择您要删除的信息。"); return; } //if ($.grep(statusName, function (x) { return x != "未开放"; }).length > 0) { // if (count > 0) { // $.messager.alert("系统提示", "已录入学生信息,不能删除该补考设定!"); // return; // } //} $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) { if (r) { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ResitExamination/Delete', { finalExaminationIDs: d }, function (data) { if (data == "删除成功!") { $.messager.alert("系统提示", data); $("#dgResitExaminationList").cmsXDataTable('load'); } else { $.messager.alert("系统提示", data); } }); } }); } //期末生成 function ResitExamination_FinalGenerate() { var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/ResitExamination/GenerateFinalExaminationEdit?MNU=" + mnu; $.popupTopWindow('期末补考生成', redirectTo, 530, 300, null, null); } //毕业生成 function ResitExamination_Graduate() { var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/ResitExamination/GenerateResitExaminationEdit?MNU=" + mnu; $.popupTopWindow('毕业补考生成', redirectTo, 530, 300, null, null); } function SelectCollegeComboGrid() { var collegeID = $("#CollegeComboGrid").combogridX("getValue"); if (collegeID != nonSelect) { var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + collegeID + "|@|'})"; $("#DepartmentComboGrid").combogridX("reload", eval(jsonString)); } reload(); } //添加学生 function ResitExamination_AddStudent() { var d = validChoose(); var status = ApprovalStatus(); if (d == "") { $.messager.alert("系统提示", "请选择您要增加学生的信息。"); return; } if (d.length > 1) { $.messager.alert("系统提示", "只能选择单个记录进行修改。"); return; } //if (statusName == "已提交" || statusName == "已审核") { // $.messager.alert("系统提示", "该数据已经提交或已审核,不能添加学生!"); // return; //} if (status == "1" || status == "3" || status == "5") { var redirectTo = "/ResitExamination/StudentEdit?finalExamination=" + d + "&MNU=" + mnu; $.popupTopWindow('学生名单', redirectTo, 850, 480, reload); } else { $.messager.alert("系统提示", "该数据已经提交或已审核,不能添加学生!"); return; } } function AddStudent_Confirm(studentList) { var d = validChoose().join(','); var student = []; $.each(studentList, function (index, value) { student.push(value.UserID); }); var userIDs = student.join(','); $.post(CMS_SystemConfig.VirtualDirectoryPath + '/ResitExamination/ResitExaminationStudentAdd', { finalExaminationID: d, userIDs: userIDs }, function (data) { if (data == "保存成功。") { $.messager.alert("系统提示", data); $("#dgResitExaminationList").cmsXDataTable('load'); } else { $.messager.alert("系统提示", data); } }); } //学生成绩录入名单 function StudentList(rowindex, rowdata) { var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/ResitExamination/StudentList?finalExaminationID=" + rowdata.FinalExaminationID + "&MNU=" + mnu; $.popupTopWindow('学生成绩录入名单', redirectTo, 850, 480, null, null); } //允许录入 function ResitExamination_Input() { var d = validChoose().join(','); var dstate = ApprovalStatusName().join(','); if (d == "") { $.messager.alert("系统提示", "请选择您要允许录入的信息。"); return; } var selected = $("#dgResitExaminationList").cmsXDataTable("getSelections"); for (var i = 0; i < selected.length; i++) { if (selected[i].CreatorUserName == null) { $.messager.alert("系统提示", "录入人为空,无法进行允许录入,请设置。"); return; } } //for (var i = 0; i < dstate.split(',').length; i++) { // if (dstate.split(',')[i] != "未开放") { // $.messager.alert("系统提示", "只能操作未开放的数据!"); // return; // } //} $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/FinalExamination/Final_ResitExaminationIsEntry', { finalExaminationIDs: d }, function (data) { if (data == "允许录入成功。") { $.messager.alert("系统提示", data); $("#dgResitExaminationList").cmsXDataTable('load'); } else { $.messager.alert("系统提示", data); } }); } //取消录入 function ResitExamination_Cancel() { var d = validChoose().join(','); if (d == "") { $.messager.alert("系统提示", "请选择您要取消录入的信息。"); return; } $.messager.confirm("系统提示", "撤销开放后,若所选记录中存在已录入的成绩,系统将同步进行删除,是否确定撤销开放?", function (r) { if (r) { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/FinalExamination/Final_ResitExaminationBack', { finalExaminationIDs: d }, function (data) { if (data == "取消录入成功。") { $.messager.alert("系统提示", data); $("#dgResitExaminationList").cmsXDataTable('load'); } else { $.messager.alert("系统提示", data); } }); } }); }