//加载 $(function () { //非负浮点数(/^[1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0$/) var reg = /^[1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0$/; var learnSystem = $("#LearnSystem").val(); if (learnSystem == "" || learnSystem == null) { $("#LearnSystem").val(""); } else { if (!reg.test(learnSystem)) { $("#LearnSystem").val(""); } else { $("#LearnSystem").val(parseFloat(learnSystem).toFixed(1)); } } $("#Credit").val(parseFloat($("#Credit").val())); $("#TheoryCourse").keyup(function () { recalculate(); }); $("#Practicehours").keyup(function () { recalculate(); }); $("#TheoryWeeklyNum").keyup(function () { recalculate(); }); $("#PracticeWeeklyNum").keyup(function () { recalculate(); }); $("#teachingSettingExpander").closest("tr") .next().css("display", "") .next().css("display", "none") .next().css("display", "none") .next().css("display", "none") .next().css("display", "none") .next().css("display", "none") .next().css("display", "none"); $("#teachingSettingExpander").attr("expanded", "1"); $("#otherExpander").closest("tr") .next().css("display", "none") .next().css("display", "none") .next().css("display", "none") .next().css("display", "none") .next().css("display", "none") .next().css("display", "") .next().css("display", "") .next().css("display", "") .next().css("display", "none"); $("#otherExpander").attr("expanded", "1"); }); //相关计算 function recalculate() { var theoryCourse = parseInt($("#TheoryCourse").val() == "" ? "0" : $("#TheoryCourse").val()); var practicehours = parseInt($("#Practicehours").val() == "" ? "0" : $("#Practicehours").val()); var theoryWeeklyNum = parseInt($("#TheoryWeeklyNum").val() == "" ? "0" : $("#TheoryWeeklyNum").val()); var practiceWeeklyNum = parseInt($("#PracticeWeeklyNum").val() == "" ? "0" : $("#PracticeWeeklyNum").val()); var totalHours = theoryCourse + practicehours; var totalWeeklyNum = theoryWeeklyNum + practiceWeeklyNum; var weeklyHours = totalHours / totalWeeklyNum; var weeklyNum = weeklyHours / 2; $("#Totalhours").val(totalHours); if (totalWeeklyNum != 0) { $("#SchoolweeksNum").val(totalWeeklyNum); $("#WeeklyHours").val(weeklyHours); $("#WeeklyNum").val(weeklyNum); } } //点击收缩(教学设置信息) function swapTeachingSetting() { if ($("#teachingSettingExpander").attr("expanded") == "1") { $("#teachingSettingExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -32px 0"); $("#teachingSettingExpander").closest("tr") .next().css("display", "") .next().css("display", "") .next().css("display", "") .next().css("display", "") .next().css("display", "") .next().css("display", "") .next().css("display", ""); $("#teachingSettingExpander").attr("expanded", "0"); } else { $("#teachingSettingExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -50px 0"); $("#teachingSettingExpander").closest("tr") .next().css("display", "") .next().css("display", "none") .next().css("display", "none") .next().css("display", "none") .next().css("display", "none") .next().css("display", "none") .next().css("display", "none"); $("#teachingSettingExpander").attr("expanded", "1"); } } //点击收缩(其它信息) function swapother() { if ($("#otherExpander").attr("expanded") == "1") { $("#otherExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -32px 0"); $("#otherExpander").closest("tr") .next().css("display", "") .next().css("display", "") .next().css("display", "") .next().css("display", "") .next().css("display", "") .next().css("display", "") .next().css("display", "") .next().css("display", "") .next().css("display", ""); $("#otherExpander").attr("expanded", "0"); } else { $("#otherExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -50px 0"); $("#otherExpander").closest("tr") .next().css("display", "none") .next().css("display", "none") .next().css("display", "none") .next().css("display", "none") .next().css("display", "none") .next().css("display", "") .next().css("display", "") .next().css("display", "") .next().css("display", "none"); $("#otherExpander").attr("expanded", "1"); } } //设置列颜色为红色 function SetRedColumn(index, row, value) { return " " + value + ""; } //联动 function querySpecialty(data) { var specialtyID = $("#SpecialtyID").combogridX("getValue"); if (specialtyID == "" || specialtyID == "-1" || specialtyID == null) { $("#StandardCode").val(""); $("#EducationID").combobox("setValue", "-1"); $("#LearningformID").combobox("setValue", "-1"); $("#LearnSystem").val(""); } else { $("#StandardCode").val(data.Code); $("#EducationID").combobox("setValue", data.EducationID); $("#LearningformID").combobox("setValue", data.LearningformID); $("#LearnSystem").val(data.LearnSystem); } } //保存 function SpecialtyCourse_Save() { if ($("input[name='TeachingModeIDList']: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(); }