StudentList.cshtml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. @model EMIS.ViewModel.SelectCourse.SelectCourseResult.SelectCourseResultView
  2. @using EMIS.Web.Controls;
  3. @using Bowin.Web.Controls.Mvc;
  4. @{
  5. ViewBag.Title = "Edit";
  6. Guid? ID = ViewBag.ID;
  7. string Type = ViewBag.Type;
  8. }
  9. @section scripts{
  10. <script type="text/javascript">
  11. $(function () {
  12. mnu = $.SystemGeneral.getUrlParam("MNU");
  13. })
  14. //获取选中的数据
  15. function validChoose() {
  16. var d = [];
  17. $.each($("#dgStudentList").cmsXDataTable("getSelections"), function (index) {
  18. d.push(this);
  19. });
  20. return d;
  21. }
  22. //确定
  23. function SelectCourseResult_StudentConfirm() {
  24. //alert(Type);
  25. //$("#ID").val(Type);
  26. $(document.forms[0]).submit();
  27. }
  28. //弹出添加学生名单页面
  29. function SelectCourseResult_StudentAdd() {
  30. $.popupTopWindow('添加学生', CMS_SystemConfig.VirtualDirectoryPath + '/SelectCourseResult/StudentAdd?FromMNU=' +
  31. mnu, 700, 480, AddStudents_Confirm);
  32. }
  33. //确定添加学生
  34. function AddStudents_Confirm(StudentList) {
  35. if (StudentList == null)
  36. return;
  37. var StudentViewList = $("#dgStudentList").cmsXDataTable("getRows");
  38. $.each(StudentList, function (index, value) {
  39. if ($.grep(StudentViewList, function (row, index) { return value.UserID == row.UserID; }).length == 0) {
  40. StudentViewList.push({
  41. SelectCourseResultID: $("#SelectCourseResultID").val(),
  42. UserID: value.UserID,
  43. LoginID: value.LoginID,
  44. UserName: value.UserName,
  45. SexName: value.SexName,
  46. ClassmajorName: value.ClassMajorName,
  47. StudentStatusName: value.StudentStatusName,
  48. StudentType: value.StudentType,
  49. InSchoolStatusName: value.InSchoolStatusName
  50. });
  51. }
  52. });
  53. $("#dgStudentList").cmsXDataTable("loadData", { rows: StudentViewList, total: StudentViewList.length });
  54. }
  55. //删除学生名单
  56. function SelectCourseResult_StudentDelete() {
  57. var d = validChoose();
  58. var StudentViewList = $("#dgStudentList").cmsXDataTable("getRows");
  59. var i, j;
  60. var len = StudentViewList.length;
  61. for (i = len - 1; i >= 0; i--) {
  62. for (j = 0; j < d.length; j++) {
  63. if (StudentViewList[i].UserID == d[j].UserID) {
  64. StudentViewList.splice(i, 1);
  65. break;
  66. }
  67. }
  68. }
  69. $("#dgStudentList").cmsXDataTable("loadData", { rows: StudentViewList, total: StudentViewList.length });
  70. }
  71. //学生名单Excel导出
  72. function SelectCourseResult_StudentDetailExcel() {
  73. $("#formQuery").submit();
  74. }
  75. </script>
  76. }
  77. <div class="easyui-panel" data-options="border:false,fit:true" style="position: relative;">
  78. @using (Ajax.BeginForm(new AjaxOptions
  79. {
  80. OnSuccess = "EMISFunction.FormSuccess",
  81. OnBegin = "EMISFunction.FormSubmit",
  82. OnComplete = "EMISFunction.FormComplete"
  83. }))
  84. {
  85. <div class="p_title">
  86. @*<div style="float: left; margin-left: 10px; line-height: 30px; font-size: 12px;">
  87. 选课学生名单</div>*@
  88. <div style="margin-right: 10px; line-height: 30px; font-size: 12px;">
  89. @Html.ContextMenuBar("Edit_StuConfirm")</div>
  90. </div>
  91. <div class="search_list">
  92. @Html.ContextMenuBar("Edit_StuGrid")
  93. @Html.HiddenFor(x => x.ID)
  94. @Html.DataGrid(new DataGridOptions
  95. {
  96. Columns = new List<DataGridColumn>()
  97. {
  98. new CheckBoxFieldColumn { FieldName="UserID", HeaderText="" },
  99. new BoundFieldColumn { FieldName="LoginID", HeaderText="学号", Align=AlignStyle.Center, Width=0.08 },
  100. new BoundFieldColumn { FieldName="UserName", HeaderText="姓名", Align=AlignStyle.Center, Width=0.05 },
  101. new BoundFieldColumn { FieldName="SexName", HeaderText="性别", Align=AlignStyle.Center, Width=0.03 },
  102. //new BoundFieldColumn { FieldName="CoursematerialName", HeaderText="课程名称", Align=AlignStyle.Center, Width=0.1 },
  103. new BoundFieldColumn { FieldName="ClassmajorName", HeaderText="班级名称", Align=AlignStyle.Center, Width=0.12 },
  104. new BoundFieldColumn { FieldName="InSchoolStatusName", HeaderText="在校状态", Align=AlignStyle.Center, Width=0.04 },
  105. new BoundFieldColumn { FieldName="StudentStatusName", HeaderText="学籍状态", Align=AlignStyle.Center, Width=0.04 }
  106. },
  107. //PageSize = 30,
  108. IsCheckOnSelect = true,
  109. DataSourceUrl = Url.Content("~/SelectCourseResult/StudentViewList?ID=" + ID + "&Type=" + Type),
  110. IsPostBack = true,
  111. ID = "dgStudentList",
  112. IsPagination = false,
  113. IsShowRowNumbers = true,
  114. IsSingleSelect = false,
  115. MaxHeight=350
  116. })
  117. </div>
  118. }
  119. <form id="formQuery" method="post" action="@Url.Content("~/SelectCourseResult/Excel_StudentList?ID=" + ID + "&Type=" + Type)">
  120. </form>
  121. </div>