CourseProcessTeacher.js 3.5 KB

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