123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- 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表单
- }
|