AdultSpecialtyPlanBatchAdd.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. //刷新
  2. function reload() {
  3. $("#dgAdultSpecialtyCourseNoAddList").cmsXDataTable("load", $.getDataGridParams("dgAdultSpecialtyCourseNoAddList"));
  4. }
  5. //获取选中的数据
  6. function validChoose() {
  7. var d = [];
  8. $.each($("#dgAdultSpecialtyCourseNoAddList").cmsXDataTable("getSelections"), function (index) {
  9. d.push(this.SpecialtyCourseID);
  10. });
  11. return d;
  12. }
  13. //获取选中的数据All
  14. function validChooseAll() {
  15. var d = [];
  16. $.each($("#dgAdultSpecialtyCourseNoAddList").cmsXDataTable("getSelections"), function (index) {
  17. d.push(this);
  18. });
  19. return d;
  20. }
  21. //确定生成成功后不关闭弹出页面
  22. function formSuccessReloadNoClose(data) {
  23. if (data.IsSuccess == true) {
  24. reload();
  25. }
  26. $.messager.alert("系统提示", data.Message);
  27. }
  28. //计算规则(暂时不可用,需对以下计算进行优化)
  29. function SetTheoryWeeklyNum(rowindex, rowdata) {
  30. //总周时=理论学时+实践学时
  31. //总周次=理论周次+实践周次
  32. //周学时=总学时/总周次
  33. //每周次数=周学时/2
  34. var totalhours = (Number(rowdata.TheoryCourse) + Number(rowdata.Practicehours)); //总周时
  35. var schoolweeksNum = (Number(rowdata.TheoryWeeklyNum) + Number(rowdata.PracticeWeeklyNum));//总周次
  36. var weeklyHours = (Number(rowdata.Totalhours) / Number(rowdata.SchoolweeksNum)).toFixed(0);//周学时
  37. var weeklyNum = (Number(rowdata.WeeklyHours / 2)).toFixed(0); //每周次数
  38. var tableRow = $('#dgAdultSpecialtyCourseNoAddList').find("tr.row[xRowIndex=" + rowindex + "]");
  39. $(tableRow.find("td")[9]).children().val(totalhours);
  40. $(tableRow.find("td")[13]).children().val(schoolweeksNum);
  41. $(tableRow.find("td")[14]).children().val(weeklyHours);
  42. $(tableRow.find("td")[15]).children().val(weeklyNum);
  43. }
  44. //设置列颜色为红色
  45. function SetRedColumn(index, row, value) {
  46. return " <span style=\"color: red;\">" + value + "</span>";
  47. }
  48. //联动查询
  49. function queryCollege() {
  50. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  51. if (collegeID != nonSelect) {
  52. var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + collegeID + "|@|'})";
  53. $("#DepartmentDropdown").combogridX("reload", eval(jsonString));
  54. }
  55. else {
  56. $("#DepartmentDropdown").combogridX("reload");
  57. }
  58. reload();
  59. }
  60. function queryEducation(data) {
  61. $("#SpecialtyID").combogridX("setValue", "-1");
  62. queryClass();
  63. }
  64. function queryLearningform(data) {
  65. $("#SpecialtyID").combogridX("setValue", "-1");
  66. queryClass();
  67. }
  68. function queryLearnSystem(data) {
  69. $("#SpecialtyID").combogridX("setValue", "-1");
  70. queryClass();
  71. }
  72. function queryClass() {
  73. var jsonString = "";
  74. var parameterString = "";
  75. var educationID = $("#DictionaryEducation").combogridX("getValue");
  76. var learningFormID = $("#DictionaryLearningform").combogridX("getValue");
  77. var learnSystem = $("#DictionaryLearnSystem").combogridX("getValue");
  78. if (educationID != nonSelect) parameterString += "DictionaryEducation|*|" + educationID + "|@|";
  79. if (learningFormID != nonSelect) parameterString += "DictionaryLearningform|*|" + learningFormID + "|@|";
  80. if (learnSystem != nonSelect) parameterString += "DictionaryLearnSystem|*|" + learnSystem + "|@|";
  81. if (parameterString != "") {
  82. jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
  83. $("#SpecialtyID").combogridX("reload", eval(jsonString));
  84. }
  85. else {
  86. $("#SpecialtyID").combogridX("reload");
  87. }
  88. reload();
  89. }
  90. //确定
  91. function AdultSpecialtyPlanBatchAdd_Confirm() {
  92. var startSchoolcodeID = $("#StartSchoolcodeID").combogridX("getValue");
  93. if (startSchoolcodeID == "" || startSchoolcodeID == "-1" || startSchoolcodeID == null) {
  94. $.messager.alert("系统提示", "请选择入学学期。");
  95. return;
  96. }
  97. var gradeID = $("#GradeID").combogridX("getValue");
  98. if (gradeID == "" || gradeID == "-1" || gradeID == null) {
  99. $.messager.alert("系统提示", "请选择年级。");
  100. return;
  101. }
  102. var specialtyID = $("#SpecialtyID").combogridX("getValue");
  103. if (specialtyID == "" || specialtyID == "-1" || specialtyID == null) {
  104. $.messager.alert("系统提示", "请选择专业信息。");
  105. return;
  106. }
  107. var d = validChooseAll();
  108. if (d == "") {
  109. $.messager.alert("系统提示", "请选择您要新增的信息。");
  110. return;
  111. }
  112. //对选择申请的信息进行验证
  113. var regA = /^\d+(\.{0,1}\d+){0,1}$/; //非负数
  114. var regB = /^\d+$/; //非负整数
  115. for (var i = 0; i < d.length; i++) {
  116. var credit = d[i].Credit;
  117. var theoryCourse = d[i].TheoryCourse;
  118. var practicehours = d[i].Practicehours;
  119. var trialhours = d[i].Trialhours;
  120. var theoryWeeklyNum = d[i].TheoryWeeklyNum;
  121. var practiceWeeklyNum = d[i].PracticeWeeklyNum;
  122. var trialWeeklyNum = d[i].TrialWeeklyNum;
  123. var weeklyHours = d[i].WeeklyHours;
  124. var weeklyNum = d[i].WeeklyNum;
  125. var startWeeklyNum = d[i].StartWeeklyNum;
  126. var endWeeklyNum = d[i].EndWeeklyNum;
  127. var handleModeID = d[i].HandleModeID;
  128. if (isNaN(credit) || credit == null || credit.toString() == "") {
  129. $.messager.alert("系统信息", "课程学分不能为空或格式不正确(非负数字),请检查。");
  130. return;
  131. }
  132. if (!regA.test(credit)) {
  133. $.messager.alert("系统信息", "课程学分格式不正确(非负数字),请检查。");
  134. return;
  135. }
  136. if (isNaN(theoryCourse) || theoryCourse == null || theoryCourse.toString() == "") {
  137. $.messager.alert("系统信息", "理论学时不能为空或格式不正确(非负整数),请检查。");
  138. return;
  139. }
  140. if (!regB.test(theoryCourse)) {
  141. $.messager.alert("系统信息", "理论学时格式不正确(非负整数),请检查。");
  142. return;
  143. }
  144. if (isNaN(practicehours) || practicehours == null || practicehours.toString() == "") {
  145. $.messager.alert("系统信息", "实践学时不能为空或格式不正确(非负整数),请检查。");
  146. return;
  147. }
  148. if (!regB.test(practicehours)) {
  149. $.messager.alert("系统信息", "实践学时格式不正确(非负整数),请检查。");
  150. return;
  151. }
  152. if (isNaN(trialhours) || trialhours == null || trialhours.toString() == "") {
  153. $.messager.alert("系统信息", "实验学时不能为空或格式不正确(非负整数),请检查。");
  154. return;
  155. }
  156. if (!regB.test(trialhours)) {
  157. $.messager.alert("系统信息", "实验学时格式不正确(非负整数),请检查。");
  158. return;
  159. }
  160. if (isNaN(theoryWeeklyNum) || theoryWeeklyNum == null || theoryWeeklyNum.toString() == "") {
  161. $.messager.alert("系统信息", "理论周次不能为空或格式不正确(非负整数),请检查。");
  162. return;
  163. }
  164. if (!regB.test(theoryWeeklyNum)) {
  165. $.messager.alert("系统信息", "理论周次格式不正确(非负整数),请检查。");
  166. return;
  167. }
  168. if (isNaN(practiceWeeklyNum) || practiceWeeklyNum == null || practiceWeeklyNum.toString() == "") {
  169. $.messager.alert("系统信息", "实践周次不能为空或格式不正确(非负整数),请检查。");
  170. return;
  171. }
  172. if (!regB.test(practiceWeeklyNum)) {
  173. $.messager.alert("系统信息", "实践周次格式不正确(非负整数),请检查。");
  174. return;
  175. }
  176. if (isNaN(trialWeeklyNum) || trialWeeklyNum == null || trialWeeklyNum.toString() == "") {
  177. $.messager.alert("系统信息", "实验周次不能为空或格式不正确(非负整数),请检查。");
  178. return;
  179. }
  180. if (!regB.test(trialWeeklyNum)) {
  181. $.messager.alert("系统信息", "实验周次格式不正确(非负整数),请检查。");
  182. return;
  183. }
  184. if (isNaN(weeklyHours) || weeklyHours == null || weeklyHours.toString() == "") {
  185. $.messager.alert("系统信息", "周学时不能为空或格式不正确(非负整数),请检查。");
  186. return;
  187. }
  188. if (!regB.test(weeklyHours)) {
  189. $.messager.alert("系统信息", "周学时格式不正确(非负整数),请检查。");
  190. return;
  191. }
  192. if (isNaN(weeklyNum) || weeklyNum == null || weeklyNum.toString() == "") {
  193. $.messager.alert("系统信息", "每周次数不能为空或格式不正确(非负整数),请检查。");
  194. return;
  195. }
  196. if (!regB.test(weeklyNum)) {
  197. $.messager.alert("系统信息", "每周次数格式不正确(非负整数),请检查。");
  198. return;
  199. }
  200. if (isNaN(startWeeklyNum) || startWeeklyNum == null || startWeeklyNum.toString() == "") {
  201. $.messager.alert("系统信息", "开始周次不能为空或格式不正确(非负整数),请检查。");
  202. return;
  203. }
  204. if (!regB.test(startWeeklyNum)) {
  205. $.messager.alert("系统信息", "开始周次格式不正确(非负整数),请检查。");
  206. return;
  207. }
  208. if (isNaN(endWeeklyNum) || endWeeklyNum == null || endWeeklyNum.toString() == "") {
  209. $.messager.alert("系统信息", "结束周次不能为空或格式不正确(非负整数),请检查。");
  210. return;
  211. }
  212. if (!regB.test(endWeeklyNum)) {
  213. $.messager.alert("系统信息", "结束周次格式不正确(非负整数),请检查。");
  214. return;
  215. }
  216. //if (parseFloat(trialhours) > parseFloat(practicehours)) {
  217. // $.messager.alert("系统提示", "实验学时不能大于实践学时。");
  218. // return;
  219. //}
  220. //if (parseFloat(trialWeeklyNum) > parseFloat(practiceWeeklyNum)) {
  221. // $.messager.alert("系统提示", "实验周次不能大于实践周次。");
  222. // return;
  223. //}
  224. if (handleModeID == "" || handleModeID == "-1" || handleModeID == null) {
  225. $.messager.alert("系统信息", "处理方式不能为空。");
  226. return;
  227. }
  228. }
  229. $("#specialtyCourseViewList").val(JSON.stringify(d));
  230. $(document.forms[0]).submit();
  231. }