123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- //加载
- $(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 " <span style=\"color: red;\">" + value + "</span>";
- }
- //联动
- 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();
- }
|