AdultEducationMissionClassEdit.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. var mnu = "";
  2. //加载
  3. $(function () {
  4. mnu = $.SystemGeneral.getUrlParam("MNU");
  5. })
  6. //加载列表
  7. function reload() {
  8. $("#dgTeacherList").cmsXDataTable("load", $.getDataGridParams("dgTeacherList"));
  9. }
  10. //获取选中的数据
  11. function validChoose() {
  12. var d = [];
  13. $.each($("#dgTeacherList").cmsXDataTable("getSelections"), function (index) {
  14. d.push(this);
  15. });
  16. return d;
  17. }
  18. //添加教师
  19. function EducationMissionClass_TeacherAdd() {
  20. $.popupTopWindow('教师信息', CMS_SystemConfig.VirtualDirectoryPath + '/EducationMissionClass/TeacherSelect?FromMNU=' + mnu, 900, 500, AddTeachers_Confirm);
  21. }
  22. function AddTeachers_Confirm(teacherList) {
  23. if (!teacherList) return;
  24. var teacherViewList = $("#dgTeacherList").cmsXDataTable("getRows");
  25. $.each(teacherList, function (index, value) {
  26. if ($.grep(teacherViewList, function (row, index) { return value.UserID == row.UserID; }).length == 0) {
  27. teacherViewList.push({
  28. FreeSelectionCourseApplyID: $("#FreeSelectionCouseApplyID").val(),
  29. UserID: value.UserID,
  30. LoginID: value.StaffCode,
  31. Name: value.Name,
  32. CollegeID: value.CollegeID,
  33. CollegeName: value.CollegeName,
  34. BirthDate: value.BirthDate,
  35. TeacherType: value.TeacherType,
  36. TeacherTypeName: value.TeacherTypeName,
  37. IncumbencyState: value.IncumbencyState,
  38. IncumbencyStateName: value.IncumbencyStateName,
  39. Title: value.Title,
  40. TitleName: value.TitleName,
  41. TeachingMethod: 0, //默認选取的数据为主讲课
  42. TeachingMethodDesc: null,
  43. SexName: value.SexName,
  44. DepartmentName: value.DepartmentName,
  45. DepartmentID: value.DepartmentID
  46. });
  47. }
  48. });
  49. $("#dgTeacherList").cmsXDataTable("loadData", { rows: teacherViewList, total: teacherViewList.length });
  50. }
  51. //删除教师
  52. function EducationMissionClass_TeacherDelete() {
  53. var d = validChoose();
  54. var teacherViewList = $("#dgTeacherList").cmsXDataTable("getRows");
  55. var i, j;
  56. var len = teacherViewList.length;
  57. for (i = len - 1; i >= 0; i--) {
  58. for (j = 0; j < d.length; j++) {
  59. if (teacherViewList[i].UserID == d[j].UserID) {
  60. teacherViewList.splice(i, 1);
  61. break;
  62. }
  63. }
  64. }
  65. $("#dgTeacherList").cmsXDataTable("loadData", { rows: teacherViewList, total: teacherViewList.length });
  66. }
  67. function success(data) {
  68. $.messager.alert('系统信息', data.Message);
  69. if (data.IsSuccess) {
  70. top.$('#sysWindow').window('close');
  71. var tab = top.$('#index_center_tabs').tabs('getSelected');
  72. tab.panel('refresh');
  73. }
  74. }
  75. function loadClassroom() {
  76. var roomUseID = $("#ClassroomTypeID").combobox("getValue");
  77. var collegeID = $("#CollegeID").val();
  78. if (roomUseID == nonSelect) {
  79. roomUseID = "null"
  80. }
  81. var jsonString = "({'QueryParamsDatas':'ClassroomType|*|" + roomUseID
  82. + "|@|CollegeID|*|" + collegeID + "|@|IsSpecialDictionaryDropDown|*|" + 1 + "|@|lodaType|*|" + 1 + "|@|'})";
  83. // CMSFunction.ComboGrid.SetValue($("#ClassroomID"), "", "");
  84. $("#ClassroomID").combogridX("reload", eval(jsonString));
  85. //reload();
  86. }
  87. function queryClassroom() {
  88. var roomUseID = $("#ClassroomTypeID").combobox("getValue");
  89. var collegeID = $("#CollegeID").val();
  90. if (roomUseID == nonSelect) {
  91. roomUseID = "null"
  92. }
  93. CMSFunction.ComboGrid.SetValue($("#ClassroomID"), "", ""); //重新选择教室类型、清空教室
  94. var jsonString = "({'QueryParamsDatas':'ClassroomType|*|" + roomUseID
  95. + "|@|IsSpecialDictionaryDropDown|*|" + 1 + "|@|lodaType|*|" + 1 + "|@|'})";
  96. // CMSFunction.ComboGrid.SetValue($("#ClassroomID"), "", "");
  97. $("#ClassroomID").combogridX("reload", eval(jsonString));
  98. //reload();
  99. }
  100. function EducationMissionClass_EditSave() {
  101. var teacherViewList = $("#dgTeacherList").cmsXDataTable("getRows");
  102. for (var i = 0; i < teacherViewList.length; i++) {
  103. if (teacherViewList[i].TeachingMethod == null || teacherViewList[i].TeachingMethod == -1) {
  104. $.messager.alert('系统信息', "请选择授课老师的任课方式!");
  105. return;
  106. }
  107. }
  108. var classNum = $("#ClassNum").val();
  109. $("#ClassNums").val(classNum);
  110. $(document.forms[0]).submit();
  111. }
  112. //获取选中的数据
  113. function validChoosTeacher() {
  114. var d = [];
  115. $.each($("#dgTeacherList").cmsXDataTable("getSelections"), function (index) {
  116. d.push(this);
  117. });
  118. return d;
  119. }
  120. //教师科表预览
  121. function Preview(rowindex, rowdata) {
  122. var schoolYearID = $("#SchoolyearID").val()
  123. //var fullUrl = CMS_SystemConfig.VirtualDirectoryPath + '/EducationSchedulingReport/TeacherReport?userID=' + rowdata.UserID + '&schoolyearID=' + schoolYearID;
  124. //$.popupTopWindow('教师课表预览', fullUrl, window.screen.availWidth, window.screen.availHeight - 60);
  125. var fullUrl = CMS_SystemConfig.ReportPagePath + "?ReportFolder=%2fEducationScheduling%2fTeacherSchedulingView&CollegeID_RAP=&UserID_RAP=" + rowdata.UserID + "&SchoolyearID_RAP=" + schoolYearID;
  126. $.popupTopWindowOutsite('教师课表', fullUrl, 1024, 600);
  127. }
  128. function EducationMissionClass_SetTeacherSave() {
  129. var d = validChoosTeacher();
  130. //if (d.length == 0) {
  131. // $.messager.alert("提示", "请选择您要设置的教师!");
  132. // return;
  133. //}
  134. var teacherViewList = $("#dgTeacherList").cmsXDataTable("getRows");
  135. for (var i = 0; i < teacherViewList.length; i++) {
  136. if (teacherViewList[i].TeachingMethod == null || teacherViewList[i].TeachingMethod == -1) {
  137. $.messager.alert('系统信息', "请选择授课老师的任课方式!");
  138. return;
  139. }
  140. }
  141. var teacherJsonStr = JSON.stringify(d);
  142. $("#hid_TeacherJsonStr").val(teacherJsonStr); //将json赋值给隐藏域
  143. $(document.forms[0]).submit(); //提交Form表单
  144. }