StudentDistribute.js 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/StudentDistribute/CreatePlan";
  2. var ViewUrl = CMS_SystemConfig.VirtualDirectoryPath + "/StudentDistribute/Edit";
  3. var mnu = "";
  4. //加载
  5. $(function () {
  6. mnu = $.SystemGeneral.getUrlParam("MNU");
  7. })
  8. //新增(发放计划生成)
  9. function StudentDistribute_Refresh() {
  10. url = CMS_SystemConfig.VirtualDirectoryPath + "/StudentDistribute/CreatePlan";
  11. var redirectTo = url + '?MNU=' + mnu;
  12. $.popupTopWindow('发放计划生成', redirectTo, 400, 300, null, null);
  13. }
  14. function reload() {
  15. $("#dgStudentDistributeList").cmsXDataTable("load", $.getDataGridParams("dgStudentDistributeList"));
  16. ////如果该课程没有教材、那么将颜色以红色警示
  17. //$("#dgStudentDistributeList").datagrid({
  18. // rowStyler: function (index, row) {
  19. // if (row.TeachingMaterialName =="") {
  20. // return 'background-color:#6293BB;color:#fff;';
  21. // }
  22. // }
  23. //});
  24. }
  25. //获取选中的数据
  26. function validChooseID() {
  27. var d = [];
  28. $.each($("#dgStudentDistributeList").cmsXDataTable("getSelections"), function (index) {
  29. d.push(this.StudentDistributeID);
  30. });
  31. return d;
  32. }
  33. //获取选中的数据
  34. function validDate() {
  35. var d = [];
  36. $.each($("#dgStudentDistributeList").cmsXDataTable("getSelections"), function (index) {
  37. d.push(this);
  38. });
  39. return d;
  40. }
  41. //删除
  42. function StudentDistribute_Delete() {
  43. var d = validChooseID().join(',');
  44. if (d == "") {
  45. $.messager.alert("系统提示", "请选择您要删除的信息。");
  46. return;
  47. }
  48. $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) {
  49. if (r) {
  50. $.post(CMS_SystemConfig.VirtualDirectoryPath + '/StudentDistribute/Delete', { studentDistributeIDs: d }, function (data) {
  51. if (data == "删除成功。") {
  52. $.messager.alert("系统提示", data);
  53. $("#dgStudentDistributeList").cmsXDataTable('load');
  54. } else {
  55. $.messager.alert("系统提示", data);
  56. }
  57. });
  58. }
  59. });
  60. }
  61. //提交
  62. function StudentDistribute_Submit() {
  63. var IsNext = false;
  64. var d = validChooseID().join(',');
  65. var dateobj = validDate();
  66. if (d == "") {
  67. $.messager.alert("系统提示", "请选择您要提交的信息。");
  68. return;
  69. }
  70. //if (dateobj.length > 1) {
  71. // $.messager.alert("系统提示", "只能选择单个记录进行提交。");
  72. // return;
  73. //}
  74. $.messager.confirm("系统提示", "您确定您要提交选择的信息?", function (r) {
  75. if (r) {
  76. $.post(CMS_SystemConfig.VirtualDirectoryPath + '/StudentDistribute/ComfirmOrder', { studentDistributeIDs: d }, function (data) {
  77. if (data == "提交成功。") {
  78. if (dateobj[0].DistributeQty > dateobj[0].PresentInventory) {
  79. $.messager.alert("系统提示", "库存不足,发放数量大于当前库存量!");
  80. return;
  81. }
  82. url = CMS_SystemConfig.VirtualDirectoryPath + "/StudentDistribute/SubmitStudentDistribute";
  83. var redirectTo = url + '?MNU=' + mnu + '&studentDistributeID=' + d;
  84. $.popupTopWindow('发放提交确认', redirectTo, 650, 240, null, null);
  85. } else {
  86. $.messager.alert("系统提示", data);
  87. return
  88. }
  89. });
  90. }
  91. });
  92. //$.messager.alert("系统提示", "提交成功。");
  93. //$.messager.confirm("系统提示", "您确定您要提交选择的信息?", function (r) {
  94. // if (r) {
  95. // $.post(CMS_SystemConfig.VirtualDirectoryPath + '/StudentDistribute/ComfirmOrder', { studentDistributeIDs: d }, function (data) {
  96. // if (data == "提交成功。") {
  97. // $.messager.alert("系统提示", data);
  98. // $("#dgStudentDistributeList").cmsXDataTable('load');
  99. // } else {
  100. // $.messager.alert("系统提示", data);
  101. // }
  102. // });
  103. // }
  104. //});
  105. }
  106. //计划生成
  107. function StudentDistribute_Create() {
  108. var schoolyearIDStr = $("#SchoolyearDropdown").combobox("getValue");
  109. if (schoolyearIDStr == "-1") {
  110. $.messager.alert("系统提示", "请选择要生成的学年学期。");
  111. return;
  112. }
  113. $.messager.confirm("系统提示", "您确定要对选择的学年学期生成?", function (r) {
  114. if (r) {
  115. $(document.forms[0]).submit(); //提交表单
  116. }
  117. });
  118. }
  119. //获取选中的课程ID
  120. function validChooseCoursematerialID() {
  121. var d = [];
  122. $.each($("#dgStudentDistributeList").cmsXDataTable("getSelections"), function (index) {
  123. d.push(this.CoursematerialID);
  124. });
  125. return d;
  126. }
  127. //指定教材
  128. function StudentDistribute_Add() {
  129. var d = validChooseID().join(',');
  130. if (d == "") {
  131. $.messager.alert("系统提示", "请选择您要指定教材的信息。");
  132. return;
  133. }
  134. var coursematerialIDArray = validChooseCoursematerialID();
  135. for (var i = 0; i < coursematerialIDArray.length; i++) {
  136. if (coursematerialIDArray[0] != coursematerialIDArray[i]) {
  137. $.messager.alert("系统提示", "必须是同一课程的专业计划才能指定教材。");
  138. return;
  139. }
  140. }
  141. paramsModel = {
  142. StudentsOrderIDs: d,
  143. CoursematerialID: coursematerialIDArray[0]
  144. }
  145. $.popupTopWindow('指定教材', CMS_SystemConfig.VirtualDirectoryPath + '/StudentsOrder/EditTeachingMaterialPool?MNU=' +
  146. mnu, 750, 550, null, paramsModel);
  147. }
  148. //查看未发放学生信息
  149. function StudentDistributeView(rowindex, rowdata) {
  150. paramsModel = {
  151. studentDistributeID: rowdata.StudentDistributeID,
  152. GrademajorID: rowdata.GrademajorID
  153. }
  154. $.popupTopWindow('未发放学生信息', CMS_SystemConfig.VirtualDirectoryPath + '/StudentDistribute/Edit?MNU=' +
  155. mnu + '&studentDistributeID=' + rowdata.StudentDistributeID + '&studentQty=' +
  156. rowdata.StudentQty, 850, 550, null, paramsModel);
  157. }
  158. //查看发放学生信息
  159. function StudentDistributeDetail(rowindex, rowdata) {
  160. paramsModel = {
  161. studentDistributeID: rowdata.StudentDistributeID,
  162. }
  163. $.popupTopWindow('发放学生信息', CMS_SystemConfig.VirtualDirectoryPath + '/StudentDistribute/StudentDistributeDetail?MNU=' +
  164. mnu + '&studentDistributeID=' + rowdata.StudentDistributeID, 850, 550, null, paramsModel);
  165. }
  166. function StudentDistribute_Export() {
  167. $("#formQuery").submit();
  168. }
  169. function queryStandard(){
  170. }
  171. //选中专业
  172. function reloadClassmajor(data){
  173. if (data != null) {
  174. selectClass();
  175. }
  176. // var StandardID = $("#ddlStandard").combobox("getValue");
  177. // $("#ComboGridGrademajor").combogridX("reload", CMS_SystemConfig.VirtualDirectoryPath + "/Grademajor/BindDropdownListByCollege?standardID=" + StandardID + "");
  178. reload();
  179. }
  180. //选中年级
  181. function QuerySchoolyearDictionaryList(data) {
  182. if (data != null) {
  183. selectClass();
  184. }
  185. reload();
  186. }
  187. function selectClass() {
  188. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  189. var standard = $("#ddlStandard").combobox("getValue");
  190. var year = $("#DictionarySchoolyear").combobox("getValue");
  191. var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + collegeID
  192. + "|@|DictionaryGrade|*|" + year
  193. + "|@|DictionaryStandard|*|" + standard + "|@|'})";
  194. $("#ComboGridGrademajor").combogridX("reload", eval(jsonString));
  195. reload();
  196. }
  197. function QueryCampusComboGridList() {
  198. var campusID = $("#CampusDropdown").combogridX("getValue");
  199. if (campusID != nonSelect) {
  200. var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|'})";
  201. $("#CollegeDropdown").combogridX("reload", eval(jsonString));
  202. }
  203. reload();
  204. }
  205. function QueryCollegeComboGridList() {
  206. var url = "/Facultymajor/BindStandardDropDownList?bindType=0";
  207. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  208. if (collegeID != nonSelect) url += "&collegeID=" + collegeID;
  209. $("#ddlStandard").combobox("reload", url);
  210. reload();
  211. }
  212. function QueryComboGridList(data) {
  213. reload();
  214. }
  215. function QueryOrderedDropdownList(data) {
  216. reload();
  217. }
  218. function QueryTeachingMaterialDropdownList(data) {
  219. reload();
  220. }
  221. function QueryCourseDropdownList(data) {
  222. reload();
  223. }
  224. function queryCollege(data) {
  225. queryClass();
  226. }
  227. function queryStandard(data) {
  228. queryClass();
  229. }
  230. function queryClass() {
  231. var jsonString = "";
  232. var parameterString = "";
  233. //var campusID = $("#CampusDropdown").combogridX("getValue");
  234. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  235. //var educationID = $("#Education").combobox("getValue");
  236. var schoolYearID = $("#DictionarySchoolyear").combobox("getValue");
  237. var standardID = $("#ddlStandard").combogridX("getValue");
  238. //if (campusID != nonSelect) parameterString += "CampusDropdown|*|" + campusID + "|@|";
  239. if (collegeID != nonSelect) parameterString += "CollegeDropdown|*|" + collegeID + "|@|";
  240. //if (educationID != nonSelect) parameterString += "DictionaryEducation|*|" + educationID + "|@|";
  241. if (schoolYearID != nonSelect) parameterString += "DictionaryGrade|*|" + schoolYearID + "|@|";
  242. if (standardID != nonSelect) parameterString += "DictionaryStandard|*|" + standardID + "|@|";
  243. if (parameterString != "") {
  244. jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
  245. $("#ComboGridGrademajor").combogridX("reload", eval(jsonString));
  246. $("#ddlStandard").combogridX("reload", eval(jsonString));
  247. } else {
  248. $("#ComboGridGrademajor").combogridX("reload");
  249. $("#ddlStandard").combogridX("reload");
  250. }
  251. reload();
  252. }