SpecialtyPlanBatchAdd.js 11 KB

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