SOCDetailEdit.cshtml 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. @model EMIS.ViewModel.DQPSystem.SOCDetailView
  2. @using EMIS.Web.Controls;
  3. @using Bowin.Web.Controls.Mvc;
  4. @using EMIS.ViewModel;
  5. @{
  6. ViewBag.Title = "Edit";
  7. ComboGridOptions cgopFacultymajor = new ComboGridOptions
  8. {
  9. TextField = "Name",
  10. ValueField = "FacultymajorID",
  11. Name = "FacultymajorComboGrid",
  12. ID = "FacultymajorComboGrid",
  13. GridOptions = new DataGridOptions
  14. {
  15. Columns = new List<DataGridColumn>()
  16. {
  17. new BoundFieldColumn { FieldName="Code", HeaderText="院系专业编号", Align=AlignStyle.Center },
  18. new BoundFieldColumn { FieldName="Name", HeaderText="院系专业名称", Align=AlignStyle.Center }
  19. },
  20. IsCheckOnSelect = true,
  21. DataSourceUrl = Url.Content("~/Facultymajor/List"),
  22. IsPagination = true,
  23. IsShowRowNumbers = true,
  24. IsSingleSelect = false,
  25. IsShowHeader = false
  26. }
  27. };
  28. ComboGridOptions cgopCourse = new ComboGridOptions
  29. {
  30. TextField = "CourseName",
  31. ValueField = "CoursematerialID",
  32. Name = "CoursematerialIDDropdownGridBo",
  33. ID = "CoursematerialIDDropdownGridBo",
  34. GridOptions = new DataGridOptions
  35. {
  36. Columns = new List<DataGridColumn>()
  37. {
  38. //new LinkButtonColumn { FieldName="CourseCode", HeaderText="课程代码", Width=0.1, Align=AlignStyle.Center },
  39. new BoundFieldColumn { FieldName="CourseName", HeaderText="课程名称", Width=0.3, Align=AlignStyle.Center }
  40. },
  41. IsCheckOnSelect = true,
  42. DataSourceUrl = Url.Content("~/Coursematerial/ListForDropdown"),
  43. IsPagination = true,
  44. IsShowRowNumbers = true,
  45. IsSingleSelect = false
  46. }
  47. };
  48. //开课教研室
  49. ComboGridOptions cgopDepartment = new ComboGridOptions
  50. {
  51. ID = "DepartmentDropdown",
  52. Name = "DepartmentDropdown",
  53. TextField = "Name",
  54. ValueField = "DepartmentID",
  55. GridOptions = new DataGridOptions
  56. {
  57. Columns = new List<DataGridColumn>()
  58. {
  59. //new LinkButtonColumn { FieldName="No", HeaderText="教研室代码", Align=AlignStyle.Center, Width=0.1 },
  60. new BoundFieldColumn { FieldName="Name", HeaderText="教研室名称", Align=AlignStyle.Center, Width=0.2 }
  61. },
  62. //IsAutoLoad = false,
  63. IsCheckOnSelect = true,
  64. DataSourceUrl = Url.Content("~/Department/List"),
  65. IsPagination = true,
  66. IsShowRowNumbers = true,
  67. IsSingleSelect = false,
  68. }
  69. };
  70. }
  71. @section scripts{
  72. <script type = "text/javascript">
  73. $(function () {
  74. windowID = $.SystemGeneral.getUrlParam("WindowID");
  75. mnu = $.SystemGeneral.getUrlParam("MNU");
  76. var detail = top.$("#" + windowID).data("inputData");
  77. $("#Name").val(detail.Name);
  78. $("#Credit").val(detail.Credit);
  79. $("#Weight").val(detail.Weight);
  80. if(detail.IsGroupin == true){
  81. //$("#IsGroupin").checked = true;
  82. $("#IsGroupin").prop("checked",true);
  83. }
  84. $("#IsGroupin").val(detail.IsGroupin);
  85. $("#Description").val(detail.Description);
  86. var dateTimeTest = /^(?:19|20)[0-9][0-9]-(?:(?:0[1-9])|(?:1[0-2]))-(?:(?:[0-2][1-9])|(?:[1-3][0-1]))$/;
  87. var start;
  88. var end;
  89. if(dateTimeTest.test(detail.StartTime))
  90. {
  91. start = detail.StartTime;
  92. }
  93. else{
  94. start = detail.StartTime != null ? detail.StartTime.toDateString("yyyy-MM-dd") : "";
  95. }
  96. if(dateTimeTest.test(detail.StartTime))
  97. {
  98. end = detail.EndTime;
  99. }
  100. else{
  101. end = detail.EndTime != null ? detail.EndTime.toDateString("yyyy-MM-dd") : "";
  102. }
  103. $("#StartTime").val(start);
  104. $("#EndTime").val(end);
  105. });
  106. function SOCDetail_Save() {
  107. //学分非负数
  108. var CreditTest = /^\d+(\.{0,1}\d+){0,1}$/;
  109. //权重0-100
  110. var WeightTest = /^(\d{1,2}(\.\d{0,})?|100)$/;
  111. var SOCDetail = new Object();
  112. SOCDetail.SOCDetailID = "@Model.SOCDetailID";
  113. SOCDetail.Name = $("#Name").val();
  114. SOCDetail.Credit = $("#Credit").val();
  115. SOCDetail.Weight = $("#Weight").val();
  116. SOCDetail.Description = $("#Description").val();
  117. SOCDetail.IsGroup = $("#IsGroupin").is(":checked");
  118. SOCDetail.IsGroupin = $("#IsGroupin").is(":checked");
  119. SOCDetail.StartTime = $("#StartTime").val();
  120. SOCDetail.EndTime = $("#EndTime").val();
  121. if(SOCDetail.Credit == "" || SOCDetail.Credit == null)
  122. {
  123. $.messager.alert("系统信息", "学分不能为空。");
  124. return;
  125. }
  126. else if(!CreditTest.test(SOCDetail.Credit))
  127. {
  128. $.messager.alert("系统信息", "学分只能是非负数字。");
  129. return;
  130. }
  131. if(SOCDetail.Weight == "" || SOCDetail.Weight == null)
  132. {
  133. $.messager.alert("系统信息", "权重不能为空。");
  134. return;
  135. }
  136. else if(!WeightTest.test(SOCDetail.Weight))
  137. {
  138. $.messager.alert("系统信息", "权重只能是0-100之间的数字。");
  139. return;
  140. }
  141. top.$("#@(Request["WindowID"])").data("resultData", SOCDetail);
  142. top.$("#@(Request["WindowID"])").dialog("close");
  143. };
  144. </script>
  145. }
  146. <div class="easyui-panel" data-options="border:false,fit:true" style="position: relative;">
  147. @using (Ajax.BeginForm(new AjaxOptions { OnSuccess = "EMISFunction.FormSuccess", OnBegin = "EMISFunction.FormSubmit", OnComplete = "EMISFunction.FormComplete" }))
  148. {
  149. <div class="p_title">
  150. <div style="margin-right: 10px; line-height: 30px; font-size: 12px;">@Html.ContextMenuBar("Detail-Edit")</div>
  151. </div>
  152. <div class="search_list">
  153. @Html.Hidden("hid_ActionsType")
  154. @Html.HiddenFor(x => x.SOCDetailID)
  155. <table cellpadding="0" cellspacing="0" id="departmenttable">
  156. <tr>
  157. <td>
  158. @Html.LabelFor(x => x.Name):
  159. </td>
  160. <td>
  161. @Html.TextBoxFor(x => x.Name)
  162. </td>
  163. <td>
  164. @Html.LabelFor(x => x.Credit):
  165. </td>
  166. <td>
  167. @Html.TextBoxFor(x => x.Credit)
  168. </td>
  169. </tr>
  170. <tr>
  171. <td>
  172. @Html.LabelFor(x => x.Weight):
  173. </td>
  174. <td>
  175. @Html.TextBoxFor(x => x.Weight)
  176. </td>
  177. <td>
  178. @Html.LabelFor(x => x.IsGroup):
  179. </td>
  180. <td>
  181. @Html.CheckBoxFor(x => x.IsGroupin)
  182. </td>
  183. </tr>
  184. <tr>
  185. <td>
  186. @Html.LabelFor(x => x.Description):
  187. </td>
  188. <td colspan = "3">
  189. @Html.TextAreaFor(x => x.Description, 3, 70, null)
  190. </td>
  191. </tr>
  192. <tr>
  193. <td>
  194. @Html.LabelFor(x => x.StartTime):
  195. </td>
  196. <td>
  197. @Html.TextBoxFor(x => x.StartTime, new TextBoxOptions { TextBoxType = TextBoxType.Date, ID = "StartTime", Name = "StartTime" })
  198. </td>
  199. <td>
  200. @Html.LabelFor(x => x.EndTime):
  201. </td>
  202. <td>
  203. @Html.TextBoxFor(x => x.EndTime, new TextBoxOptions { TextBoxType = TextBoxType.Date, ID = "EndTime", Name = "EndTime", })
  204. </td>
  205. </tr>
  206. </table>
  207. </div>
  208. }
  209. </div>