123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328 |
- var mnu = "";
- //加载
- $(function () {
- mnu = $.SystemGeneral.getUrlParam("MNU");
- })
- //添加教室
- function selectClassroom() {
- if ($("#StartEndWeeklyNum").val() == null || $("#StartEndWeeklyNum").val() == "") {
- $.messager.alert('系统信息', '请先填写开始和结束周次。');
- return;
- }
- trigger = $(this);
- var dataRowIndex = parseInt(trigger.parents('tr').attr('xRowIndex'));
- var dataRow = $("#dgSchedulingList").cmsXDataTable('getRows')[dataRowIndex];
- var ddlClassroomType = trigger.parents('tr').find('[name*=ClassroomTypeID]');
- var weekDay = trigger.parents('tr').find('[name*=WeekDay]');
- var coursesTimeID = trigger.parents('tr').find('[name*=CoursesTimeID]');
- if (ddlClassroomType.val() != '-1') {
- $.popupTopWindow('添加教室', CMS_SystemConfig.VirtualDirectoryPath + '/ExecutableFreeSelectionCouse/CourseProcessClassroomList?MaxSelect=1&MinSeatCount=' +
- '&schedulingWeek=' + $("#StartEndWeeklyNum").val() + "&weekDay=" + weekDay.val() + "&coursesTimeID=" +
- coursesTimeID.val() + '&ClassroomTypeID=' + ddlClassroomType.val() + '&FromMNU=' +
- mnu, 540, 480, ClassroomSelect_Close, null);
- } else {
- $.popupTopWindow('添加教室', CMS_SystemConfig.VirtualDirectoryPath + '/ExecutableFreeSelectionCouse/CourseProcessClassroomList?MaxSelect=1&MinSeatCount=' +
- '&schedulingWeek=' + $("#StartEndWeeklyNum").val() + "&weekDay=" + weekDay.val() + "&coursesTimeID=" +
- coursesTimeID.val() + '&FromMNU=' +
- mnu, 540, 480, ClassroomSelect_Close, null);
- }
- }
- //保存
- function ExecutableFreeSelectionCouse_Save() {
- document.forms[0].name = "form0";
- // 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;
- }
- if (!isNaN($("#StartWeeklyNum").val()) && $("#StartWeeklyNum").val() != ""
- && !isNaN($("#EndWeeklyNum").val()) && $("#EndWeeklyNum").val() != ""
- && parseFloat($("#StartWeeklyNum").val()) > parseFloat($("#EndWeeklyNum").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(data) {
- //$.post(CMS_SystemConfig.VirtualDirectoryPath + '/ExecutableFreeSelectionCouse/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(); //起止周次
- $.post(CMS_SystemConfig.VirtualDirectoryPath + "/FreeSelectionCourse/TeachingModeType?freeSelectionCourseID=" + data.FreeSelectionCouseID, null, function (result) {
- // for (var i = 0; i < $("[name='TeachingModeID']").length; i++) {
- // var obj = $("[name='TeachingModeID']")[i];
- // for (var j = 0; j < result.length; j++) {
- // if (result[j] == obj.value) {
- // obj.checked = true;
- // break;
- // }
- // else
- // obj.checked = false;
- // }
- // }
- $.each($("[name='TeachingModeID']"), function (i, x) {
- if ($.grep(result, function (v) { return v == $(x).val(); }).length > 0) {
- $(x).attr("checked", "checked")
- } else {
- $(x).removeAttr("checked")
- }
- });
- });
- } else {
- $.messager.alert("系统提示", "任选课程信息为空。");
- }
- // });
- }
- //任修任务班名称生成规则
- function DefaultClassNo() {
- $.post(CMS_SystemConfig.VirtualDirectoryPath + '/ExecutableFreeSelectionCouse/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 ExecutableFreeSelectionCouse_TeacherAdd() {
- $.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({
- ExecutableFreeSelectionCouseID: $("#ExecutableFreeSelectionCouseID").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 ExecutableFreeSelectionCouse_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 ExecutableFreeSelectionCouse_SpecialtyAdd() {
- $.popupTopWindow('添加专业', CMS_SystemConfig.VirtualDirectoryPath + '/Common/SpecialtySelect?FromMNU=' +
- mnu, 560, 480, AddSpecialty_Confirm);
- }
- //确定添加专业
- function AddSpecialty_Confirm(specialtyList) {
- if (specialtyList == null)
- return;
- var specialtyViewList = $("#dgSpecialtyList").cmsXDataTable("getRows");
- $.each(specialtyList, function (index, value) {
- if ($.grep(specialtyViewList, function (row, index) { return value.SpecialtyID == row.SpecialtyID; }).length == 0) {
- specialtyViewList.push({
- ExecutableFreeSelectionCouseID: $("#ExecutableFreeSelectionCouseID").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 ExecutableFreeSelectionCouse_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");
- }
- }
|