var mnu = ""; //加载 $(function () { mnu = $.SystemGeneral.getUrlParam("MNU"); }) //加载列表 function reload() { $("#dgTeacherList").cmsXDataTable("load", $.getDataGridParams("dgTeacherList")); } //获取选中的数据 function validChoose() { var d = []; $.each($("#dgTeacherList").cmsXDataTable("getSelections"), function (index) { d.push(this); }); return d; } //添加教师 function EducationMissionClass_TeacherAdd() { $.popupTopWindow('教师信息', CMS_SystemConfig.VirtualDirectoryPath + '/EducationMissionClass/TeacherSelect?FromMNU=' + mnu, 900, 500, AddTeachers_Confirm); } function AddTeachers_Confirm(teacherList) { if (!teacherList) return; var teacherViewList = $("#dgTeacherList").cmsXDataTable("getRows"); $.each(teacherList, function (index, value) { if ($.grep(teacherViewList, function (row, index) { return value.UserID == row.UserID; }).length == 0) { teacherViewList.push({ FreeSelectionCourseApplyID: $("#FreeSelectionCouseApplyID").val(), UserID: value.UserID, LoginID: value.StaffCode, Name: value.Name, CollegeID: value.CollegeID, CollegeName: value.CollegeName, BirthDate: value.BirthDate, TeacherType: value.TeacherType, TeacherTypeName: value.TeacherTypeName, IncumbencyState: value.IncumbencyState, IncumbencyStateName: value.IncumbencyStateName, Title: value.Title, TitleName: value.TitleName, TeachingMethod: 0, //默認选取的数据为主讲课 TeachingMethodDesc: null, SexName: value.SexName, DepartmentName: value.DepartmentName, DepartmentID: value.DepartmentID }); } }); $("#dgTeacherList").cmsXDataTable("loadData", { rows: teacherViewList, total: teacherViewList.length }); } //删除教师 function EducationMissionClass_TeacherDelete() { var d = validChoose(); var teacherViewList = $("#dgTeacherList").cmsXDataTable("getRows"); var i, j; var len = teacherViewList.length; for (i = len - 1; i >= 0; i--) { for (j = 0; j < d.length; j++) { if (teacherViewList[i].UserID == d[j].UserID) { teacherViewList.splice(i, 1); break; } } } $("#dgTeacherList").cmsXDataTable("loadData", { rows: teacherViewList, total: teacherViewList.length }); } function success(data) { $.messager.alert('系统信息', data.Message); if (data.IsSuccess) { top.$('#sysWindow').window('close'); var tab = top.$('#index_center_tabs').tabs('getSelected'); tab.panel('refresh'); } } function loadClassroom() { var roomUseID = $("#ClassroomTypeID").combobox("getValue"); var collegeID = $("#CollegeID").val(); if (roomUseID == nonSelect) { roomUseID = "null" } var jsonString = "({'QueryParamsDatas':'ClassroomType|*|" + roomUseID + "|@|CollegeID|*|" + collegeID + "|@|IsSpecialDictionaryDropDown|*|" + 1 + "|@|lodaType|*|" + 1 + "|@|'})"; // CMSFunction.ComboGrid.SetValue($("#ClassroomID"), "", ""); $("#ClassroomID").combogridX("reload", eval(jsonString)); //reload(); } function queryClassroom() { var roomUseID = $("#ClassroomTypeID").combobox("getValue"); var collegeID = $("#CollegeID").val(); if (roomUseID == nonSelect) { roomUseID = "null" } CMSFunction.ComboGrid.SetValue($("#ClassroomID"), "", ""); //重新选择教室类型、清空教室 var jsonString = "({'QueryParamsDatas':'ClassroomType|*|" + roomUseID + "|@|IsSpecialDictionaryDropDown|*|" + 1 + "|@|lodaType|*|" + 1 + "|@|'})"; // CMSFunction.ComboGrid.SetValue($("#ClassroomID"), "", ""); $("#ClassroomID").combogridX("reload", eval(jsonString)); //reload(); } function EducationMissionClass_EditSave() { var teacherViewList = $("#dgTeacherList").cmsXDataTable("getRows"); for (var i = 0; i < teacherViewList.length; i++) { if (teacherViewList[i].TeachingMethod == null || teacherViewList[i].TeachingMethod == -1) { $.messager.alert('系统信息', "请选择授课老师的任课方式!"); return; } } var classNum = $("#ClassNum").val(); $("#ClassNums").val(classNum); $(document.forms[0]).submit(); } //获取选中的数据 function validChoosTeacher() { var d = []; $.each($("#dgTeacherList").cmsXDataTable("getSelections"), function (index) { d.push(this); }); return d; } //教师科表预览 function Preview(rowindex, rowdata) { var schoolYearID = $("#SchoolyearID").val() //var fullUrl = CMS_SystemConfig.VirtualDirectoryPath + '/EducationSchedulingReport/TeacherReport?userID=' + rowdata.UserID + '&schoolyearID=' + schoolYearID; //$.popupTopWindow('教师课表预览', fullUrl, window.screen.availWidth, window.screen.availHeight - 60); var fullUrl = CMS_SystemConfig.ReportPagePath + "?ReportFolder=%2fEducationScheduling%2fTeacherSchedulingView&CollegeID_RAP=&UserID_RAP=" + rowdata.UserID + "&SchoolyearID_RAP=" + schoolYearID; $.popupTopWindowOutsite('教师课表', fullUrl, 1024, 600); } function EducationMissionClass_SetTeacherSave() { var d = validChoosTeacher(); //if (d.length == 0) { // $.messager.alert("提示", "请选择您要设置的教师!"); // return; //} var teacherViewList = $("#dgTeacherList").cmsXDataTable("getRows"); for (var i = 0; i < teacherViewList.length; i++) { if (teacherViewList[i].TeachingMethod == null || teacherViewList[i].TeachingMethod == -1) { $.messager.alert('系统信息', "请选择授课老师的任课方式!"); return; } } var teacherJsonStr = JSON.stringify(d); $("#hid_TeacherJsonStr").val(teacherJsonStr); //将json赋值给隐藏域 $(document.forms[0]).submit(); //提交Form表单 }