MinorSpecialtyCourseEdit.js 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 MinorSpecialtyCourse_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. }
  65. function swapWeekSettings() {
  66. if ($("#weekExpander").attr("expanded") == "0") {
  67. $("#weekExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -50px 0");
  68. $("#weekExpander").closest("tr")
  69. .next().css("display", "")
  70. .next().css("display", "")
  71. .next().css("display", "")
  72. .next().css("display", "");
  73. $("#weekExpander").attr("expanded", "1");
  74. } else {
  75. $("#weekExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -32px 0");
  76. $("#weekExpander").closest("tr")
  77. .next().css("display", "none")
  78. .next().css("display", "none")
  79. .next().css("display", "none")
  80. .next().css("display", "none");
  81. $("#weekExpander").attr("expanded", "0");
  82. }
  83. }