Edit.cshtml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. @model EMIS.ViewModel.ExamSubjectLimitView
  2. @using EMIS.Web.Controls;
  3. @using Bowin.Web.Controls.Mvc;
  4. @{
  5. ViewBag.Title = "Edit";
  6. ComboGridOptions cgopExamType = new ComboGridOptions
  7. {
  8. TextField = "Name",
  9. ValueField = "ExaminationTypeID",
  10. GridOptions = new DataGridOptions
  11. {
  12. Columns = new List<DataGridColumn>()
  13. {
  14. new BoundFieldColumn { FieldName="Name", HeaderText="考试类型名称", Align=AlignStyle.Center ,Width=0.4},
  15. },
  16. PageSize = 5,
  17. IsCheckOnSelect = true,
  18. DataSourceUrl = Url.Content("~/ChargeProject/GetExaminationTypeList"),
  19. IsPagination = true,
  20. IsShowRowNumbers = true,
  21. IsSingleSelect = false
  22. }
  23. };
  24. }
  25. <div class="easyui-panel" data-options="border:false,fit:true" style="position: relative;">
  26. @using (Ajax.BeginForm(new AjaxOptions
  27. {
  28. OnSuccess = "EMISFunction.FormSuccess",
  29. OnBegin = "EMISFunction.FormSubmit",
  30. OnComplete = "EMISFunction.FormComplete"
  31. }))
  32. {
  33. @Html.HiddenFor(x => x.ExaminationSubjectCountLimitID)
  34. <div class="p_title">
  35. <div style="float: left; margin-left: 10px; line-height: 30px; font-size: 12px;">
  36. 门数限定信息</div>
  37. @if (Request.QueryString["Type"] != "1")
  38. {
  39. <div style="margin-right: 10px; line-height: 30px; font-size: 12px;">@Html.ContextMenuBar("Edit")</div>
  40. }
  41. </div>
  42. <div class="search_list popupWindowContent">
  43. <table cellpadding="0" cellspacing="0" id="departmenttable">
  44. <tr>
  45. <td>@Html.LabelFor(x => x.ExaminationTypeID):
  46. </td>
  47. <td>
  48. @Html.ComboGridFor(x => x.ExaminationTypeID, cgopExamType)
  49. </td>
  50. </tr>
  51. <tr>
  52. <td>@Html.LabelFor(x => x.SchoolyearNumID):
  53. </td>
  54. <td>@Html.DictionaryDropDownListFor(EMIS.ViewModel.DictionaryItem.CF_SchoolyearNum, x => x.SchoolyearNumID)
  55. </td>
  56. </tr>
  57. <tr>
  58. <td>@Html.LabelFor(x => x.SubjectCountLimit):
  59. </td>
  60. <td>@Html.TextBoxFor(x => x.SubjectCountLimit, new TextBoxOptions() { })
  61. </td>
  62. </tr>
  63. <tr>
  64. <td colspan="2">
  65. <div class="p_title">
  66. <div style="float: left; margin-left: 10px; line-height: 30px; font-size: 12px;">
  67. 标准专业信息列表</div>
  68. <div style="margin-right: 10px; line-height: 30px; font-size: 12px;">
  69. @if (Request.QueryString["Type"] != "1")
  70. {
  71. @Html.ContextMenuBar("EditList")
  72. }</div>
  73. </div>
  74. <div class="search_list">
  75. @Html.DataGrid(new DataGridOptions
  76. {
  77. Columns = new List<DataGridColumn>()
  78. {
  79. new CheckBoxFieldColumn{ HeaderText="", FieldName="Value"},
  80. new BoundFieldColumn { FieldName="StandardName", HeaderText="标准专业", Align=AlignStyle.Center, },
  81. },
  82. IsCheckOnSelect = true,
  83. DataSourceUrl = Url.Content("~/ExamSubjectLimit/EditList?ExaminationSubjectCountLimitID=" + Model.ExaminationSubjectCountLimitID),
  84. ID = "dgStandardList",
  85. IsPagination = true,
  86. IsShowRowNumbers = true,
  87. IsSingleSelect = false,
  88. IsPostBack = true,
  89. })
  90. </div>
  91. </td>
  92. </tr>
  93. </table>
  94. </div>
  95. }
  96. </div>
  97. @section scripts{
  98. <script type="text/javascript">
  99. function Save() {
  100. $(document.forms[0]).submit();
  101. }
  102. function Add() {
  103. var mnu = $.SystemGeneral.getUrlParam("MNU");
  104. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + '/ExamSubjectLimit/Select' + '?MNU=' + mnu + "&key=Value";
  105. $.popupTopWindow('选择标准专业', redirectTo, 600, 400, function (data) {
  106. if (data == null || data.length == 0)
  107. return;
  108. Add_Confirm(data);
  109. }, null);
  110. }
  111. function Add_Confirm(studentList) {
  112. if (!studentList) return;
  113. var studentViewList = $("#dgStandardList").cmsXDataTable("getRows");
  114. var addedStudentViewList = $.map(
  115. $.grep(studentList, function (x) { return $.grep(studentViewList, function (y) { return y.Value == x.Value; }).length == 0; }),
  116. function (x) {
  117. return {
  118. StandardID: x.Value,
  119. StandardName: x.Name,
  120. };
  121. });
  122. var addedStudentIDs = $.map(addedStudentViewList, function (x) { return x.Value; }).join(',');
  123. var newStudentViewList = addedStudentViewList.concat(studentViewList);
  124. $("#dgStandardList").cmsXDataTable("loadData", { rows: newStudentViewList, total: newStudentViewList.length });
  125. }
  126. function validChooseUser() {
  127. var d = [];
  128. $.each($("#dgStandardList").cmsXDataTable("getSelections"), function (index) {
  129. d.push(this.StandardID);
  130. });
  131. return d;
  132. }
  133. function Delete() {
  134. var d = validChooseUser();
  135. var studentViewList = $("#dgStandardList").cmsXDataTable("getRows");
  136. var i, j;
  137. var len = studentViewList.length;
  138. for (i = len - 1; i >= 0; i--) {
  139. for (j = 0; j < d.length; j++) {
  140. if (studentViewList[i].StandardID == d[j]) {
  141. studentViewList.splice(i, 1);
  142. break;
  143. }
  144. }
  145. }
  146. $("#dgStandardList").cmsXDataTable("loadData", { rows: studentViewList, total: studentViewList.length });
  147. }
  148. </script>
  149. }