123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- 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 Total() {
- // var hours = $("#SchoolweeksNum").val() * $("#WeeklyNum").val() * $("#WeeklyHours").val();
- // if (hours != $("#Totalhours").val()) {
- // $.messager.alert('系统信息', "上课周次、每周次、周学时相乘必须等于总学时!");
- // }
- //}
- //添加教师
- 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 EducationMissionClass_AloneWeek() {
- EducationMissionClass_Clear();
- $("input[name='WeekNum']").each(function () {
- var teaching = $(this).val();
- if (teaching % 2 == 1) {
- $(this)[0].checked = true;
- }
- });
- }
- //清除
- function EducationMissionClass_Clear() {
- $("input[name='WeekNum']").attr("checked", false);
- }
- //所有
- function EducationMissionClass_All() {
- $("input[name='WeekNum']").attr("checked", true);
- }
- //双周
- function EducationMissionClass_BothWeek() {
- EducationMissionClass_Clear();
- $("input[name='WeekNum']").each(function () {
- var teaching = $(this).val();
- if (teaching % 2 != 1) {
- $(this)[0].checked = true;
- }
- });
- }
- 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() {
- //Total();
- var startWeeklyNum = $("#StartWeeklyNum").val();
- var endWeeklyNum = $("#EndWeeklyNum").val();
- var countnum = parseInt(endWeeklyNum) - parseInt(startWeeklyNum) + 1;
- var tmleng = $("input[name='WeekNum']:checked").length;
- if (tmleng > countnum) {
- $.messager.alert('系统信息', "所选周次不能大于总周次!");
- return;
- }
- $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/EducationMissionClass/CheckEducationMissionClassOpenControl', { educationMissionClassIDs: $("#EducationMissionClassID").val() }, function (data) {
- if (data.IsSuccess) {
- $.messager.confirm('确认', "保存教学安排会导致需要重新调整课程进度,是否确定?", function (r) {
- if (r) {
- var ischecked = $("input[name='WeekNum']").is(':checked');
- var teacherViewList = $("#dgTeacherList").cmsXDataTable("getRows");
- if (!ischecked) {
- }
- // 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;
- }
- }
- var classNum = $("#ClassNum").val();
- $("#ClassNums").val(classNum);
- $(document.forms[0]).submit();
- }
- });
- } else {
- $.messager.alert("系统提示", data.Message);
- return;
- }
- });
- }
- //获取选中的数据
- 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;
- }
- }
- $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/EducationMissionClass/CheckEducationMissionClassOpenControl', { educationMissionClassIDs: $("#EducationMissionClassID").val() }, function (data) {
- if (data.IsSuccess) {
- var teacherJsonStr = JSON.stringify(d);
- $("#hid_TeacherJsonStr").val(teacherJsonStr); //将json赋值给隐藏域
- $(document.forms[0]).submit(); //提交Form表单
- } else {
- $.messager.alert("系统提示", data.Message);
- return;
- }
- });
- }
|