PageSetupOne.cshtml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. @model EMISOnline.ViewModel.ExamView.PaperAddView
  2. @using EMISOnline.Web.Controls;
  3. @using Bowin.Web.Controls.Mvc;
  4. @{
  5. ViewBag.Title = "ExamAdd";
  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>
  12. <div class="p_title">
  13. <div style="float: left; margin-left: 10px; color: #333; line-height: 35px; font-size: 12px;">
  14. 试卷信息</div>
  15. <div style="margin-right: 10px; float: right; line-height: 30px; font-size: 12px;">
  16. @Html.Button(new ButtonOptions() { ID = "btnSave", Text = "保 存" })
  17. </div>
  18. </div>
  19. @using (Ajax.BeginForm(new AjaxOptions
  20. {
  21. OnSuccess = "EMISFunction.FormSuccess",
  22. OnBegin = "EMISFunction.FormSubmit",
  23. OnComplete = "EMISFunction.FormComplete",
  24. }))
  25. {
  26. @Html.Hidden("LibarysString")
  27. @Html.Hidden("QuestionTypeString")
  28. <div class="search_list">
  29. <table cellpadding="0" cellspacing="0" id="Coursematerialtable">
  30. <tr>
  31. <th>@Html.LabelFor(x => x.templateid):
  32. </th>
  33. <td>
  34. @Html.Selector(new Bowin.Web.Controls.Mvc.SelectorOptions
  35. {
  36. ID = "test_paper_name",
  37. Name = "test_paper_id",
  38. IsSingleSelect = true,
  39. QueryParams = "id:1",
  40. DataUrl = Url.Content("~/ExamSetting/GetPaperList"),
  41. TextName = "test_paper_name",
  42. Title = "试卷列表",
  43. Colums = "Key:ID,试卷名称:PaperName:200:query,是否动态试卷:is_dynamic:100,试卷总分:paper_score:100,创建时间:created_date:100",
  44. DataValue = "test_paper_id",
  45. DataText = "PaperName",
  46. Width = 500,
  47. Required = true,
  48. })
  49. </td>
  50. </tr>
  51. <tr>
  52. <th>@Html.LabelFor(x => x.PageName):
  53. </th>
  54. <td>
  55. @Html.TextBoxFor(x => x.PageName, new Dictionary<string, object> { { "style", "width:80%" } })
  56. </td>
  57. </tr>
  58. <tr>
  59. <th>@Html.LabelFor(x => x.QuesLib):
  60. </th>
  61. <td>
  62. <a href="javascript:void(0);" id="btnPackerLib">选择</a>
  63. <table id="divLibarys">
  64. </table>
  65. </td>
  66. </tr>
  67. <tr>
  68. <th>@Html.LabelFor(x => x.ErrRate):
  69. </th>
  70. <td>
  71. @Html.TextBoxFor(model => model.ErrRate, new TextBoxOptions() { TextBoxType = TextBoxType.Normal })
  72. </td>
  73. </tr>
  74. <tr>
  75. <th>@Html.LabelFor(x => x.UseFBeg):
  76. </th>
  77. <td>
  78. @Html.TextBoxFor(model => model.UseFBeg, new TextBoxOptions() { TextBoxType = TextBoxType.Normal })
  79. @Html.TextBoxFor(model => model.UseFEnd, new TextBoxOptions() { TextBoxType = TextBoxType.Normal })
  80. </td>
  81. </tr>
  82. <tr>
  83. <th>@Html.LabelFor(x => x.QuesLevelBeg):
  84. </th>
  85. <td>
  86. @Html.TextBoxFor(model => model.QuesLevelBeg, new TextBoxOptions() { TextBoxType = TextBoxType.Normal })
  87. @Html.TextBoxFor(model => model.QuesLevelEnd, new TextBoxOptions() { TextBoxType = TextBoxType.Normal })
  88. </td>
  89. </tr>
  90. <tr>
  91. <th>@Html.LabelFor(x => x.QuesFCount):
  92. </th>
  93. <td>
  94. @Html.CheckBoxFor(model => model.QuesFCount, new { @value = "True", })<label>试题使用频率</label>
  95. @Html.CheckBoxFor(model => model.QuesUpdateTime, new { @value = "False", @checked = "checked", })<label>试题更新时间</label>
  96. </td>
  97. </tr>
  98. <tr>
  99. <th>@Html.LabelFor(x => x.PageType):
  100. </th>
  101. <td>
  102. @Html.RadioButtonFor(model => model.PageType, "0", new { @value = "0", @name = "isOpenAnswer" })<label>静态组卷</label>
  103. @Html.RadioButtonFor(model => model.PageType, "1", new { @value = "1", @checked = "checked", @name = "isOpenAnswer" })<label>动态组卷</label>
  104. </td>
  105. </tr>
  106. <tr>
  107. <th>@Html.LabelFor(x => x.QuesType):<br />
  108. <span style="color: Red;" id="totalSum"></span>
  109. </th>
  110. <td>
  111. <div class="AddQuesType">
  112. <table>
  113. <tr style="text-align: center;">
  114. <th style="width: 20%;">
  115. 试题类型
  116. </th>
  117. <th style="text-align: center; width: 25%;">
  118. 取题数
  119. </th>
  120. <th style="text-align: center; width: 25%;">
  121. 可取题数
  122. </th>
  123. <th style="text-align: center; display: none;" name="float">
  124. 分值
  125. </th>
  126. </tr>
  127. <tr>
  128. <td style="width: 20%;">
  129. <label>
  130. <input type="hidden" id="1" />单选题
  131. </label>
  132. </td>
  133. <td>
  134. <input type="text" value="0" />
  135. </td>
  136. <td>
  137. <input type="text" value="0" disabled="disabled" />
  138. </td>
  139. <td>
  140. <input type="text" style="display: none;" value="0" name="float" />
  141. </td>
  142. </tr>
  143. <tr>
  144. <td style="width: 20%;">
  145. <label>
  146. <input type="hidden" id="3" />多选题
  147. </label>
  148. </td>
  149. <td>
  150. <input type="text" value="0" />
  151. </td>
  152. <td>
  153. <input type="text" value="0" disabled="disabled" />
  154. </td>
  155. <td>
  156. <input type="text" style="display: none;" value="0" name="float" />
  157. </td>
  158. </tr>
  159. <tr>
  160. <td style="width: 20%;">
  161. <label>
  162. <input type="hidden" id="2" />填空题
  163. </label>
  164. </td>
  165. <td>
  166. <input type="text" value="0" />
  167. </td>
  168. <td>
  169. <input type="text" value="0" disabled="disabled" />
  170. </td>
  171. <td>
  172. <input type="text" style="display: none;" value="0" name="float" />
  173. </td>
  174. </tr>
  175. <tr>
  176. <td style="width: 20%;">
  177. <label>
  178. <input type="hidden" id="4" />是非题
  179. </label>
  180. </td>
  181. <td>
  182. <input type="text" value="0" />
  183. </td>
  184. <td>
  185. <input type="text" value="0" disabled="disabled" />
  186. </td>
  187. <td>
  188. <input type="text" style="display: none;" value="0" name="float" />
  189. </td>
  190. </tr>
  191. <tr>
  192. <td style="width: 20%;">
  193. <label>
  194. <input type="hidden" id="5" />简答题
  195. </label>
  196. </td>
  197. <td>
  198. <input type="text" value="0" />
  199. </td>
  200. <td>
  201. <input type="text" value="0" disabled="disabled" />
  202. </td>
  203. <td>
  204. <input type="text" style="display: none;" value="0" name="float" />
  205. </td>
  206. </tr>
  207. </table>
  208. </div>
  209. </td>
  210. </tr>
  211. <tr>
  212. <th>@Html.LabelFor(x => x.IsEnable):
  213. </th>
  214. <td>
  215. @Html.RadioButtonFor(model => model.IsEnable, "1", new { @value = "1", @name = "isOpenAnswer" })<label>是</label>
  216. @Html.RadioButtonFor(model => model.IsEnable, "0", new { @value = "0", @checked = "checked", @name = "isOpenAnswer" })<label>否</label>
  217. </td>
  218. </tr>
  219. </table>
  220. </div>
  221. }
  222. </div>
  223. <div id="dialog">
  224. </div>
  225. @section scripts{
  226. <script src="~/Scripts/Bowin.Control.Core/Controls/Selector.js" type="text/javascript"></script>
  227. <script type="text/jscript">
  228. $(function () {
  229. $('#btnSave').click(function () {
  230. serialLiabry();
  231. serialQuestionType();
  232. $(document.forms[0]).submit();
  233. })
  234. $('#btnPackerLib').click(function () {
  235. $('#dialog').dialog({
  236. title: '选择题库',
  237. width: 540, height: 385, closed: false, cache: false, isResize: false,
  238. href: '@Url.Content("~/PaperSetting/QuestionLibaryTree")',
  239. modal: true
  240. });
  241. })
  242. $('[name=PageType]').click(function () {
  243. togglePageType();
  244. })
  245. $('[name=float]').change(function () {
  246. totalSum();
  247. })
  248. var LibarysString = $('#LibarysString').val();
  249. if (LibarysString != "" && LibarysString != undefined) {
  250. builderLibarysSettings(JSON.parse(LibarysString));
  251. }
  252. togglePageType();
  253. })
  254. function totalSum() {
  255. var total = 0;
  256. $('.AddQuesType').find('tr:gt(0)').each(function (index, tr) {
  257. var number = $(tr).find('input:text').eq(0).val();
  258. var score = $(tr).find('input:text').eq(2).val();
  259. total = total + (parseFloat(number) * parseFloat(score));
  260. })
  261. $('#totalSum').text(total);
  262. }
  263. function togglePageType() {
  264. var PageType = $('[name=PageType]:checked').val();
  265. if (PageType == 1) {
  266. $('.AddQuesType').find('[name=float]').show();
  267. } else {
  268. $('.AddQuesType').find('[name=float]').hide();
  269. }
  270. }
  271. var FormFunction = {
  272. SubmitSuccess: function (data) {
  273. window.location.href = "@Url.Content("~/ExamSetting/ExamList")";
  274. }
  275. }
  276. function builderLibarys(nodes) {
  277. $('#divLibarys').html('');
  278. for (var i = 0; i < nodes.length; i++) {
  279. var html = "<tr><td width='90'>" + nodes[i].text + ":</td><td><input type='text' style='width:40px' id='txtNumber' value='0'/><input type='hidden' id='hdLibaryID' value='" + nodes[i].id + "'/></td></tr>"
  280. $('#divLibarys').append(html);
  281. }
  282. serialLiabry();
  283. setQuestiontotalCountByType();
  284. }
  285. function builderLibarysSettings(nodes) {
  286. $('#divLibarys').html('');
  287. for (var i = 0; i < nodes.length; i++) {
  288. var html = "<tr><td width='90'>" + nodes[i].Name + ":</td><td><input type='text' style='width:40px' id='txtNumber' value='" + nodes[i].Number + "'/><input type='hidden' id='hdLibaryID' value='" + nodes[i].Libaryid + "'/></td></tr>"
  289. $('#divLibarys').append(html);
  290. }
  291. serialLiabry();
  292. setQuestionSettings();
  293. }
  294. function setQuestionSettings() {
  295. var QuestionTypeString = $('#QuestionTypeString').val();
  296. if (QuestionTypeString != "" && QuestionTypeString != undefined) {
  297. var QuestionType = JSON.parse(QuestionTypeString);
  298. $(QuestionType).each(function (i, qustype) {
  299. var tr = $('input:hidden[id=' + qustype.QType + ']').closest("tr");
  300. $(tr).find('input:hidden').attr('id', qustype.QType);
  301. $(tr).find('input:text').eq(0).val(qustype.PSum);
  302. $(tr).find('input:text').eq(1).val(qustype.TSum);
  303. $(tr).find('input:text').eq(2).val(qustype.QScore);
  304. })
  305. }
  306. }
  307. function serialQuestionType() {
  308. var libarys = new Array();
  309. $('.AddQuesType').find('tr:gt(0)').each(function (index, tr) {
  310. var quesType = $(tr).find('input:hidden').attr('id');
  311. var number = $(tr).find('input:text').eq(0).val();
  312. var tnumber = $(tr).find('input:text').eq(1).val();
  313. var score = $(tr).find('input:text').eq(2).val();
  314. libarys.push({
  315. PSum: number,
  316. QScore: score,
  317. TSum: tnumber,
  318. QType: quesType
  319. });
  320. })
  321. $('#QuestionTypeString').val(JSON.stringify(libarys));
  322. }
  323. function serialLiabry() {
  324. var libarys = new Array();
  325. $('#divLibarys').find('tr').each(function (i, j) {
  326. var name = $(this).find('td').eq(0).text().toString().replace(/:/g, "");
  327. var libaryid = $(this).find('#hdLibaryID').val();
  328. var number = $(this).find('#txtNumber').val();
  329. libarys.push({
  330. Libaryid: libaryid,
  331. Number: number,
  332. Name: name
  333. });
  334. })
  335. $('#LibarysString').val(JSON.stringify(libarys));
  336. }
  337. //设置可取题目数
  338. function setQuestiontotalCountByType() {
  339. var formData = $('form').serializeArray();
  340. beginInvoke('@Url.Content("~/PaperSetting/ArrangePaper")', formData, function (result) {
  341. $('.AddQuesType').find('input:disabled').val("0");
  342. $(result).each(function (i, j) {
  343. $('.AddQuesType').find('tr').each(function (index, tr) {
  344. var type = $(tr).find('[id=' + j.TypeID + ']');
  345. if (type.length > 0) {
  346. $(tr).find('input:disabled').val(j.Number);
  347. }
  348. })
  349. })
  350. });
  351. }
  352. </script>
  353. }