var mnu = ""; //加载 $(function () { mnu = $.SystemGeneral.getUrlParam("MNU"); // if (isUpdate == "edit") { // $("#SchoolyearID").attr("IsEnabled", false); // $("#WeekNum").attr("IsEnabled", false); // $("#Weekday").attr("IsEnabled", false); // $("#CoursesTimeID").attr("IsEnabled", false); // $("#ClassroomID").attr("IsEnabled", false); // $("#EducationMissionClassID").attr("IsEnabled", false); // $("#CoursematerialID").attr("IsEnabled", false); // } }) //获取选中的数据 function validChoose() { var d = []; $.each($("#dgTeacherList").cmsXDataTable("getSelections"), function (index) { d.push(this); }); return d; } //加载列表 function reload() { $("#dgTeacherList").cmsXDataTable("load", $.getDataGridParams("dgTeacherList")); } //保存 function EducationMissionClassCheck_Save() { $(document.forms[0]).submit(); } function GetEducationMissionClassBy() { var jsonString = ""; var parameterString = ""; var schoolyearID = $("#SchoolyearID").combobox("getValue"); var weekNum = $("#WeekNum").combobox("getValue"); var weekday = $("#Weekday").combobox("getValue"); var coursesTimeID = $("#CoursesTimeID").combogridX("getValue"); var classroomID = $("#ClassroomID").combogridX("getValue"); if (schoolyearID != nonSelect && weekNum != nonSelect && weekday != nonSelect && (coursesTimeID != nonSelect && coursesTimeID != "") && (classroomID != nonSelect && classroomID != "")) { parameterString += "schoolyearID|*|" + schoolyearID + "|@|"; parameterString += "weekNum|*|" + weekNum + "|@|"; parameterString += "weekDay|*|" + weekday + "|@|"; parameterString += "coursesTimeID|*|" + coursesTimeID + "|@|"; parameterString += "classroomID|*|" + classroomID + "|@|"; if (parameterString != "") { jsonString = "({'QueryParamsDatas':'" + parameterString + "'})"; $("#EducationMissionClassID").combogridX("reload", eval(jsonString)); $("#CoursematerialID").combogridX("reload", eval(jsonString)); } else { $("#EducationMissionClassID").combogridX("reload"); $("#CoursematerialID").combogridX("reload"); } } // if (schoolyearID != nonSelect) parameterString += "schoolyearID|*|" + schoolyearID + "|@|"; // if (weekNum != nonSelect) parameterString += "weekNum|*|" + weekNum + "|@|"; // if (weekday != nonSelect) parameterString += "weekDay|*|" + weekday + "|@|"; // if (coursesTimeID != nonSelect) parameterString += "coursesTimeID|*|" + coursesTimeID + "|@|"; // if (classroomID != nonSelect) parameterString += "classroomID|*|" + classroomID + "|@|"; //$("#EducationMissionClassID").combogridX("select", 0); } function setFirst() { var jsonString = ""; var parameterString = ""; var schoolyearID = $("#SchoolyearID").combobox("getValue"); var weekNum = $("#WeekNum").combobox("getValue"); var weekday = $("#Weekday").combobox("getValue"); var coursesTimeID = $("#CoursesTimeID").combogridX("getValue"); var classroomID = $("#ClassroomID").combogridX("getValue"); if (schoolyearID != nonSelect && weekNum != nonSelect && weekday != nonSelect && (coursesTimeID != nonSelect && coursesTimeID != "") && (classroomID != nonSelect && classroomID != "")) { parameterString += "schoolyearID|*|" + schoolyearID + "|@|"; parameterString += "weekNum|*|" + weekNum + "|@|"; parameterString += "weekDay|*|" + weekday + "|@|"; parameterString += "coursesTimeID|*|" + coursesTimeID + "|@|"; parameterString += "classroomID|*|" + classroomID + "|@|"; if (parameterString != "") { jsonString = "({'QueryParamsDatas':'" + parameterString + "'})"; $.post(CMS_SystemConfig.VirtualDirectoryPath + '/EducationMissionClassCheck/GetEducationMissionClass', { QueryParamsDatas: parameterString, page: 0, rows: 10 }, function (data) { if (data.rows.length == 0) { $("#EducationMissionClassID").combogridX("setValue", "-1"); $("#CoursematerialID").combogridX("setValue", "-1"); $("#TeacherName").val(""); } else { $("#EducationMissionClassID").combogridX("select", 0); $("#CoursematerialID").combogridX("select", 0); } }); } else { $("#EducationMissionClassID").combogridX("reload"); $("#CoursematerialID").combogridX("reload"); } } // var ishave = $("#EducationMissionClassID").combogridX("getValue", 0); // if (ishave != "-1") { // $("#EducationMissionClassID").combogridX("select", 0); // $("#CoursematerialID").combogridX("select", 0); // } else { // $("#TeacherName").val(""); // } } function setCoursematerial() { $("#CoursematerialID").combogridX("select", 0); } function GetTeacherName() { var jsonString = ""; var parameterString = ""; var schoolyearID = $("#SchoolyearID").combobox("getValue"); var educationID = $("#EducationMissionClassID").combogridX("getValue"); var weekNum = $("#WeekNum").combobox("getValue"); var weekday = $("#Weekday").combobox("getValue"); var coursesTimeID = $("#CoursesTimeID").combogridX("getValue"); var classroomID = $("#ClassroomID").combogridX("getValue"); if (schoolyearID != nonSelect && weekNum != nonSelect && weekday != nonSelect && (coursesTimeID != nonSelect && coursesTimeID != "") && (classroomID != nonSelect && classroomID != "") && (educationID != nonSelect && educationID != "")) { parameterString += "schoolyearID|*|" + schoolyearID + "|@|"; parameterString += "weekNum|*|" + weekNum + "|@|"; parameterString += "weekDay|*|" + weekday + "|@|"; parameterString += "coursesTimeID|*|" + coursesTimeID + "|@|"; parameterString += "classroomID|*|" + classroomID + "|@|"; parameterString += "educationID|*|" + educationID + "|@|"; if (parameterString != "") { jsonString = "({'QueryParamsDatas':'" + parameterString + "'})"; $("#CoursematerialID").combogridX("reload", eval(jsonString)); } else { $("#CoursematerialID").combogridX("reload"); } } $.post(CMS_SystemConfig.VirtualDirectoryPath + '/EducationMissionClassCheck/GetTeacherNameByEducationMissionClassID', { QueryParamsDatas: parameterString }, function (data) { $("#TeacherName").val(data.Message); }); } function EducationMissionClassCheck_AddStaff() { $.popupTopWindow('教师信息', CMS_SystemConfig.VirtualDirectoryPath + '/EducationMissionClass/TeacherSelect?FromMNU=' + mnu, 900, 500, AddTeachers_Confirm); } function EducationMissionClassCheck_DeleteStaff() { 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 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({ 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 }); }