function recalculate() { var theoryCourse = parseInt($("#TheoryCourse").val() == "" ? "0" : $("#TheoryCourse").val()); var practicehours = parseInt($("#Practicehours").val() == "" ? "0" : $("#Practicehours").val()); var Trialhours = parseInt($("#Trialhours").val() == "" ? "0" : $("#Trialhours").val()); var theoryWeeklyNum = parseInt($("#TheoryWeeklyNum").val() == "" ? "0" : $("#TheoryWeeklyNum").val()); var practiceWeeklyNum = parseInt($("#PracticeWeeklyNum").val() == "" ? "0" : $("#PracticeWeeklyNum").val()); var TrialWeeklyNum = parseInt($("#TrialWeeklyNum").val() == "" ? "0" : $("#TrialWeeklyNum").val()); var totalHours = theoryCourse + practicehours + Trialhours; var totalWeeklyNum = theoryWeeklyNum + practiceWeeklyNum + TrialWeeklyNum; var weeklyHours = totalHours / totalWeeklyNum; var weeklyNum = weeklyHours / 2; $("#Totalhours").val(totalHours); if (totalWeeklyNum != 0) { $("#SchoolweeksNum").val(totalWeeklyNum); $("#WeeklyHours").val(weeklyHours); $("#WeeklyNum").val(weeklyNum); } } $(function () { $("#Credit").val(parseFloat($("#Credit").val()).toFixed(1)); $("#TheoryCourse").keyup(function () { recalculate(); }); $("#Practicehours").keyup(function () { recalculate(); }); $("#Trialhours").keyup(function () { recalculate(); }); $("#TheoryWeeklyNum").keyup(function () { recalculate(); }); $("#PracticeWeeklyNum").keyup(function () { recalculate(); }); $("#TrialWeeklyNum").keyup(function () { recalculate(); }); $("#weekExpander").closest("tr") .next().css("display", "") .next().css("display", "") .next().css("display", "") .next().css("display", ""); $("#weekExpander").attr("expanded", "1"); }); function MinorSpecialtyCourse_Save() { if ($("input[name='TeachingModeID']:checked").length == 0) { $.messager.alert("系统提示", "请选择至少一种授课方式。"); return; } if (!isNaN($("#Trialhours").val()) && $("#Trialhours").val() != "" && !isNaN($("#Practicehours").val()) && $("#Practicehours").val() != "" && parseFloat($("#Trialhours").val()) > parseFloat($("#Practicehours").val())) { $.messager.alert("系统提示", "实验学时不能大于实践学时。"); return; } if (!isNaN($("#TrialWeeklyNum").val()) && $("#TrialWeeklyNum").val() != "" && !isNaN($("#PracticeWeeklyNum").val()) && $("#PracticeWeeklyNum").val() != "" && parseFloat($("#TrialWeeklyNum").val()) > parseFloat($("#PracticeWeeklyNum").val())) { $.messager.alert("系统提示", "实验周次不能大于实践周次。"); return; } $(document.forms[0]).submit(); } function swapWeekSettings() { if ($("#weekExpander").attr("expanded") == "0") { $("#weekExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -50px 0"); $("#weekExpander").closest("tr") .next().css("display", "") .next().css("display", "") .next().css("display", "") .next().css("display", ""); $("#weekExpander").attr("expanded", "1"); } else { $("#weekExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -32px 0"); $("#weekExpander").closest("tr") .next().css("display", "none") .next().css("display", "none") .next().css("display", "none") .next().css("display", "none"); $("#weekExpander").attr("expanded", "0"); } }