var mnu = ""; //加载 $(function () { mnu = $.SystemGeneral.getUrlParam("MNU"); }) //保存 function RetakePlanResultTask_Save() { //授课方式 if ($("input[name='TeachingModeID']:checked").length == 0) { $.messager.alert("系统提示", "请选择至少一种授课方式。"); return; } ////授课地点 //if ($("input[name='TeachingPlaceID']:checked").length == 0) { // $.messager.alert("系统提示", "请选择至少一种授课地点。"); // return; //} //排课明细 var scheduling = $("#dgSchedulingList").cmsXDataTable("getRows"); var isSchedulingValidated = true; $.each(scheduling, function () { var selectedScheduling = this; if (selectedScheduling.Weekday == null || selectedScheduling.Weekday == "") { isSchedulingValidated = false; return false; } if (selectedScheduling.CoursesTimeID == null || selectedScheduling.CoursesTimeID == "") { isSchedulingValidated = false; return false; } }); if (!isSchedulingValidated) { $.messager.alert('系统信息', '请选择相应的排课信息。'); return; } //任课教师 var currentTeacher = $("#dgTeacherList").cmsXDataTable("getRows"); var isValidated = true; $.each(currentTeacher, function () { var curSelectedTeacher = this; if (curSelectedTeacher.TeachingMethod == null) { isValidated = false; return false; } }); if (!isValidated) { $.messager.alert('系统信息', '请指定一种任课方式。'); return; } if (!isNaN($("#Trialhours").val()) && $("#Trialhours").val() != "" && !isNaN($("#Practicehours").val()) && $("#Practicehours").val() != "" && parseFloat($("#Trialhours").val()) > parseFloat($("#Practicehours").val())) { $.messager.alert("系统提示", "实验学时不能大于实践学时。"); return; } if (!isNaN($("#TrialWeeklyNum").val()) && $("#TrialWeeklyNum").val() != "" && !isNaN($("#PracticeWeeklyNum").val()) && $("#PracticeWeeklyNum").val() != "" && parseFloat($("#TrialWeeklyNum").val()) > parseFloat($("#PracticeWeeklyNum").val())) { $.messager.alert("系统提示", "实验周次不能大于实践周次。"); return; } $(document.forms[0]).submit(); } //保存后执行方法(强制排课) VerifySave = function (data) { if (!data.IsSuccess) { if (data.Type == 1) { //如果验证到排课冲突type返回1,弹出选择框,用户可选择继续保存或不保存,如果不返回1,弹出一般的错误提示框 $.messager.defaults = { ok: "保存", cancel: "不保存" }; $.messager.confirm("选择提示", data.Message + ",是否继续保存?", function (r) { if (r) { //验证到排课冲突后,若要继续保存则IsNeedVerify为false $("#IsNeedVerify").val(false); $(document.forms[0]).submit(); } }); $.messager.defaults = { ok: "确定", cancel: "取消" }; } else { $.messager.alert("系统提示", data.Message); } } else { $.messager.alert('系统信息', data.Message, null, function () { if (data.IsSuccess) { var dialogId = $.SystemGeneral.getUrlParam('WindowID'); dialogId = (dialogId == null || dialogId == '') ? 'sysWindow' : dialogId; try { top.$('#' + dialogId).window('close'); } catch (e) { } var tab = top.$('#index_center_tabs').tabs('getSelected'); var $iframe = tab.panel('body').find("iframe"); if ($iframe[0].contentWindow.reload) $iframe[0].contentWindow.reload(); } }); } } 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 RetakePlanResultTask_TeaAdd() { $.popupTopWindow('添加教师', CMS_SystemConfig.VirtualDirectoryPath + '/Common/TeacherSelect?FromMNU=' + mnu, 560, 480, AddTeachers_Confirm); } //确定添加教师 function AddTeachers_Confirm(teacherList) { if (teacherList == null) 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({ RetakePlanID: $("#RetakePlanID").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: TeachingMethod, TeachingMethodDesc: null }); } }); $("#dgTeacherList").cmsXDataTable("loadData", { rows: teacherViewList, total: teacherViewList.length }); } //获取选中的教师信息 function validChoose() { var d = []; $.each($("#dgTeacherList").cmsXDataTable("getSelections"), function (index) { d.push(this); }); return d; } //删除添加教师 function RetakePlanResultTask_TeaDelete() { 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 swapRetakeSettings() { if ($("#retakeExpander").attr("expanded") == "0") { $("#retakeExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -32px 0"); $("#retakeExpander").closest("tr") .next().css("display", "none") .next().css("display", "none") .next().css("display", "none") .next().css("display", "none") .next().css("display", "none"); $("#retakeExpander").attr("expanded", "1"); } else { $("#retakeExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -50px 0"); $("#retakeExpander").closest("tr") .next().css("display", "") .next().css("display", "") .next().css("display", "") .next().css("display", "") .next().css("display", ""); $("#retakeExpander").attr("expanded", "0"); } } //点击上课周次信息收缩 function swapWeekSettings() { if ($("#weekExpander").attr("expanded") == "0") { $("#weekExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -50px 0"); $("#weekExpander").closest("tr") .next().css("display", "") .next().css("display", "") .next().css("display", "") .next().css("display", ""); $("#weekExpander").attr("expanded", "1"); } else { $("#weekExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -32px 0"); $("#weekExpander").closest("tr") .next().css("display", "none") .next().css("display", "none") .next().css("display", "none") .next().css("display", "none"); $("#weekExpander").attr("expanded", "0"); } }