GenerateExecutableMinorPlanEdit.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. function recalculate() {
  2. var theoryCourse = parseInt($("#TheoryCourse").val() == "" ? "0" : $("#TheoryCourse").val());
  3. var practicehours = parseInt($("#Practicehours").val() == "" ? "0" : $("#Practicehours").val());
  4. var Trialhours = parseInt($("#Trialhours").val() == "" ? "0" : $("#Trialhours").val());
  5. var theoryWeeklyNum = parseInt($("#TheoryWeeklyNum").val() == "" ? "0" : $("#TheoryWeeklyNum").val());
  6. var practiceWeeklyNum = parseInt($("#PracticeWeeklyNum").val() == "" ? "0" : $("#PracticeWeeklyNum").val());
  7. var TrialWeeklyNum = parseInt($("#TrialWeeklyNum").val() == "" ? "0" : $("#TrialWeeklyNum").val());
  8. var totalHours = theoryCourse + practicehours + Trialhours;
  9. var totalWeeklyNum = theoryWeeklyNum + practiceWeeklyNum + TrialWeeklyNum;
  10. var weeklyHours = totalHours / totalWeeklyNum;
  11. var weeklyNum = weeklyHours / 2;
  12. $("#Totalhours").val(totalHours);
  13. if (totalWeeklyNum != 0) {
  14. $("#SchoolweeksNum").val(totalWeeklyNum);
  15. $("#WeeklyHours").val(weeklyHours);
  16. $("#WeeklyNum").val(weeklyNum);
  17. }
  18. }
  19. $(function () {
  20. $("#Credit").val(parseFloat($("#Credit").val()).toFixed(1));
  21. $("#TheoryCourse").keyup(function () {
  22. recalculate();
  23. });
  24. $("#Practicehours").keyup(function () {
  25. recalculate();
  26. });
  27. $("#Trialhours").keyup(function () {
  28. recalculate();
  29. });
  30. $("#TheoryWeeklyNum").keyup(function () {
  31. recalculate();
  32. });
  33. $("#PracticeWeeklyNum").keyup(function () {
  34. recalculate();
  35. });
  36. $("#TrialWeeklyNum").keyup(function () {
  37. recalculate();
  38. });
  39. $("#weekExpander").closest("tr")
  40. .next().css("display", "")
  41. .next().css("display", "")
  42. .next().css("display", "")
  43. .next().css("display", "");
  44. $("#weekExpander").attr("expanded", "1");
  45. });
  46. function ExecutableMinorPlan_Save() {
  47. if ($("input[name='TeachingModeID']:checked").length == 0) {
  48. $.messager.alert("系统提示", "请选择至少一种授课方式。");
  49. return;
  50. }
  51. if (!isNaN($("#Trialhours").val()) && $("#Trialhours").val() != ""
  52. && !isNaN($("#Practicehours").val()) && $("#Practicehours").val() != ""
  53. && parseFloat($("#Trialhours").val()) > parseFloat($("#Practicehours").val())) {
  54. $.messager.alert("系统提示", "实验学时不能大于实践学时。");
  55. return;
  56. }
  57. if (!isNaN($("#TrialWeeklyNum").val()) && $("#TrialWeeklyNum").val() != ""
  58. && !isNaN($("#PracticeWeeklyNum").val()) && $("#PracticeWeeklyNum").val() != ""
  59. && parseFloat($("#TrialWeeklyNum").val()) > parseFloat($("#PracticeWeeklyNum").val())) {
  60. $.messager.alert("系统提示", "实验周次不能大于实践周次。");
  61. return;
  62. }
  63. $(document.forms[0]).submit();
  64. }