RuoYi/ruoyi-exam/src/main/resources/templates/exam/examQuestion/examQuestion.html

224 lines
8.4 KiB
HTML

<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link th:href="@{/ajax/libs/jquery-layout/jquery.layout-latest.css}" rel="stylesheet"/>
<link th:href="@{/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css}" rel="stylesheet"/>
<body class="gray-bg">
<div class="ui-layout-west">
<div class="main-content">
<div class="box box-main">
<div class="box-header">
<div class="box-title">
<i class="fa icon-grid"></i> 题库
</div>
<div class="box-tools pull-right">
<a type="button" class="btn btn-box-tool menuItem" href="#" onclick="examQuestionCategory()"
title="题库管理"><i
class="fa fa-edit"></i></a>
<button type="button" class="btn btn-box-tool" id="btnExpand" title="展开" style="display:none;"><i
class="fa fa-chevron-up"></i></button>
<button type="button" class="btn btn-box-tool" id="btnCollapse" title="折叠"><i
class="fa fa-chevron-down"></i></button>
<button type="button" class="btn btn-box-tool" id="btnRefresh" title="刷新题库"><i
class="fa fa-refresh"></i></button>
</div>
</div>
<div class="ui-layout-content">
<div id="tree" class="ztree"></div>
</div>
</div>
</div>
</div>
<div class="container-div ui-layout-center">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<input type="hidden" id="categoryId" name="categoryId" value="1">
<div class="select-list">
<ul>
<li>
问题标题:<input type="text" name="title"/>
</li>
<li>
问题类型:<select name="type" th:with="type=${@dict.getType('exam_question_type')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
<a class="btn btn-success" onclick="addChoiceQuestion()" shiro:hasPermission="exam:examQuestion:add">
<i class="fa fa-plus"></i> 添加单选题
</a>
<a class="btn btn-success" onclick="addMoreChoiceQuestion()" shiro:hasPermission="exam:examQuestion:add">
<i class="fa fa-plus"></i> 添加多选题
</a>
<a class="btn btn-success" onclick="addJudgeQuestion()" shiro:hasPermission="exam:examQuestion:add">
<i class="fa fa-plus"></i> 添加判断题
</a>
<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()"
shiro:hasPermission="exam:examQuestion:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()"
shiro:hasPermission="exam:examQuestion:remove">
<i class="fa fa-remove"></i> 删除
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
</div>
</div>
</div>
<div th:include="include :: footer"></div>
<script th:src="@{/ajax/libs/jquery-layout/jquery.layout-latest.js}"></script>
<script th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('exam:examQuestion:edit')}]];
var removeFlag = [[${@permission.hasPermi('exam:examQuestion:remove')}]];
var type = [[${@dict.getType('exam_question_type')}]];
var prefix = ctx + "exam/examQuestion";
$(function () {
$('body').layout({west__size: 185});
queryExamQuestionList();
$("#categoryId").val(1);
$.table.search();
queryExamQuestionCategoryTree();
});
function queryExamQuestionList() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "问题",
search: false,
showExport: true,
columns: [{
checkbox: true
},{
field:"id",
title: '#',
visible: false
},
{
field: 'title',
title: '问题标题',
sortable: true
},
{
field: 'type',
title: '问题类型',
sortable: true,
formatter: function(value, item, index) {
debugger
return $.table.selectDictLabel(type, item.type);
}
},
{
field: 'createBy',
title: '创建者',
sortable: true
},
{
field: 'createDate',
title: '创建时间',
sortable: true
},
{
title: '操作',
align: 'center',
formatter: function (value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
};
function queryExamQuestionCategoryTree() {
var url = ctx + "exam/examQuestionCategory/treeData";
var options = {
url: url,
expandLevel: 2,
onClick: zOnClick
};
$.tree.init(options);
function zOnClick(event, treeId, treeNode) {
$("#categoryId").val(treeNode.id);
$.table.search();
}
}
$('#btnExpand').click(function () {
$._tree.expandAll(true);
$(this).hide();
$('#btnCollapse').show();
});
$('#btnCollapse').click(function () {
$._tree.expandAll(false);
$(this).hide();
$('#btnExpand').show();
});
$('#btnRefresh').click(function () {
queryExamQuestionCategoryTree();
});
/*用户管理-部门*/
function examQuestionCategory() {
var url = ctx + "exam/examQuestionCategory";
createMenuItem(url, "题库管理");
}
function addChoiceQuestion(){
if(!$.tree.notAllowParents($._tree)){
return ;
}
var url = prefix + "/choiceadd/"+$("#categoryId").val();
$.operate.jumpModeltoUrl("添加单选题",url);
}
function addMoreChoiceQuestion(){
if(!$.tree.notAllowParents($._tree)){
return ;
}
var url = prefix + "/morechoiceadd/"+$("#categoryId").val();
$.operate.jumpModeltoUrl("添加多选题",url);
}
function addJudgeQuestion(){
if(!$.tree.notAllowParents($._tree)){
return ;
}
var url = prefix + "/judgeadd/"+$("#categoryId").val();
$.operate.jumpModeltoUrl("添加多选题",url);
}
</script>
</body>
</html>