SpecialtyPlanEdit.js 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. //加载
  2. $(function () {
  3. //非负浮点数(/^[1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0$/)
  4. var reg = /^[1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0$/;
  5. var learnSystem = $("#LearnSystem").val();
  6. if (learnSystem == "" || learnSystem == null) {
  7. $("#LearnSystem").val("");
  8. }
  9. else {
  10. if (!reg.test(learnSystem)) {
  11. $("#LearnSystem").val("");
  12. }
  13. else {
  14. $("#LearnSystem").val(parseFloat(learnSystem).toFixed(1));
  15. }
  16. }
  17. $("#Credit").val(parseFloat($("#Credit").val()));
  18. $("#TheoryCourse").keyup(function () {
  19. recalculate();
  20. });
  21. $("#Practicehours").keyup(function () {
  22. recalculate();
  23. });
  24. $("#TheoryWeeklyNum").keyup(function () {
  25. recalculate();
  26. });
  27. $("#PracticeWeeklyNum").keyup(function () {
  28. recalculate();
  29. });
  30. $("#teachingSettingExpander").closest("tr")
  31. .next().css("display", "")
  32. .next().css("display", "none")
  33. .next().css("display", "none")
  34. .next().css("display", "none")
  35. .next().css("display", "none")
  36. .next().css("display", "none")
  37. .next().css("display", "none");
  38. $("#teachingSettingExpander").attr("expanded", "1");
  39. $("#otherExpander").closest("tr")
  40. .next().css("display", "none")
  41. .next().css("display", "none")
  42. .next().css("display", "none")
  43. .next().css("display", "none")
  44. .next().css("display", "none")
  45. .next().css("display", "")
  46. .next().css("display", "")
  47. .next().css("display", "none");
  48. $("#otherExpander").attr("expanded", "1");
  49. });
  50. //相关计算
  51. function recalculate() {
  52. var theoryCourse = parseInt($("#TheoryCourse").val() == "" ? "0" : $("#TheoryCourse").val());
  53. var practicehours = parseInt($("#Practicehours").val() == "" ? "0" : $("#Practicehours").val());
  54. var theoryWeeklyNum = parseInt($("#TheoryWeeklyNum").val() == "" ? "0" : $("#TheoryWeeklyNum").val());
  55. var practiceWeeklyNum = parseInt($("#PracticeWeeklyNum").val() == "" ? "0" : $("#PracticeWeeklyNum").val());
  56. var totalHours = theoryCourse + practicehours;
  57. var totalWeeklyNum = theoryWeeklyNum + practiceWeeklyNum;
  58. var weeklyHours = totalHours / totalWeeklyNum;
  59. var weeklyNum = weeklyHours / 2;
  60. $("#Totalhours").val(totalHours);
  61. if (totalWeeklyNum != 0) {
  62. $("#SchoolweeksNum").val(totalWeeklyNum);
  63. $("#WeeklyHours").val(weeklyHours);
  64. $("#WeeklyNum").val(weeklyNum);
  65. }
  66. }
  67. //点击收缩(教学设置信息)
  68. function swapTeachingSetting() {
  69. if ($("#teachingSettingExpander").attr("expanded") == "1") {
  70. $("#teachingSettingExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -32px 0");
  71. $("#teachingSettingExpander").closest("tr")
  72. .next().css("display", "")
  73. .next().css("display", "")
  74. .next().css("display", "")
  75. .next().css("display", "")
  76. .next().css("display", "")
  77. .next().css("display", "")
  78. .next().css("display", "");
  79. $("#teachingSettingExpander").attr("expanded", "0");
  80. } else {
  81. $("#teachingSettingExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -50px 0");
  82. $("#teachingSettingExpander").closest("tr")
  83. .next().css("display", "")
  84. .next().css("display", "none")
  85. .next().css("display", "none")
  86. .next().css("display", "none")
  87. .next().css("display", "none")
  88. .next().css("display", "none")
  89. .next().css("display", "none");
  90. $("#teachingSettingExpander").attr("expanded", "1");
  91. }
  92. }
  93. //点击收缩(其它信息)
  94. function swapother() {
  95. if ($("#otherExpander").attr("expanded") == "1") {
  96. $("#otherExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -32px 0");
  97. $("#otherExpander").closest("tr")
  98. .next().css("display", "")
  99. .next().css("display", "")
  100. .next().css("display", "")
  101. .next().css("display", "")
  102. .next().css("display", "")
  103. .next().css("display", "")
  104. .next().css("display", "")
  105. .next().css("display", "");
  106. $("#otherExpander").attr("expanded", "0");
  107. } else {
  108. $("#otherExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -50px 0");
  109. $("#otherExpander").closest("tr")
  110. .next().css("display", "none")
  111. .next().css("display", "none")
  112. .next().css("display", "none")
  113. .next().css("display", "none")
  114. .next().css("display", "none")
  115. .next().css("display", "")
  116. .next().css("display", "")
  117. .next().css("display", "none");
  118. $("#otherExpander").attr("expanded", "1");
  119. }
  120. }
  121. //设置列颜色为红色
  122. function SetRedColumn(index, row, value) {
  123. return " <span style=\"color: red;\">" + value + "</span>";
  124. }
  125. //联动
  126. function queryGrademajor(data) {
  127. var grademajorID = $("#GrademajorID").combogridX("getValue");
  128. if (grademajorID == "" || grademajorID == "-1" || grademajorID == null) {
  129. $("#GradeID").combobox("setValue", "-1");
  130. $("#StandardCode").val("");
  131. $("#StandardID").combobox("setValue", "-1");
  132. $("#EducationID").combobox("setValue", "-1");
  133. $("#LearningformID").combobox("setValue", "-1");
  134. $("#LearnSystem").val("");
  135. }
  136. else {
  137. $("#GradeID").combobox("setValue", data.SchoolyearID);
  138. $("#StandardCode").val(data.StandardCode);
  139. $("#StandardID").combobox("setValue", data.StandardID);
  140. $("#EducationID").combobox("setValue", data.EducationID);
  141. $("#LearningformID").combobox("setValue", data.LearningformID);
  142. $("#LearnSystem").val(data.LearnSystem);
  143. }
  144. }
  145. //保存
  146. function SpecialtyPlan_Save() {
  147. if ($("input[name='TeachingModeIDList']:checked").length == 0) {
  148. $.messager.alert("系统提示", "请选择至少一种授课方式。");
  149. return;
  150. }
  151. if (!isNaN($("#Trialhours").val()) && $("#Trialhours").val() != ""
  152. && !isNaN($("#Practicehours").val()) && $("#Practicehours").val() != ""
  153. && parseFloat($("#Trialhours").val()) > parseFloat($("#Practicehours").val())) {
  154. $.messager.alert("系统提示", "实验学时不能大于实践学时。");
  155. return;
  156. }
  157. if (!isNaN($("#TrialWeeklyNum").val()) && $("#TrialWeeklyNum").val() != ""
  158. && !isNaN($("#PracticeWeeklyNum").val()) && $("#PracticeWeeklyNum").val() != ""
  159. && parseFloat($("#TrialWeeklyNum").val()) > parseFloat($("#PracticeWeeklyNum").val())) {
  160. $.messager.alert("系统提示", "实验周次不能大于实践周次。");
  161. return;
  162. }
  163. $(document.forms[0]).submit();
  164. }