var mnu = ""; //加载 $(function () { mnu = $.SystemGeneral.getUrlParam("MNU"); }) //保存 function FreeSelectionCourseApply_Save() { // if ($("input[name='TeachingModeID']:checked").length == 0) { // $.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 reload() { $.post(CMS_SystemConfig.VirtualDirectoryPath + '/FreeSelectionCourseApply/GetFreeSelectionCourseView', { freeSelectionCourseID: $("#FreeSelectionCouseID").combogridX("getValue") }, function (data) { if (data != "") { $("#DepartmentID").combogridX("setValue", data.DepartmentID) $("#CourseStructureID").combobox("setValue", data.CourseStructureID) $("#CourseCategoryID").combobox("setValue", data.CourseCategoryID) $("#CourseQualityID").combobox("setValue", data.CourseQualityID) $("#CourseTypeID").combobox("setValue", data.CourseTypeID) $("#ExaminationModeID").combobox("setValue", data.ExaminationModeID) $("#TeachinglanguageID").combobox("setValue", data.TeachinglanguageID) $("#SchoolyearNumID").combobox("setValue", data.SchoolyearNumID) $("#SchoolcodeID").combobox("setValue", data.SchoolcodeID) $("#PracticeTypeID").combobox("setValue", data.PracticeTypeID) $("#ResultTypeID").combobox("setValue", data.ResultTypeID) $("#Credit").val(data.Credit); $("#TheoryCourse").val(data.TheoryCourse); $("#Practicehours").val(data.Practicehours); $("#Trialhours").val(data.Trialhours); $("#WeeklyNum").val(data.WeeklyNum); $("#TheoryWeeklyNum").val(data.TheoryWeeklyNum); $("#PracticeWeeklyNum").val(data.PracticeWeeklyNum); $("#TrialWeeklyNum").val(data.TrialWeeklyNum); $("#StartWeeklyNum").val(data.StartWeeklyNum); $("#EndWeeklyNum").val(data.EndWeeklyNum); $("#WeeklyHours").val(data.WeeklyHours); setStartEndWeeklyNum(); //起止周次 } else { $.messager.alert("系统提示", "任选课程信息为空"); } }); } //任修任务班名称生成规则 function DefaultClassNo() { $.post(CMS_SystemConfig.VirtualDirectoryPath + '/FreeSelectionCourseApply/DefaultClassNo', { SchoolyearID: $("#SchoolyearID").combobox("getValue"), freeSelectionCourseID: $("#FreeSelectionCouseID").combogridX("getValue"), StartWeeklyNum: $("#StartWeeklyNum").val(), EndWeeklyNum: $("#EndWeeklyNum").val() }, function (data) { if (data != "") { $("#DefaultClassName").val($("#FreeSelectionCouseID").combogridX("getText") + "-任选(" + $("#StartEndWeeklyNum").val() + ")" + (data == "0" ? "" : data + "班")); } }) } //弹出添加教师页面 function FreeSelectionCouseApply_TeacherAdd() { $.popupTopWindow('添加教师', CMS_SystemConfig.VirtualDirectoryPath + '/Common/TeacherSelect?FromMNU=' + mnu, 560, 480, AddTeachers_Confirm); } //确定添加教师 function AddTeachers_Confirm(teacherList) { var teacherViewList = $("#dgTeacherList").cmsXDataTable("getRows"); $.each(teacherList, function (index, value) { if ($.grep(teacherViewList, function (row, index) { return value.UserID == teacherViewList.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: TeachingMethod, TeachingMethodDesc: null }); } }); teacherViewList[0].TeachingMethod = TeachingMethod; $("#dgTeacherList").cmsXDataTable("loadData", { rows: teacherViewList, total: teacherViewList.length }); } //获取选中的教师信息 function validChoose() { var d = []; $.each($("#dgTeacherList").cmsXDataTable("getSelections"), function (index) { d.push(this); }); return d; } //删除添加教师 function FreeSelectionCouseApply_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 FreeSelectionCouseApply_SpecialtyAdd() { $.popupTopWindow('添加专业', CMS_SystemConfig.VirtualDirectoryPath + '/Common/SpecialtySelect?FromMNU=' + mnu, 560, 480, AddSpecialty_Confirm); } //确定添加专业 function AddSpecialty_Confirm(specialtyList) { var specialtyViewList = $("#dgSpecialtyList").cmsXDataTable("getRows"); $.each(specialtyList, function (index, value) { if ($.grep(specialtyViewList, function (row, index) { return value.SpecialtyID == specialtyViewList.SpecialtyID; }).length == 0) { specialtyViewList.push({ FreeSelectionCourseApplyID: $("#FreeSelectionCouseApplyID").val(), SpecialtyID: value.SpecialtyID, Code: value.Code, StandardName: value.StandardName, LearnSystem: value.LearnSystem, EducationName: value.EducationName, LearningformName: value.ScienceclassName, PropertyName: value.PropertyName, StandardTitleName: value.StandardTitleName, StandardLevelName: value.StandardLevelName }); } }); $("#dgSpecialtyList").cmsXDataTable("loadData", { rows: specialtyViewList, total: specialtyViewList.length }); } //获取选中的专业信息 function validChooseSpecialty() { var d = []; $.each($("#dgSpecialtyList").cmsXDataTable("getSelections"), function (index) { d.push(this); }); return d; } //删除添加专业 function FreeSelectionCouseApply_SpecialtyDelete() { var d = validChooseSpecialty(); var specialtyViewList = $("#dgSpecialtyList").cmsXDataTable("getRows"); var i, j; var len = specialtyViewList.length; for (i = len - 1; i >= 0; i--) { for (j = 0; j < d.length; j++) { if (specialtyViewList[i].SpecialtyID == d[j].SpecialtyID) { specialtyViewList.splice(i, 1); break; } } } $("#dgSpecialtyList").cmsXDataTable("loadData", { rows: specialtyViewList, total: specialtyViewList.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 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"); } }