StudentSelectCourse.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. function selectCourseClick(index, row) {
  2. $(event.srcElement).attr("disabled", "disabled");
  3. if (row.IsSelected) {
  4. cancelSelectCourse(row.SelectCourseTypeID, row.CoursematerialID, row.CourseName, row.TeacherIDs, row.ID, $(event.srcElement));
  5. } else {
  6. selectCourse(row.SelectCourseTypeID, row.CoursematerialID, row.CourseName, row.TeacherIDs, row.ID, $(event.srcElement));
  7. }
  8. }
  9. function selectCourse(selectCourseTypeID, coursematerialID, courseName, teacherIDs, ID, control) {
  10. $.messager.confirm("系统提示", "是否确定选择修读" + courseName + "?",
  11. function (r) {
  12. if (r) {
  13. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/StudentSelectCourse/SelectCourse', {
  14. grademajorID: $("#GrademajorID").val(),
  15. coursematerialID: coursematerialID,
  16. selectCourseTypeID: selectCourseTypeID,
  17. teacherIDs: teacherIDs,
  18. ID: ID
  19. }, function (data) {
  20. if (data.IsSuccess) {
  21. $.messager.alert("系统提示", "选修成功。");
  22. setTimeout("location.reload(true)",2000);
  23. } else {
  24. $.messager.alert("系统提示", data.Message);
  25. }
  26. control.removeAttr("disabled");
  27. }
  28. );
  29. } else {
  30. control.removeAttr("disabled");
  31. }
  32. });
  33. }
  34. function cancelSelectCourse(selectCourseTypeID, coursematerialID, courseName, teacherIDs, ID, control) {
  35. $.messager.confirm("系统提示", "是否确定取消修读" + courseName + "?",
  36. function (r) {
  37. if (r) {
  38. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/StudentSelectCourse/CancelSelectCourse', {
  39. grademajorID: $("#GrademajorID").val(),
  40. coursematerialID: coursematerialID,
  41. selectCourseTypeID: selectCourseTypeID,
  42. teacherIDs: teacherIDs,
  43. ID: ID
  44. }, function (data) {
  45. if (data.IsSuccess) {
  46. $.messager.alert("系统提示", "取消成功。");
  47. setTimeout("location.reload(true)", 2000);
  48. } else {
  49. $.messager.alert("系统提示", data.Message);
  50. }
  51. control.removeAttr("disabled");
  52. }
  53. );
  54. } else {
  55. control.removeAttr("disabled");
  56. }
  57. });
  58. }
  59. function reload() {
  60. $("#dgStudentSelectCourseList").cmsXDataTable("load", $.getDataGridParams("dgStudentSelectCourseList"));
  61. }