SOCDetailGroupStudentEdit.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. var mnu = "";
  2. //加载
  3. $(function () {
  4. mnu = $.SystemGeneral.getUrlParam("MNU");
  5. })
  6. //获取选中的数据
  7. function validChoose() {
  8. var d = [];
  9. $.each($("#dgStudentList").cmsXDataTable("getSelections"), function (index) {
  10. d.push(this.UserID);
  11. });
  12. return d;
  13. }
  14. function SOCDetailGroupStudent_Save() {
  15. //alert(Type);
  16. //$("#ID").val(Type);
  17. $(document.forms[0]).submit();
  18. }
  19. //弹出添加学生页面
  20. function SOCDetailGroupStudent_Add() {
  21. var SOCDetailGroupID = $("#SOCDetailGroupID").val();
  22. $.popupTopWindow('添加学生', CMS_SystemConfig.VirtualDirectoryPath + '/SOCDetailGroup/StudentAdd?SOCDetailGroupID=' + SOCDetailGroupID + '&MNU=' +
  23. mnu, 700, 480, AddStudents_Confirm);
  24. }
  25. //删除学生名单
  26. function SOCDetailGroupStudent_Delete() {
  27. var d = validChoose();
  28. var StudentViewList = $("#dgStudentList").cmsXDataTable("getRows");
  29. var i, j;
  30. var len = StudentViewList.length;
  31. for (i = len - 1; i >= 0; i--) {
  32. for (j = 0; j < d.length; j++) {
  33. if (StudentViewList[i].UserID == d[j]) {
  34. StudentViewList.splice(i, 1);
  35. break;
  36. }
  37. }
  38. }
  39. $("#dgStudentList").cmsXDataTable("loadData", { rows: StudentViewList, total: StudentViewList.length });
  40. }
  41. //确定添加学生
  42. function AddStudents_Confirm(StudentList) {
  43. if (StudentList == null)
  44. return;
  45. var StudentViewList = $("#dgStudentList").cmsXDataTable("getRows");
  46. $.each(StudentList, function (index, value) {
  47. if ($.grep(StudentViewList, function (row, index) { return value.UserID == row.UserID; }).length == 0) {
  48. StudentViewList.push({
  49. SelectCourseResultID: $("#SelectCourseResultID").val(),
  50. UserID: value.UserID,
  51. LoginID: value.LoginID,
  52. UserName: value.UserName,
  53. SexName: value.SexName,
  54. ClassmajorName: value.ClassmajorName,
  55. StudentStatusName: value.StudentStatusName,
  56. StudentType: value.StudentType,
  57. InSchoolStatusName: value.InSchoolStatusName
  58. });
  59. }
  60. });
  61. $("#dgStudentList").cmsXDataTable("loadData", { rows: StudentViewList, total: StudentViewList.length });
  62. }
  63. function reload() {
  64. $("#dgStudentList").cmsXDataTable("load", $.getDataGridParams("dgStudentList"));
  65. }