SetTeacher.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. var mnu = "";
  2. var windowID = "";
  3. //加载
  4. $(function () {
  5. mnu = $.SystemGeneral.getUrlParam("MNU");
  6. windowID = $.SystemGeneral.getUrlParam("WindowID");
  7. })
  8. //添加教师
  9. function EducationScheduling_TeacherAdd() {
  10. $.popupTopWindow('教师信息', CMS_SystemConfig.VirtualDirectoryPath + '/Common/TeacherSelect?FromMNU=' + mnu, 770, 420, AddTeachers_Confirm);
  11. }
  12. function AddTeachers_Confirm(teacherList) {
  13. if (!teacherList) return;
  14. var teacherViewList = $("#dgTeacherList").cmsXDataTable("getRows");
  15. $.each(teacherList, function (index, value) {
  16. if ($.grep(teacherViewList, function (row, index) { return value.UserID == row.UserID; }).length == 0) {
  17. teacherViewList.push({
  18. FreeSelectionCourseApplyID: $("#FreeSelectionCouseApplyID").val(),
  19. UserID: value.UserID,
  20. LoginID: value.StaffCode,
  21. Name: value.Name,
  22. CollegeID: value.CollegeID,
  23. CollegeName: value.CollegeName,
  24. BirthDate: value.BirthDate,
  25. TeacherType: value.TeacherType,
  26. TeacherTypeName: value.TeacherTypeName,
  27. IncumbencyState: value.IncumbencyState,
  28. IncumbencyStateName: value.IncumbencyStateName,
  29. Title: value.Title,
  30. TitleName: value.TitleName,
  31. TeachingMethod: 0, //默認选取的数据为主讲课
  32. TeachingMethodDesc: null,
  33. SexName: value.SexName,
  34. DepartmentName: value.DepartmentName,
  35. DepartmentID: value.DepartmentID
  36. });
  37. }
  38. });
  39. $("#dgTeacherList").cmsXDataTable("loadData", { rows: teacherViewList, total: teacherViewList.length });
  40. }
  41. //删除教师
  42. function EducationScheduling_TeacherDelete() {
  43. var d = validChoose();
  44. var teacherViewList = $("#dgTeacherList").cmsXDataTable("getRows");
  45. var i, j;
  46. var len = teacherViewList.length;
  47. for (i = len - 1; i >= 0; i--) {
  48. for (j = 0; j < d.length; j++) {
  49. if (teacherViewList[i].UserID == d[j].UserID) {
  50. teacherViewList.splice(i, 1);
  51. break;
  52. }
  53. }
  54. }
  55. $("#dgTeacherList").cmsXDataTable("loadData", { rows: teacherViewList, total: teacherViewList.length });
  56. }
  57. //获取选中的数据
  58. function validChoose() {
  59. var d = [];
  60. $.each($("#dgTeacherList").cmsXDataTable("getSelections"), function (index) {
  61. d.push(this);
  62. });
  63. return d;
  64. }
  65. //教师课表预览
  66. function Preview(rowindex, rowdata) {
  67. var schoolYearID = $.SystemGeneral.getUrlParam("SchoolYearID");
  68. var fullUrl = CMS_SystemConfig.ReportPagePath + "?ReportFolder=%2fEducationScheduling%2fTeacherSchedulingView&CollegeID_RAP=&UserID_RAP=" + rowdata.UserID + "&SchoolyearID_RAP=" + schoolYearID;
  69. $.popupTopWindowOutsite('教师课表', fullUrl, 1024, 600);
  70. }
  71. function EducationScheduling_SetTeacherSave() {
  72. var teacherViewList = $("#dgTeacherList").cmsXDataTable("getRows");
  73. if (teacherViewList.length == 0) {
  74. $.messager.alert('系统信息', "请至少选择一个授课老师。");
  75. return;
  76. }
  77. for (var i = 0; i < teacherViewList.length; i++) {
  78. if (teacherViewList[i].TeachingMethod == null || teacherViewList[i].TeachingMethod == -1) {
  79. $.messager.alert('系统信息', "请选择授课老师的任课方式。");
  80. return;
  81. }
  82. }
  83. top.$("#" + windowID).data("isSuccess", true);
  84. $(document.forms[0]).submit(); //提交Form表单
  85. }