PageSetupTwo.cshtml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. @using Bowin.Web.Controls.Mvc;
  2. @using EMISOnline.Entities;
  3. @using EMISOnline.Web.Controls;
  4. @{
  5. ViewBag.Title = "List";
  6. }
  7. <div class="easyui-panel" data-options="border:false,fit:true" style="position: relative;
  8. overflow: auto;">
  9. @Html.Position()
  10. <div class="p_SearchTitle">
  11. <div style="float: left; margin-left: 10px; font-size: 12px; line-height: 30px;">
  12. 查询条件</div>
  13. </div>
  14. @using (Ajax.BeginForm(new AjaxOptions
  15. {
  16. OnSuccess = "EMISFunction.FormSuccess",
  17. OnBegin = "EMISFunction.FormSubmit",
  18. OnComplete = "EMISFunction.FormComplete",
  19. }))
  20. {
  21. @Html.Hidden("ac", @ViewBag.Action as string)
  22. @Html.Hidden("paperid")
  23. @Html.Hidden("hid_Dynamic")
  24. @Html.Hidden("hid_Setting")
  25. @Html.Hidden("hid_pageSetting")
  26. <div class="search_keyword">
  27. <div class="search_input">
  28. <ul>
  29. <li class="sn" style="width: 50%">&nbsp;</li>
  30. <li>
  31. @Html.Button(new ButtonOptions() { ID = "btnSelect", Text = "选择试题" })
  32. @Html.Button(new ButtonOptions() { ID = "btnSetScore", Text = "批量设置分数" })
  33. @Html.Button(new ButtonOptions() { ID = "btnDelete", Text = "删 除" })
  34. @if(ViewBag.action != "edit"){
  35. @Html.Button(new ButtonOptions() { ID = "btnPrev", Text = "上一步" });
  36. }
  37. @Html.Button(new ButtonOptions() { ID = "btnFinish", Text = "完 成" })
  38. </li>
  39. </ul>
  40. </div>
  41. </div>
  42. }
  43. <div class="p_title">
  44. <div style="float: left; margin-left: 10px; line-height: 30px; font-size: 12px;">
  45. 试题列表</div>
  46. <div style="margin-right: 10px; line-height: 30px; font-size: 12px;">
  47. </div>
  48. </div>
  49. <div class="search_list">
  50. @Html.DataGrid(new DataGridOptions
  51. {
  52. Columns = new List<DataGridColumn>()
  53. {
  54. new CheckBoxFieldColumn{ HeaderText="", FieldName="UserID"},
  55. new BoundFieldColumn { FieldName="content", HeaderText="题干内容", Align=AlignStyle.Center },
  56. new BoundFieldColumn { FieldName="question_type", HeaderText="试题类型", Align=AlignStyle.Center },
  57. new BoundFieldColumn { FieldName="difficulty_degree", HeaderText="难度系数", Align=AlignStyle.Center},
  58. new BoundFieldColumn { FieldName="created_date", HeaderText="创建日期", Align=AlignStyle.Center },
  59. new TextBoxColumn { FieldName="score", HeaderText="分数", OnChangedFunc="scoreChange", Align=AlignStyle.Center },
  60. },
  61. IsCheckOnSelect = true,
  62. DataSourceUrl = Url.Content("~/PaperSetting/GetPaperList?paperid=" + ViewBag.paperid + "&ac=" + ViewBag.action),
  63. ID = "dgList",
  64. IsPagination = true,
  65. IsShowRowNumbers = true,
  66. IsSingleSelect = false,
  67. IsVerticalExpand = true,
  68. IsAutoHeight = false,
  69. })
  70. </div>
  71. </div>
  72. @section scripts{
  73. <script type="text/javascript">
  74. $(function () {
  75. $('#btnPrev').click(function () {
  76. window.location.href = "@Url.Content("~/PaperSetting/PageSetupOne")?paperid=@(ViewBag.paperid)&ac=@(ViewBag.action)";
  77. })
  78. var score;
  79. var pg_settting;
  80. var al_text;
  81. $("#btnFinish").click(function () {
  82. score = 0.00;
  83. pg_settting = "";
  84. //判断试卷是否为动态试卷
  85. var isDynamic = $("#hid_Dynamic").val();
  86. var rows = $('#dgList').cmsXDataTable('getRows');
  87. if (isDynamic == "1") {
  88. if (!isEquals()) { //动态试卷的同种类型题目不能分值不一致
  89. alert("本试卷的类型是动态试卷,不允许同类型的题目中存在不同分值的题目,请检查!");
  90. return false;
  91. }
  92. var ques_setting = $("#hid_Setting").val();
  93. var ques_setting_list = JSON.parse(ques_setting);
  94. //score = 0;
  95. $(ques_setting_list).each(function (i, item) {
  96. var questions = getQuestionByTypeID(item.QType);
  97. var type_length = questions.length;
  98. if (type_length != 0) {
  99. var single_score = questions[0].score;
  100. if (type_length < parseFloat(item.PSum)) { //抽取的题目少于取题数时
  101. score += type_length * parseFloat(single_score)
  102. }
  103. else { //抽取的题目多于或等于取题数时
  104. score += parseFloat(item.item.PSum) * parseFloat(single_score);
  105. }
  106. }
  107. });
  108. al_text = "本试卷为动态试卷,最终形成的试卷总分为[" + score + "],是否继续?"
  109. }
  110. else { //静态试卷
  111. //计算试卷的总分
  112. score = rows.sum("score");
  113. al_text = "本试卷的总分为[" + score + "],是否继续?"
  114. }
  115. //计算试卷的总分
  116. $(rows).each(function (i, item) {
  117. pg_settting += (item.test_question_Id) + "|" + (item.score) + ",";
  118. });
  119. //记录试题设置信息
  120. $("#hid_pageSetting").val(pg_settting);
  121. //判断整卷分数是否为100分
  122. if (score != 100) {
  123. // var al_text = "本试卷为动态试卷,最终形成的试卷总分为["+score+"],是否继续?"
  124. confirmMsg(al_text, function (r) {
  125. if (r) {
  126. $(document.forms[0]).submit();
  127. }
  128. });
  129. }
  130. });
  131. $('#btnDelete').click(function () {
  132. var rows = $('#dgList').cmsXDataTable('getSelections');
  133. if (rows.length == 0) {
  134. alertMsg("请选择要删除的试题!");
  135. return false;
  136. }
  137. var QuestionIDstr = rows.values("test_question_Id").join(",");
  138. beginInvoke('@Url.Content("~/PaperSetting/DeleteQuestion")', { QuestionIDstr: QuestionIDstr }, function (data) {
  139. $('#dgList').cmsXDataTable('loadData', data);
  140. })
  141. })
  142. })
  143. function getQuestionByTypeID(typeid) {
  144. var rows = $('#dgList').cmsXDataTable('getRows');
  145. var questions = new Array();
  146. for (var i in rows) {
  147. if (i.base_question_type_id == typeid)
  148. questions.push(rows[i]);
  149. }
  150. return questions;
  151. }
  152. function scoreChange(obj, index) {
  153. var sss;
  154. }
  155. </script>
  156. }