StudentsOrder.js 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. 
  2. var url = CMS_SystemConfig.VirtualDirectoryPath + "/StudentsOrder/CreatePlan";
  3. var mnu = "";
  4. //加载
  5. $(function () {
  6. mnu = $.SystemGeneral.getUrlParam("MNU");
  7. })
  8. //新增
  9. function Students_Add() {
  10. var redirectTo = url + '?MNU=' + mnu;
  11. $.popupTopWindow('待征订计划', redirectTo, 380, 200, null, null);
  12. }
  13. function reload() {
  14. $("#dgStudentsOrderList").cmsXDataTable("load", $.getDataGridParams("dgStudentsOrderList"));
  15. }
  16. //获取选中的数据
  17. function validChooseID() {
  18. var d = [];
  19. $.each($("#dgStudentsOrderList").cmsXDataTable("getSelections"), function (index) {
  20. d.push(this.SpecialtyPlanID);
  21. });
  22. return d;
  23. }
  24. function validData() {
  25. var d = [];
  26. $.each($("#dgStudentsOrderList").cmsXDataTable("getSelections"), function (index) {
  27. d.push(this);
  28. });
  29. return d;
  30. }
  31. //获取征订状态
  32. function validIsOrdered() {
  33. var d = [];
  34. $.each($("#dgStudentsOrderList").cmsXDataTable("getSelections"), function (index) {
  35. d.push(this.IsOrdered);
  36. });
  37. return d;
  38. }
  39. //删除
  40. function Students_Delete() {
  41. var d = validChooseID().join(',');
  42. if (d == "") {
  43. $.messager.alert("系统提示", "请选择您要删除的征订信息!");
  44. return;
  45. }
  46. $.messager.confirm("系统提示", "您确定要删除该征订信息?", function (r) {
  47. if (r) {
  48. $.post(CMS_SystemConfig.VirtualDirectoryPath + '/StudentsOrder/Delete', { specialtyPlanIDs: d }, function (data) {
  49. if (data == "删除成功") {
  50. $.messager.alert("系统提示", "删除成功!");
  51. $("#dgStudentsOrderList").cmsXDataTable('load');
  52. } else {
  53. $.messager.alert("系统提示", data);
  54. }
  55. });
  56. }
  57. });
  58. }
  59. //确认征订
  60. function Students_Submit() {
  61. var d = validChooseID().join(',');
  62. if (d == "") {
  63. $.messager.alert("系统提示", "请选择您要确认的征订信息!");
  64. return;
  65. }
  66. var dataobject = validData();
  67. //去掉学生人数不为0的不给征订的判断
  68. // for (var i = 0; i < dataobject.length; i++) {
  69. // if (dataobject[i].ClassNum <= 0) {
  70. // $.messager.alert("系统提示", "学生人数为0,不能提交该信息!");
  71. // return;
  72. // }
  73. // }
  74. $.messager.confirm("系统提示", "您确定您要确认该征订信息?", function (r) {
  75. if (r) {
  76. $.post(CMS_SystemConfig.VirtualDirectoryPath + '/StudentsOrder/ComfirmOrder', { specialtyPlanIDs: d }, function (data) {
  77. if (data == "征订成功") {
  78. $.messager.alert("系统提示", "征订成功!");
  79. $("#dgStudentsOrderList").cmsXDataTable('load');
  80. } else {
  81. $.messager.alert("系统提示", data);
  82. }
  83. });
  84. }
  85. });
  86. }
  87. //征订计划生成
  88. function Students_Create() {
  89. var schoolyearIDStr = $("#SchoolyearDropdown").combobox("getValue");
  90. if (schoolyearIDStr == "-1") {
  91. $.messager.alert("系统提示", "请选择要生成计划的学年学期!");
  92. return;
  93. }
  94. $.messager.confirm("系统提示", "您确定要生成征订计划?", function (r) {
  95. if (r) {
  96. $(document.forms[0]).submit(); //提交表单
  97. }
  98. });
  99. }
  100. //获取选中的课程ID
  101. function validChooseCoursematerialID() {
  102. var d = [];
  103. $.each($("#dgStudentsOrderList").cmsXDataTable("getSelections"), function (index) {
  104. d.push(this.CoursematerialID);
  105. });
  106. return d;
  107. }
  108. //获取选中的专业计划ID
  109. function validChooseSpecialtyPlanID() {
  110. var d = [];
  111. $.each($("#dgStudentsOrderList").cmsXDataTable("getSelections"), function (index) {
  112. d.push(this.SpecialtyPlanID);
  113. });
  114. return d;
  115. }
  116. //指定教材
  117. function Students_Update() {
  118. var d = validChooseID().join(',');
  119. var sp = validChooseSpecialtyPlanID().join(',');
  120. var f = validIsOrdered();
  121. if (d == "") {
  122. $.messager.alert("系统提示", "请选择您要指定教材的征订信息!");
  123. return;
  124. }
  125. var coursematerialIDArray = validChooseCoursematerialID();
  126. for (var i = 0; i < coursematerialIDArray.length; i++) {
  127. if (coursematerialIDArray[0] != coursematerialIDArray[i]) {
  128. $.messager.alert("系统提示", "由于选择指定教材的课程不同,无法进行操作,请重新选择!");
  129. return;
  130. }
  131. }
  132. paramsModel = {
  133. StudentsOrderIDs: d,
  134. CoursematerialID: coursematerialIDArray[0],
  135. SpecialtyPlanID: sp
  136. }
  137. $.popupTopWindow('指定教材', CMS_SystemConfig.VirtualDirectoryPath + '/StudentsOrder/EditTeachingMaterialPool?MNU=' + mnu + '&IsOrdered=' + f, 800, 600, null, paramsModel);
  138. }
  139. function Students_Export() {
  140. $("#ExcelType").val(1);//普通导出
  141. $("#formQuery").submit();
  142. }
  143. //获取选中的数据
  144. function validChooseobj() {
  145. var d = [];
  146. $.each($("#dgStudentsOrderList").cmsXDataTable("getSelections"), function (index) {
  147. d.push(this);
  148. });
  149. return d;
  150. }
  151. //获取选中的数据总库
  152. function validChooseTmp() {
  153. var d = [];
  154. $.each($("#dgStudentsOrderList").cmsXDataTable("getSelections"), function (index) {
  155. d.push(this.SpecialtyPlanID);
  156. });
  157. return d;
  158. }
  159. function validChoose() {
  160. var d = [];
  161. $.each($("#dgStudentsOrderList").cmsXDataTable("getSelections"), function (index) {
  162. d.push(this.SpecialtyPlanID);
  163. });
  164. return d;
  165. }
  166. //预加设置
  167. function Students_AddNum() {
  168. var d = validChoose().join(',');
  169. var tmps = validChooseTmp().join(',');
  170. //var years = validChooseYear().join(',');
  171. var c = validChooseobj();
  172. var orderJsonStr = JSON.stringify(c);
  173. if (d.length == "") {
  174. $.messager.alert("系统提示", "请选择要预加设置的信息!");
  175. return;
  176. }
  177. $.popupTopWindow('预加数量设置', CMS_SystemConfig.VirtualDirectoryPath + '/StudentsOrder/BatchSetPreAddedValue?MNU=' + mnu, 380, 150, null, orderJsonStr);
  178. }
  179. //预订汇总导出
  180. function Students_Aggregate_Export() {
  181. $("#ExcelType").val(2);//预订汇总导出
  182. $("#formQuery").submit();
  183. }
  184. //设置征订数量
  185. function Students_Change() {
  186. var d = validChoose().join(',');
  187. var c = validChooseobj();
  188. var orderJsonStr = JSON.stringify(c);
  189. if (d.length == "") {
  190. $.messager.alert("系统提示", "请选择要征订设置的信息!");
  191. return;
  192. }
  193. $.popupTopWindow('征订数量设置', CMS_SystemConfig.VirtualDirectoryPath + '/StudentsOrder/ChangeOrderQty?MNU=' + mnu, 380, 150, null, orderJsonStr);
  194. }
  195. function QueryCampusComboGridList() {
  196. var campusID = $("#CampusDropdown").combogridX("getValue");
  197. if (campusID != nonSelect) {
  198. var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|'})";
  199. $("#CollegeDropdown").combogridX("reload", eval(jsonString));
  200. }
  201. reload();
  202. }
  203. function QueryCollegeComboGridList() {
  204. var jsonString = "";
  205. var parameterString = "";
  206. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  207. var schoolYearID = $("#DictionarySchoolyear").combobox("getValue");
  208. if (collegeID != nonSelect) parameterString += "CollegeDropdown|*|" + collegeID + "|@|";
  209. if (schoolYearID != nonSelect) parameterString += "DictionaryGrade|*|" + schoolYearID + "|@|";
  210. if (parameterString != "") {
  211. jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
  212. $("#ComboGridGrademajor").combogridX("reload", eval(jsonString));
  213. } else {
  214. $("#ComboGridGrademajor").combogridX("reload");
  215. }
  216. reload();
  217. }
  218. function QuerySchoolyearDictionaryList(data) {
  219. var jsonString = "";
  220. var parameterString = "";
  221. var collegeID = $("#CollegeDropdown").combogridX("getValue");
  222. var schoolYearID = $("#DictionarySchoolyear").combobox("getValue");
  223. if (collegeID != nonSelect) parameterString += "CollegeDropdown|*|" + collegeID + "|@|";
  224. if (schoolYearID != nonSelect) parameterString += "DictionaryGrade|*|" + schoolYearID + "|@|";
  225. if (parameterString != "") {
  226. jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
  227. $("#ComboGridGrademajor").combogridX("reload", eval(jsonString));
  228. } else {
  229. $("#ComboGridGrademajor").combogridX("reload");
  230. }
  231. reload();
  232. }
  233. function QuerySchoolyearDropdownList(data) {
  234. reload();
  235. }
  236. function QueryComboGridList(data) {
  237. reload();
  238. }
  239. function QueryHandleModeDictionaryDropDown(data) {
  240. reload();
  241. }
  242. function QuerySchoolyearDropdownList(data) {
  243. reload();
  244. }
  245. function QueryCampusDropdownList(data) {
  246. $("#CollegeDropdown").combobox("reload", CMS_SystemConfig.VirtualDirectoryPath + "/College/CollegeDropdownListBanid?campusID=" + data.Value + "");
  247. reload();
  248. }
  249. function QueryCollegeDropdownList(data) {
  250. $("#DepartmentDropdown").combobox("reload", CMS_SystemConfig.VirtualDirectoryPath + "/Department/DepartmentDropdownListBanid?collegeID=" + data.Value + "");
  251. reload();
  252. }
  253. function QueryYearsDropdownList(data) {
  254. reload();
  255. }
  256. function QueryStandardDropdownList(data) {
  257. reload();
  258. }
  259. function QueryCourseDropdownList(data) {
  260. reload();
  261. }
  262. function QueryCourseTypeDropdownList(data) {
  263. reload();
  264. }
  265. function QueryOrderedDropdownList(data) {
  266. reload();
  267. }