$(function () { $("#StudentNum").attr("disabled", true); $("#GroupNum").attr("disabled", true); $("#IsAverageStudent").click(function () { $("#IsGroup").attr("checked", false); $("#OrderType").attr("checked", false); $("#StudentNum").attr("disabled", false); $("#GroupNum").attr("disabled", true); }); $("#IsGroup").click(function () { $("#IsAverageStudent").attr("checked", false); $("#OrderType").attr("checked", false); $("#StudentNum").attr("disabled", true); $("#GroupNum").attr("disabled", false); }); $("#OrderType").click(function () { $("#IsAverageStudent").attr("checked", false); $("#IsGroup").attr("checked", false); $("#StudentNum").attr("disabled", true); $("#GroupNum").attr("disabled", true); }); $("#StudentNum").blur(function () { AverageNum(true); }); $("#GroupNum").blur(function () { AverageNum(false); }); }) //平均 function AverageNum(obj) { var studentTotalNum = $("#StudentTotalNum").val() == "NaN" ? "0" : $("#StudentTotalNum").val(); var studentNum = $("#StudentNum").val() == "NaN" ? "0" : $("#StudentNum").val(); var groupNum = $("#GroupNum").val() == "NaN" ? "0" : $("#GroupNum").val(); var totalnum = 0; //按人数进行分班 if (obj) { if (studentTotalNum != 0) totalnum = Math.round(parseInt(studentTotalNum) / parseInt(studentNum)); $("#hid_StudentNum").val(studentNum); $("#hid_GroupNum").val(parseInt(totalnum)); $("#GroupNum").val(parseInt(totalnum)); } else { if (studentTotalNum != 0) totalnum = Math.round(parseInt(studentTotalNum) / parseInt(groupNum)); $("#hid_GroupNum").val(groupNum); $("#hid_StudentNum").val(parseInt(totalnum)); $("#StudentNum").val(parseInt(totalnum)); } } //保存 function EducationMissionClass_DivideSave() { var studentNum = $("#StudentNum").val(); var groupNum = $("#GroupNum").val(); var OrderType = $("#OrderType").val(); var isNotBuildEducationMission = $("#IsNotBuildEducationMission").is(':checked'); //var isNotBuildEducationMission = $("#IsNotBuildEducationMission").val(); var isMerge = ""; if ((studentNum == "" || groupNum == "") && OrderType != "true") { $.messager.alert("系统提示", "请填写平均每班学生人数或组数!"); return; } if (isNotBuildEducationMission) { isMerge = "合并"; } else { isMerge = "分开" } var msg = "当前分组在成绩录入时将" + isMerge + "录入,请确认是否正确?" $.messager.confirm("系统提示", msg, function (r) { if (r) { $(document.forms[0]).submit(); } }); }