//获取选中的数据 function validChoose() { var d = []; $.each($("#dgStaffList").cmsXDataTable("getSelections"), function (index) { d.push(this); }); return d; } function reload() { $("#dgStaffList").cmsXDataTable("load", $.getDataGridParams("dgStaffList")); } function delTeacher(rowindex, rowdata) { var data = $("#dgTeacherList").cmsXDataTable("options").data; data.rows = $.grep(data.rows, function (row, index) { return row.UserID != rowdata.UserID }); $("#dgTeacherList").cmsXDataTable("loadData", data); } function FreeSelectionCourseSetting_TeacherSave() { var selectedTeacher = validChoose(); var currentTeacher = $("#dgTeacherList").cmsXDataTable("options").data.rows; var isValidated = true; var duplicateTeacher; $.each(selectedTeacher, function () { var curSelectedTeacher = this; if (!(curSelectedTeacher.TeachingMethod && curSelectedTeacher.TeachingMethod >= 0)) { isValidated = false; return false; } if ($.grep(currentTeacher, function (row, index) { return row.UserID == curSelectedTeacher.UserID; }).length > 0) { duplicateTeacher = curSelectedTeacher; return false; } }); if (!isValidated) { $.messager.alert('系统信息', '请为选中的教师都指定一种任课方式。'); return; } if (duplicateTeacher) { $.messager.alert('系统信息', duplicateTeacher.Name + '已经在任课老师列表中,无需重复添加。'); return; } var allTeacher = selectedTeacher.concat(currentTeacher); $.ajax({ url: CMS_SystemConfig.VirtualDirectoryPath + "/FreeSelectionCourseApply/TeacherEdit", data: { freeSelectionCourseApplyID: $.SystemGeneral.getUrlParam("FreeSelectionCourseApplyID"), addTeacherListJson: JSON.stringify(allTeacher) }, dataType: 'json', success: function (data) { if (data.IsSuccess) { Teacher_Confirm(); } else { $.messager.alert('系统信息', data.Message); } } }); } function QueryCampusDropdownList(data) { $("#CollegeDropdown").combobox("reload", CMS_SystemConfig.VirtualDirectoryPath + "/College/CollegeDropdownListBanid?campusID=" + data.Value + ""); } function QueryDepartmentDropdownList(data) { reload(); }