123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356 |
- @model EMISOnline.ViewModel.ExamView.PaperAddView
- @using EMISOnline.Web.Controls;
- @using Bowin.Web.Controls.Mvc;
- @{
- ViewBag.Title = "ExamAdd";
- }
- <div class="easyui-panel" data-options="border:false,fit:true" style="position: relative;
- overflow: auto;">
- @Html.Position()
- <div class="p_SearchTitle">
- </div>
- <div class="p_title">
- <div style="float: left; margin-left: 10px; color: #333; line-height: 35px; font-size: 12px;">
- 试卷信息</div>
- <div style="margin-right: 10px; float: right; line-height: 30px; font-size: 12px;">
- @Html.Button(new ButtonOptions() { ID = "btnSave", Text = "保 存" })
- </div>
- </div>
- @using (Ajax.BeginForm(new AjaxOptions
- {
- OnSuccess = "EMISFunction.FormSuccess",
- OnBegin = "EMISFunction.FormSubmit",
- OnComplete = "EMISFunction.FormComplete",
- }))
- {
- @Html.Hidden("LibarysString")
- @Html.Hidden("QuestionTypeString")
- <div class="search_list">
- <table cellpadding="0" cellspacing="0" id="Coursematerialtable">
- <tr>
- <th>@Html.LabelFor(x => x.templateid):
- </th>
- <td>
- @Html.Selector(new Bowin.Web.Controls.Mvc.SelectorOptions
- {
- ID = "test_paper_name",
- Name = "test_paper_id",
- IsSingleSelect = true,
- QueryParams = "id:1",
- DataUrl = Url.Content("~/ExamSetting/GetPaperList"),
- TextName = "test_paper_name",
- Title = "试卷列表",
- Colums = "Key:ID,试卷名称:PaperName:200:query,是否动态试卷:is_dynamic:100,试卷总分:paper_score:100,创建时间:created_date:100",
- DataValue = "test_paper_id",
- DataText = "PaperName",
- Width = 500,
- Required = true,
- })
- </td>
- </tr>
- <tr>
- <th>@Html.LabelFor(x => x.PageName):
- </th>
- <td>
- @Html.TextBoxFor(x => x.PageName, new Dictionary<string, object> { { "style", "width:80%" } })
- </td>
- </tr>
- <tr>
- <th>@Html.LabelFor(x => x.QuesLib):
- </th>
- <td>
- <a href="javascript:void(0);" id="btnPackerLib">选择</a>
- <table id="divLibarys">
- </table>
- </td>
- </tr>
- <tr>
- <th>@Html.LabelFor(x => x.ErrRate):
- </th>
- <td>
- @Html.TextBoxFor(model => model.ErrRate, new TextBoxOptions() { TextBoxType = TextBoxType.Normal })
- </td>
- </tr>
- <tr>
- <th>@Html.LabelFor(x => x.UseFBeg):
- </th>
- <td>
- @Html.TextBoxFor(model => model.UseFBeg, new TextBoxOptions() { TextBoxType = TextBoxType.Normal })
- 至
- @Html.TextBoxFor(model => model.UseFEnd, new TextBoxOptions() { TextBoxType = TextBoxType.Normal })
- </td>
- </tr>
- <tr>
- <th>@Html.LabelFor(x => x.QuesLevelBeg):
- </th>
- <td>
- @Html.TextBoxFor(model => model.QuesLevelBeg, new TextBoxOptions() { TextBoxType = TextBoxType.Normal })
- 至
- @Html.TextBoxFor(model => model.QuesLevelEnd, new TextBoxOptions() { TextBoxType = TextBoxType.Normal })
- </td>
- </tr>
- <tr>
- <th>@Html.LabelFor(x => x.QuesFCount):
- </th>
- <td>
- @Html.CheckBoxFor(model => model.QuesFCount, new { @value = "True", })<label>试题使用频率</label>
- @Html.CheckBoxFor(model => model.QuesUpdateTime, new { @value = "False", @checked = "checked", })<label>试题更新时间</label>
- </td>
- </tr>
- <tr>
- <th>@Html.LabelFor(x => x.PageType):
- </th>
- <td>
- @Html.RadioButtonFor(model => model.PageType, "0", new { @value = "0", @name = "isOpenAnswer" })<label>静态组卷</label>
- @Html.RadioButtonFor(model => model.PageType, "1", new { @value = "1", @checked = "checked", @name = "isOpenAnswer" })<label>动态组卷</label>
- </td>
- </tr>
- <tr>
- <th>@Html.LabelFor(x => x.QuesType):<br />
- <span style="color: Red;" id="totalSum"></span>
- </th>
- <td>
- <div class="AddQuesType">
- <table>
- <tr style="text-align: center;">
- <th style="width: 20%;">
- 试题类型
- </th>
- <th style="text-align: center; width: 25%;">
- 取题数
- </th>
- <th style="text-align: center; width: 25%;">
- 可取题数
- </th>
- <th style="text-align: center; display: none;" name="float">
- 分值
- </th>
- </tr>
- <tr>
- <td style="width: 20%;">
- <label>
- <input type="hidden" id="1" />单选题
- </label>
- </td>
- <td>
- <input type="text" value="0" />
- </td>
- <td>
- <input type="text" value="0" disabled="disabled" />
- </td>
- <td>
- <input type="text" style="display: none;" value="0" name="float" />
- </td>
- </tr>
- <tr>
- <td style="width: 20%;">
- <label>
- <input type="hidden" id="3" />多选题
- </label>
- </td>
- <td>
- <input type="text" value="0" />
- </td>
- <td>
- <input type="text" value="0" disabled="disabled" />
- </td>
- <td>
- <input type="text" style="display: none;" value="0" name="float" />
- </td>
- </tr>
- <tr>
- <td style="width: 20%;">
- <label>
- <input type="hidden" id="2" />填空题
- </label>
- </td>
- <td>
- <input type="text" value="0" />
- </td>
- <td>
- <input type="text" value="0" disabled="disabled" />
- </td>
- <td>
- <input type="text" style="display: none;" value="0" name="float" />
- </td>
- </tr>
- <tr>
- <td style="width: 20%;">
- <label>
- <input type="hidden" id="4" />是非题
- </label>
- </td>
- <td>
- <input type="text" value="0" />
- </td>
- <td>
- <input type="text" value="0" disabled="disabled" />
- </td>
- <td>
- <input type="text" style="display: none;" value="0" name="float" />
- </td>
- </tr>
- <tr>
- <td style="width: 20%;">
- <label>
- <input type="hidden" id="5" />简答题
- </label>
- </td>
- <td>
- <input type="text" value="0" />
- </td>
- <td>
- <input type="text" value="0" disabled="disabled" />
- </td>
- <td>
- <input type="text" style="display: none;" value="0" name="float" />
- </td>
- </tr>
- </table>
- </div>
- </td>
- </tr>
- <tr>
- <th>@Html.LabelFor(x => x.IsEnable):
- </th>
- <td>
- @Html.RadioButtonFor(model => model.IsEnable, "1", new { @value = "1", @name = "isOpenAnswer" })<label>是</label>
- @Html.RadioButtonFor(model => model.IsEnable, "0", new { @value = "0", @checked = "checked", @name = "isOpenAnswer" })<label>否</label>
- </td>
- </tr>
- </table>
- </div>
- }
- </div>
- <div id="dialog">
- </div>
- @section scripts{
- <script src="~/Scripts/Bowin.Control.Core/Controls/Selector.js" type="text/javascript"></script>
- <script type="text/jscript">
- $(function () {
- $('#btnSave').click(function () {
- serialLiabry();
- serialQuestionType();
- $(document.forms[0]).submit();
- })
- $('#btnPackerLib').click(function () {
- $('#dialog').dialog({
- title: '选择题库',
- width: 540, height: 385, closed: false, cache: false, isResize: false,
- href: '@Url.Content("~/PaperSetting/QuestionLibaryTree")',
- modal: true
- });
- })
- $('[name=PageType]').click(function () {
- togglePageType();
- })
- $('[name=float]').change(function () {
- totalSum();
- })
- var LibarysString = $('#LibarysString').val();
- if (LibarysString != "" && LibarysString != undefined) {
- builderLibarysSettings(JSON.parse(LibarysString));
- }
- togglePageType();
- })
- function totalSum() {
- var total = 0;
- $('.AddQuesType').find('tr:gt(0)').each(function (index, tr) {
- var number = $(tr).find('input:text').eq(0).val();
- var score = $(tr).find('input:text').eq(2).val();
- total = total + (parseFloat(number) * parseFloat(score));
- })
- $('#totalSum').text(total);
- }
- function togglePageType() {
- var PageType = $('[name=PageType]:checked').val();
- if (PageType == 1) {
- $('.AddQuesType').find('[name=float]').show();
- } else {
- $('.AddQuesType').find('[name=float]').hide();
- }
- }
- var FormFunction = {
- SubmitSuccess: function (data) {
- window.location.href = "@Url.Content("~/ExamSetting/ExamList")";
- }
- }
- function builderLibarys(nodes) {
- $('#divLibarys').html('');
- for (var i = 0; i < nodes.length; i++) {
- 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>"
- $('#divLibarys').append(html);
- }
- serialLiabry();
- setQuestiontotalCountByType();
- }
- function builderLibarysSettings(nodes) {
- $('#divLibarys').html('');
- for (var i = 0; i < nodes.length; i++) {
- 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>"
- $('#divLibarys').append(html);
- }
- serialLiabry();
- setQuestionSettings();
- }
- function setQuestionSettings() {
- var QuestionTypeString = $('#QuestionTypeString').val();
- if (QuestionTypeString != "" && QuestionTypeString != undefined) {
- var QuestionType = JSON.parse(QuestionTypeString);
- $(QuestionType).each(function (i, qustype) {
- var tr = $('input:hidden[id=' + qustype.QType + ']').closest("tr");
- $(tr).find('input:hidden').attr('id', qustype.QType);
- $(tr).find('input:text').eq(0).val(qustype.PSum);
- $(tr).find('input:text').eq(1).val(qustype.TSum);
- $(tr).find('input:text').eq(2).val(qustype.QScore);
- })
- }
- }
- function serialQuestionType() {
- var libarys = new Array();
- $('.AddQuesType').find('tr:gt(0)').each(function (index, tr) {
- var quesType = $(tr).find('input:hidden').attr('id');
- var number = $(tr).find('input:text').eq(0).val();
- var tnumber = $(tr).find('input:text').eq(1).val();
- var score = $(tr).find('input:text').eq(2).val();
- libarys.push({
- PSum: number,
- QScore: score,
- TSum: tnumber,
- QType: quesType
- });
- })
- $('#QuestionTypeString').val(JSON.stringify(libarys));
- }
- function serialLiabry() {
- var libarys = new Array();
- $('#divLibarys').find('tr').each(function (i, j) {
- var name = $(this).find('td').eq(0).text().toString().replace(/:/g, "");
- var libaryid = $(this).find('#hdLibaryID').val();
- var number = $(this).find('#txtNumber').val();
- libarys.push({
- Libaryid: libaryid,
- Number: number,
- Name: name
- });
- })
- $('#LibarysString').val(JSON.stringify(libarys));
- }
- //设置可取题目数
- function setQuestiontotalCountByType() {
- var formData = $('form').serializeArray();
- beginInvoke('@Url.Content("~/PaperSetting/ArrangePaper")', formData, function (result) {
- $('.AddQuesType').find('input:disabled').val("0");
- $(result).each(function (i, j) {
- $('.AddQuesType').find('tr').each(function (index, tr) {
- var type = $(tr).find('[id=' + j.TypeID + ']');
- if (type.length > 0) {
- $(tr).find('input:disabled').val(j.Number);
- }
- })
- })
- });
- }
- </script>
- }
|