<!DOCTYPE html>
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
<head>
|
<th:block th:include="include :: header('请选择题目')"/>
|
<style>
|
.changeColor {
|
background-color: #337dff !important;
|
color: #fffefa !important;
|
}
|
</style>
|
</head>
|
<body class="gray-bg">
|
<div class="container-div">
|
<div class="row">
|
<div class="col-sm-12 search-collapse">
|
<form id="formId">
|
<div class="select-list">
|
<input type="hidden" name="questionTemplateId" th:value="${questionTemplateId}"/>
|
<ul>
|
<li>
|
<p>题干:</p>
|
<input type="text" name="infoTextContentId"/>
|
</li>
|
<li>
|
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
|
class="fa fa-search"></i> [[#{basis.search}]]</a>
|
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
|
class="fa fa-refresh"></i> [[#{basis.reset}]]</a>
|
</li>
|
</ul>
|
</div>
|
</form>
|
</div>
|
<div class="col-sm-12 select-table table-striped">
|
<table id="bootstrap-table" data-mobile-responsive="true"></table>
|
<div class="col-sm-offset-5 col-sm-10">
|
<button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i
|
class="fa fa-check"></i>save
|
</button>
|
<button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i
|
class="fa fa-reply-all"></i>close
|
</button>
|
</div>
|
</div>
|
</div>
|
</div>
|
<th:block th:include="include :: footer"/>
|
<script th:inline="javascript">
|
var editFlag = [[${@permission.hasPermi('exam:question:edit')}]];
|
var removeFlag = [[${@permission.hasPermi('exam:question:remove')}]];
|
var prefix = ctx + "exam/question";
|
var $parent = $.operate.parentHtml();
|
$(function () {
|
var questionTemplateId = [[${questionTemplateId}]];
|
var langType = [[${langType}]];
|
var options = {
|
url: prefix + "/listForProductAddQuestion",
|
queryParams: function () {
|
var temp = {
|
questionTemplateId: questionTemplateId,
|
langType: langType
|
};
|
|
return temp;
|
},
|
modalName: [[#{menu.exam.question.view}]],
|
columns: [{
|
checkbox: true,
|
//formatter:stateFormatter
|
},
|
{
|
field: 'id',
|
title: [[#{jsp.exam.product.titleCode}]]
|
},
|
{
|
field: 'title',
|
title: [[#{jsp.exam.product.questionStem}]]
|
},
|
{
|
field: 'levelName',
|
title: [[#{menu.exam.level.view}]]
|
},
|
{
|
field: 'permanentId',
|
title: [[#{jsp.exam.question.questionNumberPermanent}]]
|
},
|
],
|
onLoadSuccess: function (data) {
|
//打开的时候选中
|
$.btTable.bootstrapTable('uncheckAll');
|
var $thisContent = $parent.$('#headline');;
|
var $checkedValues = $thisContent.find('[name="questionId"]');
|
var checkby = {};
|
checkby['field'] = 'id';
|
checkby['values'] = [];
|
$($checkedValues).each(function (i) {
|
checkby['values'].push(parseInt($(this).val()));
|
});
|
$.btTable.bootstrapTable('checkBy', checkby);
|
}
|
};
|
$.table.init(options);
|
});
|
|
function stateFormatter(value, row, index) {
|
// var $thisContent = $parent.$('[add-question-edit="true"]').parents('#headline');
|
var $thisContent = $parent.$('#headline');
|
var $checkedValues = $thisContent.find('[name="questionId"]');
|
var flag = true;
|
row['checked'] = false;
|
$($checkedValues).each(function (i) {
|
if (row.id == parseInt($(this).val())) {
|
row.checked = true;
|
flag = false;
|
}
|
});
|
|
if (!flag) {
|
return {
|
disabled: true,//设置是否可用
|
checked: true//设置选中
|
};
|
}
|
return value;
|
}
|
|
// add-question
|
function submitHandler() {
|
var $tableSelect = $.btTable.bootstrapTable('getSelections');
|
$parent.$('#headline').empty();
|
|
$.each($tableSelect, function (index, obj) {
|
if (!obj.checked) {// if do not checked
|
// 清空后再添加
|
var $hiddenTitle = $parent.$('#hiddenTitle').clone();
|
$hiddenTitle.removeAttrs('id');
|
$hiddenTitle.removeAttrs('hidden');
|
$hiddenTitle.find('[name="segmentationName"]').val(obj.title);
|
$hiddenTitle.find('[name="permanentId"]').val(obj.permanentId);
|
$hiddenTitle.find('[name="questionId"]').val(obj.id);
|
$parent.$('#headline').append($hiddenTitle);
|
|
}
|
});
|
|
var $title = $parent.$('#headline').find('.headline-index-seq');
|
var $description = $parent.$('#headline').find('.segment-discription-seq');
|
$title.each(function (i) {
|
$(this).text([[#{jsp.exam.product.question}]] + (i + 1) + " -");
|
$description.eq(i).text([[#{jsp.exam.product.question}]] + (i + 1) + [[#{jsp.exam.product.description}]] + " -");
|
});
|
|
$.modal.closeTab();
|
}
|
</script>
|
</body>
|
</html>
|