PlanApplicationBatchAdd.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. //刷新
  2. function reload() {
  3. $("#dgSpecialtyCourseNoApplyList").cmsXDataTable("load", $.getDataGridParams("dgSpecialtyCourseNoApplyList"));
  4. }
  5. //获取选中的数据
  6. function validChoose() {
  7. var d = [];
  8. $.each($("#dgSpecialtyCourseNoApplyList").cmsXDataTable("getSelections"), function (index) {
  9. d.push(this.SpecialtyCourseID);
  10. });
  11. return d;
  12. }
  13. //获取选中的数据All
  14. function validChooseAll() {
  15. var d = [];
  16. $.each($("#dgSpecialtyCourseNoApplyList").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 = $('#dgSpecialtyCourseNoApplyList').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 querySchoolyear(data) {
  61. $("#GrademajorID").combogridX("setValue", "-1");
  62. queryClass();
  63. }
  64. function queryStandard(data) {
  65. $("#GrademajorID").combogridX("setValue", "-1");
  66. queryClass();
  67. }
  68. function queryEducation(data) {
  69. $("#GrademajorID").combogridX("setValue", "-1");
  70. queryClass();
  71. }
  72. function queryLearningform(data) {
  73. $("#GrademajorID").combogridX("setValue", "-1");
  74. queryClass();
  75. }
  76. function queryClass() {
  77. var jsonString = "";
  78. var parameterString = "";
  79. var schoolYearID = $("#DictionarySchoolyear").combogridX("getValue"); //combobox
  80. var standardID = $("#DictionaryStandard").combogridX("getValue");
  81. var educationID = $("#DictionaryEducation").combogridX("getValue");
  82. var learningFormID = $("#DictionaryLearningform").combogridX("getValue");
  83. if (schoolYearID != nonSelect) parameterString += "DictionaryGrade|*|" + schoolYearID + "|@|";
  84. if (standardID != nonSelect) parameterString += "DictionaryStandard|*|" + standardID + "|@|";
  85. if (educationID != nonSelect) parameterString += "DictionaryEducation|*|" + educationID + "|@|";
  86. if (learningFormID != nonSelect) parameterString += "DictionaryLearningform|*|" + learningFormID + "|@|";
  87. if (parameterString != "") {
  88. jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
  89. $("#DictionaryStandard").combogridX("reload", eval(jsonString));
  90. $("#GrademajorID").combogridX("reload", eval(jsonString));
  91. }
  92. else {
  93. $("#DictionaryStandard").combogridX("reload");
  94. $("#GrademajorID").combogridX("reload");
  95. }
  96. reload();
  97. }
  98. //确定
  99. function PlanApplicationBatchAdd_Confirm() {
  100. var grademajorID = $("#GrademajorID").combogridX("getValue");
  101. if (grademajorID == "" || grademajorID == "-1" || grademajorID == null) {
  102. $.messager.alert("系统提示", "请选择要申请的年级专业信息。");
  103. return;
  104. }
  105. var d = validChooseAll();
  106. if (d == "") {
  107. $.messager.alert("系统提示", "请选择您要申请的信息。");
  108. return;
  109. }
  110. //对选择申请的信息进行验证
  111. var regA = /^\d+(\.{0,1}\d+){0,1}$/; //非负数
  112. var regB = /^\d+$/; //非负整数
  113. for (var i = 0; i < d.length; i++) {
  114. var credit = d[i].Credit;
  115. var theoryCourse = d[i].TheoryCourse;
  116. var practicehours = d[i].Practicehours;
  117. var trialhours = d[i].Trialhours;
  118. var theoryWeeklyNum = d[i].TheoryWeeklyNum;
  119. var practiceWeeklyNum = d[i].PracticeWeeklyNum;
  120. var trialWeeklyNum = d[i].TrialWeeklyNum;
  121. var weeklyHours = d[i].WeeklyHours;
  122. var weeklyNum = d[i].WeeklyNum;
  123. var startWeeklyNum = d[i].StartWeeklyNum;
  124. var endWeeklyNum = d[i].EndWeeklyNum;
  125. var teachingModeIDListName = d[i].TeachingModeIDListName;
  126. var handleModeID = d[i].HandleModeID;
  127. if (isNaN(credit) || credit == null || credit.toString() == "") {
  128. $.messager.alert("系统信息", "课程学分不能为空或格式不正确(非负数字),请检查。");
  129. return;
  130. }
  131. if (!regA.test(credit)) {
  132. $.messager.alert("系统信息", "课程学分格式不正确(非负数字),请检查。");
  133. return;
  134. }
  135. if (isNaN(theoryCourse) || theoryCourse == null || theoryCourse.toString() == "") {
  136. $.messager.alert("系统信息", "理论学时不能为空或格式不正确(非负整数),请检查。");
  137. return;
  138. }
  139. if (!regB.test(theoryCourse)) {
  140. $.messager.alert("系统信息", "理论学时格式不正确(非负整数),请检查。");
  141. return;
  142. }
  143. if (isNaN(practicehours) || practicehours == null || practicehours.toString() == "") {
  144. $.messager.alert("系统信息", "实践学时不能为空或格式不正确(非负整数),请检查。");
  145. return;
  146. }
  147. if (!regB.test(practicehours)) {
  148. $.messager.alert("系统信息", "实践学时格式不正确(非负整数),请检查。");
  149. return;
  150. }
  151. if (isNaN(trialhours) || trialhours == null || trialhours.toString() == "") {
  152. $.messager.alert("系统信息", "实验学时不能为空或格式不正确(非负整数),请检查。");
  153. return;
  154. }
  155. if (!regB.test(trialhours)) {
  156. $.messager.alert("系统信息", "实验学时格式不正确(非负整数),请检查。");
  157. return;
  158. }
  159. if (isNaN(theoryWeeklyNum) || theoryWeeklyNum == null || theoryWeeklyNum.toString() == "") {
  160. $.messager.alert("系统信息", "理论周次不能为空或格式不正确(非负整数),请检查。");
  161. return;
  162. }
  163. if (!regB.test(theoryWeeklyNum)) {
  164. $.messager.alert("系统信息", "理论周次格式不正确(非负整数),请检查。");
  165. return;
  166. }
  167. if (isNaN(practiceWeeklyNum) || practiceWeeklyNum == null || practiceWeeklyNum.toString() == "") {
  168. $.messager.alert("系统信息", "实践周次不能为空或格式不正确(非负整数),请检查。");
  169. return;
  170. }
  171. if (!regB.test(practiceWeeklyNum)) {
  172. $.messager.alert("系统信息", "实践周次格式不正确(非负整数),请检查。");
  173. return;
  174. }
  175. if (isNaN(trialWeeklyNum) || trialWeeklyNum == null || trialWeeklyNum.toString() == "") {
  176. $.messager.alert("系统信息", "实验周次不能为空或格式不正确(非负整数),请检查。");
  177. return;
  178. }
  179. if (!regB.test(trialWeeklyNum)) {
  180. $.messager.alert("系统信息", "实验周次格式不正确(非负整数),请检查。");
  181. return;
  182. }
  183. if (isNaN(weeklyHours) || weeklyHours == null || weeklyHours.toString() == "") {
  184. $.messager.alert("系统信息", "周学时不能为空或格式不正确(非负整数),请检查。");
  185. return;
  186. }
  187. if (!regB.test(weeklyHours)) {
  188. $.messager.alert("系统信息", "周学时格式不正确(非负整数),请检查。");
  189. return;
  190. }
  191. if (isNaN(weeklyNum) || weeklyNum == null || weeklyNum.toString() == "") {
  192. $.messager.alert("系统信息", "每周次数不能为空或格式不正确(非负整数),请检查。");
  193. return;
  194. }
  195. if (!regB.test(weeklyNum)) {
  196. $.messager.alert("系统信息", "每周次数格式不正确(非负整数),请检查。");
  197. return;
  198. }
  199. if (isNaN(startWeeklyNum) || startWeeklyNum == null || startWeeklyNum.toString() == "") {
  200. $.messager.alert("系统信息", "开始周次不能为空或格式不正确(非负整数),请检查。");
  201. return;
  202. }
  203. if (!regB.test(startWeeklyNum)) {
  204. $.messager.alert("系统信息", "开始周次格式不正确(非负整数),请检查。");
  205. return;
  206. }
  207. if (isNaN(endWeeklyNum) || endWeeklyNum == null || endWeeklyNum.toString() == "") {
  208. $.messager.alert("系统信息", "结束周次不能为空或格式不正确(非负整数),请检查。");
  209. return;
  210. }
  211. if (!regB.test(endWeeklyNum)) {
  212. $.messager.alert("系统信息", "结束周次格式不正确(非负整数),请检查。");
  213. return;
  214. }
  215. //if (parseFloat(trialhours) > parseFloat(practicehours)) {
  216. // $.messager.alert("系统提示", "实验学时不能大于实践学时。");
  217. // return;
  218. //}
  219. //if (parseFloat(trialWeeklyNum) > parseFloat(practiceWeeklyNum)) {
  220. // $.messager.alert("系统提示", "实验周次不能大于实践周次。");
  221. // return;
  222. //}
  223. if (teachingModeIDListName == "" || teachingModeIDListName == null) {
  224. $.messager.alert("系统信息", "授课方式为空无法申请。");
  225. return;
  226. }
  227. if (handleModeID == "" || handleModeID == "-1" || handleModeID == null) {
  228. $.messager.alert("系统信息", "处理方式不能为空。");
  229. return;
  230. }
  231. }
  232. $("#specialtyCourseViewList").val(JSON.stringify(d));
  233. $(document.forms[0]).submit();
  234. }