var mnu = ""; var windowID = ""; //加载 $(function () { mnu = $.SystemGeneral.getUrlParam("MNU"); windowID = $.SystemGeneral.getUrlParam("WindowID"); }) //添加教师 function EducationScheduling_TeacherAdd() { $.popupTopWindow('教师信息', CMS_SystemConfig.VirtualDirectoryPath + '/Common/TeacherSelect?FromMNU=' + mnu, 770, 420, 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 EducationScheduling_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 validChoose() { var d = []; $.each($("#dgTeacherList").cmsXDataTable("getSelections"), function (index) { d.push(this); }); return d; } //教师课表预览 function Preview(rowindex, rowdata) { var schoolYearID = $.SystemGeneral.getUrlParam("SchoolYearID"); var fullUrl = CMS_SystemConfig.ReportPagePath + "?ReportFolder=%2fEducationScheduling%2fTeacherSchedulingView&CollegeID_RAP=&UserID_RAP=" + rowdata.UserID + "&SchoolyearID_RAP=" + schoolYearID; $.popupTopWindowOutsite('教师课表', fullUrl, 1024, 600); } function EducationScheduling_SetTeacherSave() { var teacherViewList = $("#dgTeacherList").cmsXDataTable("getRows"); if (teacherViewList.length == 0) { $.messager.alert('系统信息', "请至少选择一个授课老师。"); return; } for (var i = 0; i < teacherViewList.length; i++) { if (teacherViewList[i].TeachingMethod == null || teacherViewList[i].TeachingMethod == -1) { $.messager.alert('系统信息', "请选择授课老师的任课方式。"); return; } } top.$("#" + windowID).data("isSuccess", true); $(document.forms[0]).submit(); //提交Form表单 }