var mnu = ""; var atype = ""; //加载 $(function () { mnu = $.SystemGeneral.getUrlParam("MNU"); atype = $.SystemGeneral.getUrlParam("aType"); }) function FinalExamination_Save() { $(document.forms[0]).submit(); } //获取选中的数据 function validChoose() { var d = []; $.each($("#dgStudentList").cmsXDataTable("getSelections"), function (index) { d.push(this); }); return d; } //弹出添加学生页面 function FinalExamination_SettingsAdd() { $.popupTopWindow('添加学生', CMS_SystemConfig.VirtualDirectoryPath + '/Common/StudentViewSelect?FromMNU=' + mnu + '&ClassmajorID=' + $("#ClassmajorID").combogridX('getValue'), 650, 480, AddStudent_Confirm); } //确定 function AddStudent_Confirm(studentList) { if (studentList == undefined) return; var studentViewList = $("#dgStudentList").cmsXDataTable("getRows"); $.each(studentList, function (index, value) { if ($.grep(studentViewList, function (row, index) { return value.UserID == studentViewList.UserID; }).length == 0) { studentViewList.push({ UserID: value.UserID, LoginID: value.LoginID, UserName: value.UserName, SexName: value.SexName, ClassmajorName: value.ClassmajorName, StudentStatusName: value.StudentStatusName, InSchoolStatusName: value.InSchoolStatusName }); } }); $("#dgStudentList").cmsXDataTable("loadData", { rows: studentViewList, total: studentViewList.length }); } //弹出添加班级页面 function FinalExamination_ClassmajorAdd() { var CollegeID = $("#CollegeID").combogridX('getValue'); var GradeYearID = $("#GradeYearID").combobox('getValue'); var StandardID = $("#StandardID").combogridX('getValue'); $.popupTopWindow('添加班级', CMS_SystemConfig.VirtualDirectoryPath + '/Common/ClassmajorViewSelect?FromMNU=' + mnu + '&CollegeID=' + CollegeID + '&GradeYearID=' + GradeYearID + '&StandardID=' + StandardID, 600, 480, AddClassmajor_Confirm); } function AddClassmajor_Confirm(ClassmajorList) { if (ClassmajorList == undefined) return; var className = ""; var id = ""; var name = ""; $.each(ClassmajorList, function (index, value) { className += value.Name + ","; id += value.ClassmajorID + ","; }); if (className != "" && id != "") { className = className.toString().substring(0, className.lastIndexOf(',')); id = id.toString().substring(0, id.lastIndexOf(',')); } document.getElementById("ClassmajorName").value = className; document.getElementById("ClassID").value = id; if (atype != "update") { if ($("#CoursematerialID").combogridX("getText") != "请选择") name = $("#CoursematerialID").combogridX("getText"); if (className != "") { var cName = className.split(","); name += "-" + cName[0]; } if ($("#ExamsCategoryID").combobox("getText") != "请选择") name += "-" + $("#ExamsCategoryID").combobox("getText"); $("#ClassName").val(name); } if ($("#CoursematerialID").combogridX("getValue") != "" && $("#CoursematerialID").combogridX("getValue") != "-1") { var CoursematerialID = $("#CoursematerialID").combogridX("getValue"); var cID = id.split(","); QueryDepartment(CoursematerialID, cID[0]); } } //删除学生 function FinalExamination_SettingsDelete() { var d = validChoose(); var studentViewList = $("#dgStudentList").cmsXDataTable("getRows"); var i, j; var len = studentViewList.length; for (i = len - 1; i >= 0; i--) { for (j = 0; j < d.length; j++) { if (studentViewList[i].UserID == d[j].UserID) { studentViewList.splice(i, 1); break; } } } $("#dgStudentList").cmsXDataTable("loadData", { rows: studentViewList, total: studentViewList.length }); } function queryClass(data) { if ($("#GradeYearID").length > 0 && $.data($("#GradeYearID")[0], "combobox") && $("#CollegeID").length > 0 && $.data($("#CollegeID")[0], "combogridX") && $("#ClassmajorID").length > 0 && $.data($("#ClassmajorID")[0], "combogridX")) { var gradeYearID = $("#GradeYearID").combobox("getValue"); var collegeID = $("#CollegeID").combogridX("getValue"); var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + collegeID + "|@|DictionaryGrade|*|" + gradeYearID + "|@|'})"; $("#ClassmajorID").combogridX("reload", eval(jsonString)); } } function QueryCollegeComboGridList(data) { var collegeID = $("#CollegeID").combogridX("getValue"); var yearID = document.getElementsByName("GradeYearID")[0].value; var parameterString = ""; $("#StandardID").combogridX("setValue", "-1"); if (collegeID != nonSelect) { parameterString += "CollegeDropdown|*|" + collegeID + "|@|"; } var schoolyearID = $("#GradeYearID").combobox("getValue"); if (schoolyearID != nonSelect) { parameterString += "DictionaryGrade|*|" + schoolyearID + "|@|"; } if (parameterString != "") { jsonString = "({'QueryParamsDatas':'" + parameterString + "'})"; $("#StandardID").combogridX("reload", eval(jsonString)); } else { $("#StandardID").combogridX("reload"); } } function selectCollege(data) { queryClass(data); } function selectGrade(data) { queryClass(data); } function QueryComboGridCourse(data) { if (atype != "update") { var name = data.CourseName; if (document.getElementById("ClassmajorName").value != "") { var className = document.getElementById("ClassmajorName").value; var cName = className.split(","); name += "-" + cName[0]; } if ($("#ExamsCategoryID").combobox("getText") != "请选择") name += "-" + $("#ExamsCategoryID").combobox("getText"); $("#ClassName").val(name); } var id = data.CoursematerialID; if (document.getElementById("ClassmajorName").value != "") { var classID = document.getElementById("ClassID").value; var cID = classID.split(","); QueryDepartment(id, cID[0]); } } function QueryComboGridClassmajor(data) { if (atype != "update") { var name = ""; if ($("#CoursematerialID").combogridX("getText") != "请选择") name = $("#CoursematerialID").combogridX("getText"); if (data.Name != "请选择") name += "-" + $("#ClassmajorID").combogridX("getText"); if ($("#ExamsCategoryID").combobox("getText") != "请选择") name += "-" + $("#ExamsCategoryID").combobox("getText"); $("#ClassName").val(name); } } function QueryExamsCategory(data) { if (atype != "update") { var name = ""; if ($("#CoursematerialID").combogridX("getText") != "请选择" && $("#CoursematerialID").combogridX("getText") != undefined) name = $("#CoursematerialID").combogridX("getText"); if (document.getElementById("ClassmajorName").value != "") { className = document.getElementById("ClassmajorName").value; var cName = className.split(","); name += "-" + cName[0]; } if (data.Text != "请选择") name += "-" + data.Text; $("#ExamsCategoryID").val(data.Text); $("#ClassName").val(name); } } function QueryDepartment(CoursematerialID, ClassmajorID) { var depatrmentId = ""; $.post('/Department/ListForExamination', { CoursematerialID: CoursematerialID, ClassmajorID: ClassmajorID }, function (data) { if (data != "") { $("#DepartmentID").combogridX("setValue", data); } }); }