123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- @using Bowin.Web.Controls.Mvc;
- @using EMISOnline.Entities;
- @using EMISOnline.Web.Controls;
- @{
- ViewBag.Title = "List";
-
- }
- <div class="easyui-panel" data-options="border:false,fit:true" style="position: relative;
- overflow: auto;">
- @Html.Position()
- <div class="p_SearchTitle">
- <div style="float: left; margin-left: 10px; font-size: 12px; line-height: 30px;">
- 查询条件</div>
- </div>
- @using (Ajax.BeginForm(new AjaxOptions
- {
- OnSuccess = "EMISFunction.FormSuccess",
- OnBegin = "EMISFunction.FormSubmit",
- OnComplete = "EMISFunction.FormComplete",
- }))
- {
- @Html.Hidden("ac", @ViewBag.Action as string)
- @Html.Hidden("paperid")
- @Html.Hidden("hid_Dynamic")
- @Html.Hidden("hid_Setting")
- @Html.Hidden("hid_pageSetting")
- <div class="search_keyword">
- <div class="search_input">
- <ul>
- <li class="sn" style="width: 50%"> </li>
- <li>
- @Html.Button(new ButtonOptions() { ID = "btnSelect", Text = "选择试题" })
- @Html.Button(new ButtonOptions() { ID = "btnSetScore", Text = "批量设置分数" })
- @Html.Button(new ButtonOptions() { ID = "btnDelete", Text = "删 除" })
- @if(ViewBag.action != "edit"){
- @Html.Button(new ButtonOptions() { ID = "btnPrev", Text = "上一步" });
- }
- @Html.Button(new ButtonOptions() { ID = "btnFinish", Text = "完 成" })
- </li>
- </ul>
- </div>
- </div>
- }
- <div class="p_title">
- <div style="float: left; margin-left: 10px; line-height: 30px; font-size: 12px;">
- 试题列表</div>
- <div style="margin-right: 10px; line-height: 30px; font-size: 12px;">
- </div>
- </div>
- <div class="search_list">
- @Html.DataGrid(new DataGridOptions
- {
- Columns = new List<DataGridColumn>()
- {
- new CheckBoxFieldColumn{ HeaderText="", FieldName="UserID"},
- new BoundFieldColumn { FieldName="content", HeaderText="题干内容", Align=AlignStyle.Center },
- new BoundFieldColumn { FieldName="question_type", HeaderText="试题类型", Align=AlignStyle.Center },
- new BoundFieldColumn { FieldName="difficulty_degree", HeaderText="难度系数", Align=AlignStyle.Center},
- new BoundFieldColumn { FieldName="created_date", HeaderText="创建日期", Align=AlignStyle.Center },
- new TextBoxColumn { FieldName="score", HeaderText="分数", OnChangedFunc="scoreChange", Align=AlignStyle.Center },
- },
- IsCheckOnSelect = true,
- DataSourceUrl = Url.Content("~/PaperSetting/GetPaperList?paperid=" + ViewBag.paperid + "&ac=" + ViewBag.action),
- ID = "dgList",
- IsPagination = true,
- IsShowRowNumbers = true,
- IsSingleSelect = false,
- IsVerticalExpand = true,
- IsAutoHeight = false,
- })
- </div>
- </div>
- @section scripts{
- <script type="text/javascript">
- $(function () {
- $('#btnPrev').click(function () {
- window.location.href = "@Url.Content("~/PaperSetting/PageSetupOne")?paperid=@(ViewBag.paperid)&ac=@(ViewBag.action)";
- })
- var score;
- var pg_settting;
- var al_text;
- $("#btnFinish").click(function () {
- score = 0.00;
- pg_settting = "";
- //判断试卷是否为动态试卷
- var isDynamic = $("#hid_Dynamic").val();
- var rows = $('#dgList').cmsXDataTable('getRows');
- if (isDynamic == "1") {
- if (!isEquals()) { //动态试卷的同种类型题目不能分值不一致
- alert("本试卷的类型是动态试卷,不允许同类型的题目中存在不同分值的题目,请检查!");
- return false;
- }
- var ques_setting = $("#hid_Setting").val();
- var ques_setting_list = JSON.parse(ques_setting);
- //score = 0;
- $(ques_setting_list).each(function (i, item) {
- var questions = getQuestionByTypeID(item.QType);
- var type_length = questions.length;
- if (type_length != 0) {
- var single_score = questions[0].score;
- if (type_length < parseFloat(item.PSum)) { //抽取的题目少于取题数时
- score += type_length * parseFloat(single_score)
- }
- else { //抽取的题目多于或等于取题数时
- score += parseFloat(item.item.PSum) * parseFloat(single_score);
- }
- }
- });
- al_text = "本试卷为动态试卷,最终形成的试卷总分为[" + score + "],是否继续?"
- }
- else { //静态试卷
- //计算试卷的总分
- score = rows.sum("score");
- al_text = "本试卷的总分为[" + score + "],是否继续?"
- }
- //计算试卷的总分
- $(rows).each(function (i, item) {
- pg_settting += (item.test_question_Id) + "|" + (item.score) + ",";
- });
- //记录试题设置信息
- $("#hid_pageSetting").val(pg_settting);
- //判断整卷分数是否为100分
- if (score != 100) {
- // var al_text = "本试卷为动态试卷,最终形成的试卷总分为["+score+"],是否继续?"
- confirmMsg(al_text, function (r) {
- if (r) {
- $(document.forms[0]).submit();
- }
- });
- }
- });
- $('#btnDelete').click(function () {
- var rows = $('#dgList').cmsXDataTable('getSelections');
- if (rows.length == 0) {
- alertMsg("请选择要删除的试题!");
- return false;
- }
- var QuestionIDstr = rows.values("test_question_Id").join(",");
- beginInvoke('@Url.Content("~/PaperSetting/DeleteQuestion")', { QuestionIDstr: QuestionIDstr }, function (data) {
- $('#dgList').cmsXDataTable('loadData', data);
- })
- })
- })
- function getQuestionByTypeID(typeid) {
- var rows = $('#dgList').cmsXDataTable('getRows');
- var questions = new Array();
- for (var i in rows) {
- if (i.base_question_type_id == typeid)
- questions.push(rows[i]);
- }
- return questions;
- }
- function scoreChange(obj, index) {
- var sss;
- }
- </script>
- }
|