OptionalCoursePlanEdit.js 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. function OptionalCoursePlan_Save() {
  2. if ($("input[name='TeachingModeID']:checked").length == 0) {
  3. $.messager.alert("系统提示", "请选择至少一种授课方式。");
  4. return;
  5. }
  6. if (parseInt($("#PeopleNumlower").val()) > parseInt($("#PeopleNumlimit").val())) {
  7. $.messager.alert("系统信息", "人数上限不能小于下限。");
  8. return;
  9. }
  10. if (!isNaN($("#Trialhours").val()) && $("#Trialhours").val() != ""
  11. && !isNaN($("#Practicehours").val()) && $("#Practicehours").val() != ""
  12. && parseFloat($("#Trialhours").val()) > parseFloat($("#Practicehours").val())) {
  13. $.messager.alert("系统提示", "实验学时不能大于实践学时。");
  14. return;
  15. }
  16. if (!isNaN($("#TrialWeeklyNum").val()) && $("#TrialWeeklyNum").val() != ""
  17. && !isNaN($("#PracticeWeeklyNum").val()) && $("#PracticeWeeklyNum").val() != ""
  18. && parseFloat($("#TrialWeeklyNum").val()) > parseFloat($("#PracticeWeeklyNum").val())) {
  19. $.messager.alert("系统提示", "实验周次不能大于实践周次。");
  20. return;
  21. }
  22. $(document.forms[0]).submit();
  23. }
  24. $(function () {
  25. mnu = $.SystemGeneral.getUrlParam("MNU");
  26. $("#Credit").val(parseFloat($("#Credit").val()).toFixed(1));
  27. $("#TheoryCourse").keyup(function () {
  28. recalculate();
  29. });
  30. $("#Practicehours").keyup(function () {
  31. recalculate();
  32. });
  33. $("#TheoryWeeklyNum").keyup(function () {
  34. recalculate();
  35. });
  36. $("#PracticeWeeklyNum").keyup(function () {
  37. recalculate();
  38. });
  39. // if (document.getElementById("RecordStatusName") != "未提交")
  40. // document.getElementById("IsOpened").disabled = true;
  41. // else
  42. // document.getElementById("IsOpened").disabled = false;
  43. });
  44. function swapWeekSettings() {
  45. if ($("#weekExpander").attr("expanded") == "0") {
  46. $("#weekExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -50px 0");
  47. $("#weekExpander").closest("tr")
  48. .next().css("display", "")
  49. .next().css("display", "")
  50. .next().css("display", "")
  51. .next().css("display", "");
  52. $("#weekExpander").attr("expanded", "1");
  53. } else {
  54. $("#weekExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -32px 0");
  55. $("#weekExpander").closest("tr")
  56. .next().css("display", "none")
  57. .next().css("display", "none")
  58. .next().css("display", "none")
  59. .next().css("display", "none");
  60. $("#weekExpander").attr("expanded", "0");
  61. }
  62. }
  63. function recalculate() {
  64. var theoryCourse = parseInt($("#TheoryCourse").val() == "" ? "0" : $("#TheoryCourse").val());
  65. var practicehours = parseInt($("#Practicehours").val() == "" ? "0" : $("#Practicehours").val());
  66. var theoryWeeklyNum = parseInt($("#TheoryWeeklyNum").val() == "" ? "0" : $("#TheoryWeeklyNum").val());
  67. var practiceWeeklyNum = parseInt($("#PracticeWeeklyNum").val() == "" ? "0" : $("#PracticeWeeklyNum").val());
  68. var totalHours = theoryCourse + practicehours;
  69. var totalWeeklyNum = theoryWeeklyNum + practiceWeeklyNum;
  70. var weeklyHours = totalHours / totalWeeklyNum;
  71. var weeklyNum = weeklyHours / 2;
  72. $("#Totalhours").val(totalHours);
  73. if (totalWeeklyNum != 0) {
  74. $("#SchoolweeksNum").val(totalWeeklyNum);
  75. $("#WeeklyHours").val(weeklyHours);
  76. $("#WeeklyNum").val(weeklyNum);
  77. }
  78. }
  79. //function reload() {
  80. // $("#dgGrademajorAndSpecialtyCourseList").cmsXDataTable("load", $.getDataGridParams("dgGrademajorAndSpecialtyCourseList"));
  81. //}
  82. //function QueryGrademajorGridOptions() {
  83. // reload();
  84. //}
  85. ////获取选中的数据
  86. //function validChoose() {
  87. // var d = [];
  88. // $.each($("#dgGrademajorAndSpecialtyCourseList").cmsXDataTable("getSelections"), function (index) {
  89. // d.push(this.SpecialtyCourseID);
  90. // });
  91. // return d;
  92. //}