Edit.cshtml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. @model EMIS.ViewModel.SelectCourse.FreeSelectionCourseView
  2. @using EMIS.Web.Controls;
  3. @using Bowin.Web.Controls.Mvc;
  4. @{
  5. ViewBag.Title = "Edit";
  6. ComboGridOptions cgopCourse = new ComboGridOptions
  7. {
  8. TextField = "CourseName",
  9. ValueField = "CoursematerialID",
  10. GridOptions = new DataGridOptions
  11. {
  12. Columns = new List<DataGridColumn>()
  13. {
  14. new LinkButtonColumn { FieldName="CourseCode", HeaderText="课程代码", Width=0.15, Align=AlignStyle.Center },
  15. new BoundFieldColumn { FieldName="CourseName", HeaderText="课程名称", Width=0.3, Align=AlignStyle.Center }
  16. },
  17. IsCheckOnSelect = true,
  18. DataSourceUrl = Url.Content("~/Coursematerial/ListForDropdown"),
  19. IsPagination = true,
  20. IsShowRowNumbers = true,
  21. IsSingleSelect = false
  22. }
  23. };
  24. ComboGridOptions cgopDepartment = new ComboGridOptions
  25. {
  26. TextField = "Name",
  27. ValueField = "DepartmentID",
  28. GridOptions = new DataGridOptions
  29. {
  30. Columns = new List<DataGridColumn>()
  31. {
  32. //new LinkButtonColumn { FieldName="No", HeaderText="教研室代码", Align=AlignStyle.Center, Width=0.1 },
  33. new BoundFieldColumn { FieldName="Name", HeaderText="教研室名称", Align=AlignStyle.Center, Width=0.3 }
  34. //new BoundFieldColumn { FieldName="CollegeName", HeaderText=@EMIS.Utility.RSL.Get("College"), Align=AlignStyle.Center, Width=0.3 }
  35. },
  36. IsCheckOnSelect = true,
  37. DataSourceUrl = Url.Content("~/Department/List"),
  38. IsPagination = true,
  39. IsShowRowNumbers = true,
  40. IsSingleSelect = false
  41. }
  42. };
  43. ListControlOptions lcop = new ListControlOptions
  44. {
  45. Name = "TeachingModeID",
  46. TextField = "Name",
  47. ValueField = "Value",
  48. ColumnCount = 4,
  49. SelectedValueUrl = @Url.Content("~/FreeSelectionCourse/TeachingModeType?freeSelectionCourseID=" + Model.FreeSelectionCouseID)
  50. };
  51. //ListControlOptions lcoptp = new ListControlOptions
  52. //{
  53. // Name = "TeachingPlaceID",
  54. // TextField = "Name",
  55. // ValueField = "Value",
  56. // ColumnCount = 4,
  57. // SelectedValueUrl = @Url.Content("~/FreeSelectionCourse/TeachingPlace?freeSelectionCourseID=" + Model.FreeSelectionCouseID)
  58. //};
  59. }
  60. <style type="text/css">
  61. #specialtyCourseable
  62. {
  63. width: 100%;
  64. border: 0px none;
  65. }
  66. #specialtyCourseable tr
  67. {
  68. min-height: 30px;
  69. }
  70. </style>
  71. @section scripts{
  72. <script type="text/javascript">
  73. function recalculate() {
  74. var theoryCourse = parseInt($("#TheoryCourse").val() == "" ? "0" : $("#TheoryCourse").val());
  75. var practicehours = parseInt($("#Practicehours").val() == "" ? "0" : $("#Practicehours").val());
  76. var theoryWeeklyNum = parseInt($("#TheoryWeeklyNum").val() == "" ? "0" : $("#TheoryWeeklyNum").val());
  77. var practiceWeeklyNum = parseInt($("#PracticeWeeklyNum").val() == "" ? "0" : $("#PracticeWeeklyNum").val());
  78. var totalHours = theoryCourse + practicehours;
  79. var totalWeeklyNum = theoryWeeklyNum + practiceWeeklyNum;
  80. var weeklyHours = totalHours / totalWeeklyNum;
  81. var weeklyNum = weeklyHours / 2;
  82. $("#Totalhours").val(totalHours);
  83. if (totalWeeklyNum != 0) {
  84. $("#SchoolweeksNum").val(totalWeeklyNum);
  85. $("#WeeklyHours").val(weeklyHours);
  86. $("#WeeklyNum").val(weeklyNum);
  87. }
  88. }
  89. $(function () {
  90. $("#Credit").val(parseFloat($("#Credit").val()).toFixed(1));
  91. $("#TheoryCourse").keyup(function () {
  92. recalculate();
  93. });
  94. $("#Practicehours").keyup(function () {
  95. recalculate();
  96. });
  97. $("#TheoryWeeklyNum").keyup(function () {
  98. recalculate();
  99. });
  100. $("#PracticeWeeklyNum").keyup(function () {
  101. recalculate();
  102. });
  103. $("#weekExpander").closest("tr")
  104. .next().css("display", "")
  105. .next().css("display", "")
  106. .next().css("display", "")
  107. .next().css("display", "");
  108. $("#weekExpander").attr("expanded", "1");
  109. });
  110. function FreeSelectionCourse_Save() {
  111. if ($("input[name='TeachingModeID']:checked").length == 0) {
  112. $.messager.alert("系统提示", "请选择至少一种授课方式。");
  113. return;
  114. }
  115. if (!isNaN($("#Trialhours").val()) && $("#Trialhours").val() != ""
  116. && !isNaN($("#Practicehours").val()) && $("#Practicehours").val() != ""
  117. && parseFloat($("#Trialhours").val()) > parseFloat($("#Practicehours").val())) {
  118. $.messager.alert("系统提示", "实验学时不能大于实践学时。");
  119. return;
  120. }
  121. if (!isNaN($("#TrialWeeklyNum").val()) && $("#TrialWeeklyNum").val() != ""
  122. && !isNaN($("#PracticeWeeklyNum").val()) && $("#PracticeWeeklyNum").val() != ""
  123. && parseFloat($("#TrialWeeklyNum").val()) > parseFloat($("#PracticeWeeklyNum").val())) {
  124. $.messager.alert("系统提示", "实验周次不能大于实践周次。");
  125. return;
  126. }
  127. $(document.forms[0]).submit();
  128. }
  129. function calculate() {
  130. var theoryHours = parseFloat($("#TheoryCourse").val());
  131. var practiceHours = parseFloat($("#Practicehours").val());
  132. var trialHours = parseFloat($("#Trialhours").val());
  133. if (isNaN(theoryHours)) theoryHours = 0;
  134. if (isNaN(practiceHours)) practiceHours = 0;
  135. if (isNaN(trialHours)) trialHours = 0;
  136. var totalHours = theoryHours + practiceHours + trialHours;
  137. var timesEachWeek = parseFloat($("#WeeklyNum").val());
  138. if (isNaN(timesEachWeek)) timesEachWeek = totalHours;
  139. var theoryWeekNum = Math.ceil(theoryHours / timesEachWeek);
  140. var practiceWeekNum = Math.ceil(practiceHours / timesEachWeek);
  141. var trialWeekNum = Math.ceil(trialHours / timesEachWeek);
  142. var totalWeekNum = theoryWeekNum + practiceWeekNum + trialWeekNum;
  143. $("#Totalhours").val(totalHours.toString());
  144. $("#TheoryWeeklyNum").val(theoryWeekNum.toString());
  145. $("#PracticeWeeklyNum").val(practiceWeekNum.toString());
  146. $("#TrialWeeklyNum").val(trialWeekNum.toString());
  147. $("#SchoolweeksNum").val(totalWeekNum.toString());
  148. }
  149. function swapWeekSettings() {
  150. if ($("#weekExpander").attr("expanded") == "0") {
  151. $("#weekExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -50px 0");
  152. $("#weekExpander").closest("tr")
  153. .next().css("display", "")
  154. .next().css("display", "")
  155. .next().css("display", "")
  156. .next().css("display", "");
  157. $("#weekExpander").attr("expanded", "1");
  158. } else {
  159. $("#weekExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -32px 0");
  160. $("#weekExpander").closest("tr")
  161. .next().css("display", "none")
  162. .next().css("display", "none")
  163. .next().css("display", "none")
  164. .next().css("display", "none");
  165. $("#weekExpander").attr("expanded", "0");
  166. }
  167. }
  168. </script>
  169. }
  170. <div class="easyui-panel" data-options="border:false,fit:true" style="position: relative;">
  171. @using (Ajax.BeginForm(new AjaxOptions
  172. {
  173. OnSuccess = "EMISFunction.FormSuccess",
  174. OnBegin = "EMISFunction.FormSubmit",
  175. OnComplete = "EMISFunction.FormComplete"
  176. }))
  177. {
  178. <div class="p_title">
  179. @*<div style="float: left; margin-left: 10px; line-height: 30px; font-size: 12px;">
  180. 任选课程信息</div>*@
  181. @if (Request["Isdisplay"] != "false")
  182. {
  183. <div style="margin-right: 10px; line-height: 30px; font-size: 12px;">@Html.ContextMenuBar("Edit")</div>
  184. }
  185. </div>
  186. <div class="search_list">
  187. @Html.HiddenFor(x => x.FreeSelectionCouseID)
  188. <table cellpadding="0" cellspacing="0" id="freeSelectionCourseable">
  189. <tr>
  190. <td>
  191. @Html.LabelFor(x => x.DepartmentName):
  192. </td>
  193. <td>
  194. @Html.ComboGridFor(x => x.DepartmentID, cgopDepartment)
  195. </td>
  196. <td>
  197. @Html.LabelFor(x => x.CourseName):
  198. </td>
  199. <td>
  200. @Html.ComboGridFor(x => x.CoursematerialID, cgopCourse)
  201. </td>
  202. </tr>
  203. <tr>
  204. <td>
  205. @Html.LabelFor(x => x.CourseTypeID):
  206. </td>
  207. <td>
  208. @Html.DictionaryDropDownListFor(EMIS.ViewModel.DictionaryItem.CF_CourseType, x => x.CourseTypeID)
  209. </td>
  210. <td>
  211. @Html.LabelFor(x => x.CourseStructureID):
  212. </td>
  213. <td>
  214. @Html.DictionaryDropDownListFor(EMIS.ViewModel.DictionaryItem.CF_CourseStructure, x => x.CourseStructureID)
  215. </td>
  216. </tr>
  217. <tr>
  218. <td>
  219. @Html.LabelFor(x => x.CourseCategoryID):
  220. </td>
  221. <td>
  222. @Html.DictionaryDropDownListFor(EMIS.ViewModel.DictionaryItem.CF_CourseCategory, x => x.CourseCategoryID)
  223. </td>
  224. <td>
  225. @Html.LabelFor(x => x.CourseQualityID):
  226. </td>
  227. <td>
  228. @Html.DictionaryDropDownListFor(EMIS.ViewModel.DictionaryItem.CF_CourseQuality, x => x.CourseQualityID)
  229. </td>
  230. </tr>
  231. <tr>
  232. <td>@Html.LabelFor(x => x.ExaminationModeID):
  233. </td>
  234. <td>@Html.DictionaryDropDownListFor(EMIS.ViewModel.DictionaryItem.CF_ExaminationMode, x => x.ExaminationModeID)
  235. </td>
  236. <td>@Html.LabelFor(x=>x.ResultTypeID)
  237. </td>
  238. <td>@Html.DictionaryDropDownListFor(EMIS.ViewModel.DictionaryItem.CF_ResultType, (x => x.ResultTypeID))
  239. </td>
  240. </tr>
  241. @*<tr>
  242. <td>@Html.LabelFor(x => x.SchoolyearNumID):
  243. </td>
  244. <td>@Html.DictionaryDropDownListFor(EMIS.ViewModel.DictionaryItem.CF_SchoolyearNum, x => x.SchoolyearNumID)
  245. </td>
  246. <td>@Html.LabelFor(x => x.SchoolcodeID):
  247. </td>
  248. <td>@Html.DictionaryDropDownListFor(EMIS.ViewModel.DictionaryItem.CF_Semester, x => x.SchoolcodeID)
  249. </td>
  250. </tr>*@
  251. <tr>
  252. <td>@Html.LabelFor(x => x.TeachinglanguageID):
  253. </td>
  254. <td>@Html.DictionaryDropDownListFor(EMIS.ViewModel.DictionaryItem.CF_Teachinglanguage, x => x.TeachinglanguageID)
  255. </td>
  256. <td>
  257. @Html.LabelFor(x => x.Credit):
  258. </td>
  259. <td>
  260. @Html.TextBoxFor(x => x.Credit)
  261. </td>
  262. </tr>
  263. <tr>
  264. <td>
  265. @Html.LabelFor(x => x.PracticeTypeID):
  266. </td>
  267. <td>
  268. @Html.DictionaryDropDownListFor(EMIS.ViewModel.DictionaryItem.EM_PracticeType, x => x.PracticeTypeID)
  269. </td>
  270. <td>@Html.LabelFor(x => x.TheoryCourse):
  271. </td>
  272. <td>@Html.TextBoxFor(x => x.TheoryCourse, new { onchange = "" })
  273. </td>
  274. </tr>
  275. <tr>
  276. <td>@Html.LabelFor(x => x.Practicehours):
  277. </td>
  278. <td>@Html.TextBoxFor(x => x.Practicehours, new { onchange = "" })
  279. </td>
  280. <td>@Html.LabelFor(x => x.Trialhours):
  281. </td>
  282. <td>@Html.TextBoxFor(x => x.Trialhours, new { onchange = "" })
  283. </td>
  284. </tr>
  285. <tr>
  286. <td>@Html.LabelFor(x => x.Totalhours):
  287. </td>
  288. <td colspan="3">@Html.TextBoxFor(x => x.Totalhours, new TextBoxOptions { IsEnabled = false })
  289. </td>
  290. </tr>
  291. <tr>
  292. <td colspan="4">
  293. <div id="weekExpander" style="width: 16px; float: left; height: 16px; cursor: pointer;
  294. background: url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -50px 0;"
  295. onclick="swapWeekSettings();">
  296. </div>
  297. <div style="float: left; cursor: pointer; color: red;" onclick="swapWeekSettings();">
  298. 上课周次信息
  299. </div>
  300. </td>
  301. </tr>
  302. <tr>
  303. <td>@Html.LabelFor(x => x.TheoryWeeklyNum):
  304. </td>
  305. <td>@Html.TextBoxFor(x => x.TheoryWeeklyNum)
  306. </td>
  307. <td>@Html.LabelFor(x => x.PracticeWeeklyNum):
  308. </td>
  309. <td>@Html.TextBoxFor(x => x.PracticeWeeklyNum)
  310. </td>
  311. </tr>
  312. <tr>
  313. <td>@Html.LabelFor(x => x.TrialWeeklyNum):
  314. </td>
  315. <td>@Html.TextBoxFor(x => x.TrialWeeklyNum)
  316. </td>
  317. <td>@Html.LabelFor(x => x.SchoolweeksNum):
  318. </td>
  319. <td>@Html.TextBoxFor(x => x.SchoolweeksNum, new TextBoxOptions { IsEnabled = false })
  320. </td>
  321. </tr>
  322. <tr>
  323. <td>@Html.LabelFor(x => x.StartWeeklyNum):
  324. </td>
  325. <td>@Html.TextBoxFor(x => x.StartWeeklyNum)
  326. </td>
  327. <td>@Html.LabelFor(x => x.EndWeeklyNum):
  328. </td>
  329. <td>@Html.TextBoxFor(x => x.EndWeeklyNum)
  330. </td>
  331. </tr>
  332. <tr>
  333. <td>@Html.LabelFor(x => x.WeeklyHours):
  334. </td>
  335. <td>@Html.TextBoxFor(x => x.WeeklyHours)
  336. </td>
  337. <td>@Html.LabelFor(x => x.WeeklyNum):
  338. </td>
  339. <td>@Html.TextBoxFor(x => x.WeeklyNum)
  340. </td>
  341. </tr>
  342. <tr>
  343. <td>@Html.LabelFor(x => x.TeachingModeID):
  344. </td>
  345. <td colspan="3">
  346. @Html.DictionaryCheckList(EMIS.ViewModel.DictionaryItem.CF_TeachingMode, lcop)
  347. </td>
  348. </tr>
  349. @*<tr>
  350. <td>@Html.LabelFor(x => x.TeachingPlaceID):
  351. </td>
  352. <td colspan="3">@Html.DictionaryCheckList(EMIS.ViewModel.DictionaryItem.EM_TeachingPlace, lcoptp)
  353. </td>
  354. </tr>*@
  355. <tr>
  356. <td>
  357. @Html.LabelFor(x => x.IsEnable):
  358. </td>
  359. <td>
  360. @Html.CheckBoxFor(x => x.IsEnable, (Model.IsEnable))
  361. </td>
  362. <td>
  363. </td>
  364. <td>
  365. </td>
  366. </tr>
  367. <tr>
  368. <td>@Html.LabelFor(x => x.Remark):
  369. </td>
  370. <td colspan="3">@Html.TextAreaFor(x => x.Remark, new Dictionary<string, object> { { "style", "width:98%;" } })
  371. </td>
  372. </tr>
  373. </table>
  374. </div>
  375. }
  376. </div>