DivideIntoClassesEdit.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. $(function () {
  2. $("#StudentNum").attr("disabled", true);
  3. $("#GroupNum").attr("disabled", true);
  4. $("#IsAverageStudent").click(function () {
  5. $("#IsGroup").attr("checked", false);
  6. $("#OrderType").attr("checked", false);
  7. $("#StudentNum").attr("disabled", false);
  8. $("#GroupNum").attr("disabled", true);
  9. });
  10. $("#IsGroup").click(function () {
  11. $("#IsAverageStudent").attr("checked", false);
  12. $("#OrderType").attr("checked", false);
  13. $("#StudentNum").attr("disabled", true);
  14. $("#GroupNum").attr("disabled", false);
  15. });
  16. $("#OrderType").click(function () {
  17. $("#IsAverageStudent").attr("checked", false);
  18. $("#IsGroup").attr("checked", false);
  19. $("#StudentNum").attr("disabled", true);
  20. $("#GroupNum").attr("disabled", true);
  21. });
  22. $("#StudentNum").blur(function () {
  23. AverageNum(true);
  24. });
  25. $("#GroupNum").blur(function () {
  26. AverageNum(false);
  27. });
  28. })
  29. //平均
  30. function AverageNum(obj) {
  31. var studentTotalNum = $("#StudentTotalNum").val() == "NaN" ? "0" : $("#StudentTotalNum").val();
  32. var studentNum = $("#StudentNum").val() == "NaN" ? "0" : $("#StudentNum").val();
  33. var groupNum = $("#GroupNum").val() == "NaN" ? "0" : $("#GroupNum").val();
  34. var totalnum = 0;
  35. //按人数进行分班
  36. if (obj) {
  37. if (studentTotalNum != 0)
  38. totalnum = Math.round(parseInt(studentTotalNum) / parseInt(studentNum));
  39. $("#hid_StudentNum").val(studentNum);
  40. $("#hid_GroupNum").val(parseInt(totalnum));
  41. $("#GroupNum").val(parseInt(totalnum));
  42. } else {
  43. if (studentTotalNum != 0)
  44. totalnum = Math.round(parseInt(studentTotalNum) / parseInt(groupNum));
  45. $("#hid_GroupNum").val(groupNum);
  46. $("#hid_StudentNum").val(parseInt(totalnum));
  47. $("#StudentNum").val(parseInt(totalnum));
  48. }
  49. }
  50. //保存
  51. function EducationMissionClass_DivideSave() {
  52. var studentNum = $("#StudentNum").val();
  53. var groupNum = $("#GroupNum").val();
  54. var OrderType = $("#OrderType").val();
  55. var isNotBuildEducationMission = $("#IsNotBuildEducationMission").is(':checked');
  56. //var isNotBuildEducationMission = $("#IsNotBuildEducationMission").val();
  57. var isMerge = "";
  58. if ((studentNum == "" || groupNum == "") && OrderType != "true") {
  59. $.messager.alert("系统提示", "请填写平均每班学生人数或组数!");
  60. return;
  61. }
  62. if (isNotBuildEducationMission) {
  63. isMerge = "合并";
  64. }
  65. else {
  66. isMerge = "分开"
  67. }
  68. var msg = "当前分组在成绩录入时将" + isMerge + "录入,请确认是否正确?"
  69. $.messager.confirm("系统提示", msg, function (r) {
  70. if (r) {
  71. $(document.forms[0]).submit();
  72. }
  73. });
  74. }