StudentSelect.js 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. var inputData;
  2. var windowID;
  3. $.parser.onComplete = function () {
  4. $(function () {
  5. windowID = $.SystemGeneral.getUrlParam("WindowID");
  6. inputData = top.$("#" + windowID).data("inputData");
  7. reload();
  8. });
  9. };
  10. function reload() {
  11. var grid = $("#dgStudentList");
  12. var allSetting = $.data(grid[0], "cmsXDataTable");
  13. if (!allSetting) return;
  14. allSetting.options.url = CMS_SystemConfig.VirtualDirectoryPath + "/ExaminationPlan/StudentList?examinationPlanID=" + inputData.examinationPlanID + "&studentOrderTypeID=" + inputData.studentOrderType;
  15. $.data(grid, "cmsXDataTable", allSetting);
  16. grid.cmsXDataTable("load", $.getDataGridParams("dgStudentList"));
  17. }
  18. //获取选中的数据
  19. function validChoose() {
  20. var d = [];
  21. $.each($("#dgStudentList").cmsXDataTable("getSelections"), function (index) {
  22. d.push(this);
  23. });
  24. return d;
  25. }
  26. //院系所
  27. function SelectCollegeComboGrid() {
  28. var collegeID = $("#CollegeComboGrid").combogridX("getValue");
  29. if (collegeID != nonSelect) {
  30. var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + collegeID + "|@|'})";
  31. $("#GrademajorComboGrid").combogridX("reload", eval(jsonString));
  32. }
  33. reload();
  34. }
  35. function SelectGrademajorComboGrid() {
  36. var grademajorID = $("#GrademajorComboGrid").combogridX("getValue");
  37. if (grademajorID != nonSelect) {
  38. var jsonString = "({'QueryParamsDatas':'GrademajorComboGrid|*|" + grademajorID + "|@|'})";
  39. $("#ClassmajorComboGrid").combogridX("reload", eval(jsonString));
  40. }
  41. reload();
  42. }
  43. function Student_Confirm() {
  44. var d = validChoose();
  45. if (d.length == 0) {
  46. $.messager.alert("系统提示", "请选择您要添加的学生。");
  47. return;
  48. }
  49. if (d.length > inputData.limit) {
  50. $.messager.alert("系统提示", "由于座位安排的限制,目前该教室只能再容纳" + inputData.limit + "人。");
  51. return;
  52. }
  53. top.$("#" + windowID).data("resultData", d);
  54. top.$("#" + windowID).dialog("close");
  55. }
  56. function Student_MaxConfirm() {
  57. if (inputData.limit <= 0) {
  58. $.messager.alert("系统提示", "该考场人数已满,点击确定回到上一页。", 'info', function () {
  59. top.$("#" + windowID).dialog("close");
  60. });
  61. return;
  62. }
  63. var grid = $("#dgStudentList");
  64. var allSetting = $.data(grid[0], "cmsXDataTable");
  65. if (!allSetting) return;
  66. allSetting.options.pagination = false;
  67. allSetting.options.onLoadSuccess = function (data) {
  68. var d = [];
  69. $.each($("#dgStudentList").cmsXDataTable("getRows"), function (index) {
  70. if (index < inputData.limit) {
  71. d.push(this);
  72. }
  73. });
  74. if (d.length == 0) {
  75. $.messager.alert("系统提示", "请选择您要添加的学生。");
  76. return;
  77. }
  78. top.$("#" + windowID).data("resultData", d);
  79. top.$("#" + windowID).dialog("close");
  80. };
  81. $.data(grid, "cmsXDataTable", allSetting);
  82. grid.cmsXDataTable("load", $.getDataGridParams("dgStudentList"));
  83. }