EducationMissionClassCheckEdit.js 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. var mnu = "";
  2. //加载
  3. $(function () {
  4. mnu = $.SystemGeneral.getUrlParam("MNU");
  5. // if (isUpdate == "edit") {
  6. // $("#SchoolyearID").attr("IsEnabled", false);
  7. // $("#WeekNum").attr("IsEnabled", false);
  8. // $("#Weekday").attr("IsEnabled", false);
  9. // $("#CoursesTimeID").attr("IsEnabled", false);
  10. // $("#ClassroomID").attr("IsEnabled", false);
  11. // $("#EducationMissionClassID").attr("IsEnabled", false);
  12. // $("#CoursematerialID").attr("IsEnabled", false);
  13. // }
  14. })
  15. //获取选中的数据
  16. function validChoose() {
  17. var d = [];
  18. $.each($("#dgTeacherList").cmsXDataTable("getSelections"), function (index) {
  19. d.push(this);
  20. });
  21. return d;
  22. }
  23. //加载列表
  24. function reload() {
  25. $("#dgTeacherList").cmsXDataTable("load", $.getDataGridParams("dgTeacherList"));
  26. }
  27. //保存
  28. function EducationMissionClassCheck_Save() {
  29. $(document.forms[0]).submit();
  30. }
  31. function GetEducationMissionClassBy() {
  32. var jsonString = "";
  33. var parameterString = "";
  34. var schoolyearID = $("#SchoolyearID").combobox("getValue");
  35. var weekNum = $("#WeekNum").combobox("getValue");
  36. var weekday = $("#Weekday").combobox("getValue");
  37. var coursesTimeID = $("#CoursesTimeID").combogridX("getValue");
  38. var classroomID = $("#ClassroomID").combogridX("getValue");
  39. if (schoolyearID != nonSelect && weekNum != nonSelect && weekday != nonSelect && (coursesTimeID != nonSelect && coursesTimeID != "") && (classroomID != nonSelect && classroomID != "")) {
  40. parameterString += "schoolyearID|*|" + schoolyearID + "|@|";
  41. parameterString += "weekNum|*|" + weekNum + "|@|";
  42. parameterString += "weekDay|*|" + weekday + "|@|";
  43. parameterString += "coursesTimeID|*|" + coursesTimeID + "|@|";
  44. parameterString += "classroomID|*|" + classroomID + "|@|";
  45. if (parameterString != "") {
  46. jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
  47. $("#EducationMissionClassID").combogridX("reload", eval(jsonString));
  48. $("#CoursematerialID").combogridX("reload", eval(jsonString));
  49. } else {
  50. $("#EducationMissionClassID").combogridX("reload");
  51. $("#CoursematerialID").combogridX("reload");
  52. }
  53. }
  54. // if (schoolyearID != nonSelect) parameterString += "schoolyearID|*|" + schoolyearID + "|@|";
  55. // if (weekNum != nonSelect) parameterString += "weekNum|*|" + weekNum + "|@|";
  56. // if (weekday != nonSelect) parameterString += "weekDay|*|" + weekday + "|@|";
  57. // if (coursesTimeID != nonSelect) parameterString += "coursesTimeID|*|" + coursesTimeID + "|@|";
  58. // if (classroomID != nonSelect) parameterString += "classroomID|*|" + classroomID + "|@|";
  59. //$("#EducationMissionClassID").combogridX("select", 0);
  60. }
  61. function setFirst() {
  62. var jsonString = "";
  63. var parameterString = "";
  64. var schoolyearID = $("#SchoolyearID").combobox("getValue");
  65. var weekNum = $("#WeekNum").combobox("getValue");
  66. var weekday = $("#Weekday").combobox("getValue");
  67. var coursesTimeID = $("#CoursesTimeID").combogridX("getValue");
  68. var classroomID = $("#ClassroomID").combogridX("getValue");
  69. if (schoolyearID != nonSelect && weekNum != nonSelect && weekday != nonSelect && (coursesTimeID != nonSelect && coursesTimeID != "") && (classroomID != nonSelect && classroomID != "")) {
  70. parameterString += "schoolyearID|*|" + schoolyearID + "|@|";
  71. parameterString += "weekNum|*|" + weekNum + "|@|";
  72. parameterString += "weekDay|*|" + weekday + "|@|";
  73. parameterString += "coursesTimeID|*|" + coursesTimeID + "|@|";
  74. parameterString += "classroomID|*|" + classroomID + "|@|";
  75. if (parameterString != "") {
  76. jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
  77. $.post(CMS_SystemConfig.VirtualDirectoryPath + '/EducationMissionClassCheck/GetEducationMissionClass', { QueryParamsDatas: parameterString, page: 0, rows: 10 }, function (data) {
  78. if (data.rows.length == 0) {
  79. $("#EducationMissionClassID").combogridX("setValue", "-1");
  80. $("#CoursematerialID").combogridX("setValue", "-1");
  81. $("#TeacherName").val("");
  82. } else {
  83. $("#EducationMissionClassID").combogridX("select", 0);
  84. $("#CoursematerialID").combogridX("select", 0);
  85. }
  86. });
  87. } else {
  88. $("#EducationMissionClassID").combogridX("reload");
  89. $("#CoursematerialID").combogridX("reload");
  90. }
  91. }
  92. // var ishave = $("#EducationMissionClassID").combogridX("getValue", 0);
  93. // if (ishave != "-1") {
  94. // $("#EducationMissionClassID").combogridX("select", 0);
  95. // $("#CoursematerialID").combogridX("select", 0);
  96. // } else {
  97. // $("#TeacherName").val("");
  98. // }
  99. }
  100. function setCoursematerial() {
  101. $("#CoursematerialID").combogridX("select", 0);
  102. }
  103. function GetTeacherName() {
  104. var jsonString = "";
  105. var parameterString = "";
  106. var schoolyearID = $("#SchoolyearID").combobox("getValue");
  107. var educationID = $("#EducationMissionClassID").combogridX("getValue");
  108. var weekNum = $("#WeekNum").combobox("getValue");
  109. var weekday = $("#Weekday").combobox("getValue");
  110. var coursesTimeID = $("#CoursesTimeID").combogridX("getValue");
  111. var classroomID = $("#ClassroomID").combogridX("getValue");
  112. if (schoolyearID != nonSelect && weekNum != nonSelect && weekday != nonSelect && (coursesTimeID != nonSelect && coursesTimeID != "") && (classroomID != nonSelect && classroomID != "") && (educationID != nonSelect && educationID != "")) {
  113. parameterString += "schoolyearID|*|" + schoolyearID + "|@|";
  114. parameterString += "weekNum|*|" + weekNum + "|@|";
  115. parameterString += "weekDay|*|" + weekday + "|@|";
  116. parameterString += "coursesTimeID|*|" + coursesTimeID + "|@|";
  117. parameterString += "classroomID|*|" + classroomID + "|@|";
  118. parameterString += "educationID|*|" + educationID + "|@|";
  119. if (parameterString != "") {
  120. jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
  121. $("#CoursematerialID").combogridX("reload", eval(jsonString));
  122. } else {
  123. $("#CoursematerialID").combogridX("reload");
  124. }
  125. }
  126. $.post(CMS_SystemConfig.VirtualDirectoryPath + '/EducationMissionClassCheck/GetTeacherNameByEducationMissionClassID', { QueryParamsDatas: parameterString }, function (data) {
  127. $("#TeacherName").val(data.Message);
  128. });
  129. }
  130. function EducationMissionClassCheck_AddStaff() {
  131. $.popupTopWindow('教师信息', CMS_SystemConfig.VirtualDirectoryPath + '/EducationMissionClass/TeacherSelect?FromMNU=' + mnu, 900, 500, AddTeachers_Confirm);
  132. }
  133. function EducationMissionClassCheck_DeleteStaff() {
  134. var d = validChoose();
  135. var teacherViewList = $("#dgTeacherList").cmsXDataTable("getRows");
  136. var i, j;
  137. var len = teacherViewList.length;
  138. for (i = len - 1; i >= 0; i--) {
  139. for (j = 0; j < d.length; j++) {
  140. if (teacherViewList[i].UserID == d[j].UserID) {
  141. teacherViewList.splice(i, 1);
  142. break;
  143. }
  144. }
  145. }
  146. $("#dgTeacherList").cmsXDataTable("loadData", { rows: teacherViewList, total: teacherViewList.length });
  147. }
  148. function AddTeachers_Confirm(teacherList) {
  149. if (!teacherList) return;
  150. var teacherViewList = $("#dgTeacherList").cmsXDataTable("getRows");
  151. $.each(teacherList, function (index, value) {
  152. if ($.grep(teacherViewList, function (row, index) { return value.UserID == row.UserID; }).length == 0) {
  153. teacherViewList.push({
  154. UserID: value.UserID,
  155. LoginID: value.StaffCode,
  156. Name: value.Name,
  157. CollegeID: value.CollegeID,
  158. CollegeName: value.CollegeName,
  159. BirthDate: value.BirthDate,
  160. TeacherType: value.TeacherType,
  161. TeacherTypeName: value.TeacherTypeName,
  162. IncumbencyState: value.IncumbencyState,
  163. IncumbencyStateName: value.IncumbencyStateName,
  164. Title: value.Title,
  165. TitleName: value.TitleName,
  166. TeachingMethod: 0, //默認选取的数据为主讲课
  167. TeachingMethodDesc: null,
  168. SexName: value.SexName,
  169. DepartmentName: value.DepartmentName,
  170. DepartmentID: value.DepartmentID
  171. });
  172. }
  173. });
  174. $("#dgTeacherList").cmsXDataTable("loadData", { rows: teacherViewList, total: teacherViewList.length });
  175. }