398 lines
12 KiB
Plaintext
398 lines
12 KiB
Plaintext
<%@ page contentType="text/html;charset=UTF-8" %>
|
|
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
|
<!DOCTYPE html >
|
|
<html lang="en">
|
|
<head>
|
|
<%@include file="../baseset.jsp" %>
|
|
<%@include file="../systemset.jsp" %>
|
|
<link rel="stylesheet" href="${bonuspath}/static/plugins/zTree/3.5/zTreeStyle.css" />
|
|
<style type="text/css">
|
|
.roleTree {
|
|
width:100% !important;
|
|
height:500px !important;
|
|
background: none repeat scroll 0 0 #fff !important;
|
|
border:1px solid #ddd !important
|
|
}
|
|
.exp{
|
|
postion:absolute;
|
|
max-hight: 36px;
|
|
line-height: 25px;
|
|
background-color:#1761c1;
|
|
border-radius:5px;
|
|
text-align:center;
|
|
padding:0.3%;
|
|
color:white;
|
|
border:none;
|
|
margin-top:-5%;
|
|
font-size: smaller;
|
|
}
|
|
|
|
</style>
|
|
<script src="${bonuspath}/static/plugins/zTree/3.5/jquery.ztree.all.min.js"></script>
|
|
</head>
|
|
<body>
|
|
<div class="page-content">
|
|
<div class="row-fluid">
|
|
<div class="col-xs-12">
|
|
<div class="row">
|
|
<div class="col-sm-2">
|
|
<ul id="roleTree" class="ztree roleTree"></ul>
|
|
</div>
|
|
<div class="col-sm-10">
|
|
<div class="row page-header" style="padding: 0; margin: 0;">
|
|
<h1> 题库 <small><i class="icon-double-angle-right"></i><span id='roleVisName'>请选择专业</span></small></h1>
|
|
</div>
|
|
<form id="baseForm" class="form-inline" method="POST" onsubmit="return false;">
|
|
<div class="widget-header widget-header-large" style="padding:10px;">
|
|
<div class="widget-main customBtn" >
|
|
<input type='hidden' id="questionType" name='questionType' value='0'/>
|
|
<input id="keyWord" type="text" name="keyWord" placeholder="输入题干或选项关键词" />
|
|
<select name="classification" id="classification">
|
|
<option value="">选择题目类型</option>
|
|
<option value="1">单选题</option>
|
|
<option value="2">多选题</option>
|
|
<option value="3">判断题</option>
|
|
<option value="4">填空题</option>
|
|
<option value="5">简答题</option>
|
|
<option value="6">案例题</option>
|
|
</select>
|
|
<select name="questionLevel" id="questionLevel">
|
|
<option value="">选择难度</option>
|
|
<option value="1">简单</option>
|
|
<option value="2">普通</option>
|
|
<option value="3">困难</option>
|
|
</select>
|
|
<button class="btn btn-success btn-sm" onclick="getbaseList(1)" id="search" title="查询" type="button">查询</button>
|
|
<input id="articleImageFile" type="file" class="form-control" style="width: 200px; display: inline;" />
|
|
<button type="button" class="exp" onclick="importData();">批量导入</button>
|
|
<button type="button" class="exp" onclick="importTemplate();" style="width:90px;">导入模板下载</button>
|
|
</div>
|
|
<div class="widget-toolbar customBtn">
|
|
<a title="新增" onclick="add()" class="lrspace3" ><i class='icon-plus-sign color bigger-180'></i></a>
|
|
<a title="批量删除" onclick="del()" class="lrspace3" ><i class='icon-remove-sign col bigger-180'></i></a>
|
|
<a title="打印" id="printBtns" onclick="print()" class="lrspace3" ><i class='icon-print color-green bigger-180'></i></a>
|
|
<a title="刷新" id="searchBtn" onclick="getbaseList()" class="lrspace3" ><i class='icon-refresh bigger-180 orange'></i></a>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
<table id="baseTable" class="table table-striped table-bordered table-hover">
|
|
<thead>
|
|
<tr>
|
|
<th style="width:4%" class="center">
|
|
<input type="checkbox" id="checkAll" onclick="checkAllId()"/>
|
|
</th>
|
|
<th style="width:4%" class='center'>序号</th>
|
|
<th style="width:15%" class="center">题目内容</th>
|
|
<th style="width:12%" class="center">选项</th>
|
|
<th style="width:20%" class="center">正确答案</th>
|
|
<th style="width:6%" class="center">类型</th>
|
|
<th style="width:10%" class="center">上传日期</th>
|
|
<th style="width:6%" class="center">分值</th>
|
|
<th style="width:6%" class="center">难度</th>
|
|
<th style="width:6%" class="center">操作</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<!-- #dialog-confirm -->
|
|
<%@include file="../dialog.jsp" %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
$(function() {
|
|
// 初始化树
|
|
getRoleTreeData();
|
|
});
|
|
|
|
//树的设置
|
|
var setting1 = {
|
|
view : {
|
|
selectedMulti : false
|
|
},
|
|
data : {
|
|
simpleData : {
|
|
enable : true
|
|
}
|
|
},
|
|
edit : {
|
|
enable : false,
|
|
},
|
|
callback : {
|
|
onClick : onTreeClick,
|
|
// 点击前
|
|
beforeClick : beforeClick,
|
|
// 不允许拖拽
|
|
beforeDrag : beforeDrag
|
|
}
|
|
};
|
|
|
|
function beforeClick(treeId, treeNode) {
|
|
if (treeNode.id == 0) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// 不允许拖拽
|
|
function beforeDrag(treeId, treeNodes) {
|
|
return false;
|
|
}
|
|
|
|
// 定义树节点初始数据
|
|
var zNodes1 = [{
|
|
id : 0,
|
|
pId : -1,
|
|
open : true,
|
|
name : "专业题库列表",
|
|
icon : bonuspath + "/static/css/sys/images/user.gif"
|
|
}];
|
|
|
|
//获取数据初始化树
|
|
function getRoleTreeData() {
|
|
$.ajax({
|
|
type : 'POST',
|
|
url : bonuspath + '/backstage/org/findAllList',
|
|
data : null,
|
|
success : function(result) {
|
|
var nodes = zNodes1.concat(result.obj);
|
|
$.fn.zTree.init($("#roleTree"), setting1, nodes);
|
|
},
|
|
error : function(e) {
|
|
JY.Model.info(e.resMsg);
|
|
},
|
|
dataType : 'json'
|
|
});
|
|
}
|
|
|
|
function add() {
|
|
var index = layer.open({
|
|
type: 2,
|
|
title: "新增题目",
|
|
btn:["保存","取消"],
|
|
shade: [0],
|
|
area: ['60%', '70%'],
|
|
anim: 2,
|
|
yes: function(index, layero) {
|
|
var obj = $(layero).find("iframe")[0].contentWindow;
|
|
var valid = obj.formValid();
|
|
if(!valid) {
|
|
return;
|
|
}
|
|
obj.addQuestion();
|
|
},
|
|
content: [bonuspath +'/backstage/question/questionFormPage']
|
|
});
|
|
}
|
|
|
|
function view(questionId) {
|
|
var index = layer.open({
|
|
type: 2,
|
|
title: "题目详情查看",
|
|
btn:["取消"],
|
|
shade: [0],
|
|
area: ['60%', '70%'],
|
|
anim: 2,
|
|
content: [bonuspath +'/backstage/question/findQuestionForm?questionId='+questionId+'&type=view']
|
|
});
|
|
}
|
|
|
|
function edit(questionId) {
|
|
var index = layer.open({
|
|
type: 2,
|
|
title: "题目修改",
|
|
btn:["保存","取消"],
|
|
shade: [0],
|
|
area: ['60%', '70%'],
|
|
anim: 2,
|
|
yes: function(index, layero) {
|
|
var obj = $(layero).find("iframe")[0].contentWindow;
|
|
var valid = obj.formValid();
|
|
if(!valid) {
|
|
return;
|
|
}
|
|
obj.updateQuestion();
|
|
},
|
|
content: [bonuspath +'/backstage/question/findQuestionForm?questionId='+questionId+'&type=edit']
|
|
});
|
|
}
|
|
|
|
function onTreeClick(event, treeId, treeNode, clickFlag) {
|
|
$("#roleVisName").html(treeNode.name);
|
|
$("#questionType").val(treeNode.id);
|
|
obj = {};
|
|
var init = 1;
|
|
if(!JY.Object.notNull(init)){
|
|
init = $("#pageNum").val();
|
|
}
|
|
var size = $("#pageSize").val();
|
|
var data = {pageNum:init,pageSize:size};
|
|
data.obj = getObjParam("baseForm");
|
|
var idx = layer.msg('正在加载数据,请稍等...', {
|
|
icon: 16
|
|
,shade: 0.01
|
|
,time:'-1'
|
|
});
|
|
$.ajax({
|
|
type:"POST",
|
|
url:bonuspath +'/backstage/question/findByPage',
|
|
data: JSON.stringify(data),
|
|
dataType:"html",
|
|
contentType:"application/json",
|
|
success:function(data){
|
|
$("#baseTable tbody").html(data);
|
|
layer.close(idx);
|
|
}
|
|
})
|
|
}
|
|
|
|
function getbaseList(init){
|
|
obj = {};
|
|
if(!JY.Object.notNull(init)){
|
|
init = $("#pageNum").val();
|
|
}
|
|
var size = $("#pageSize").val();
|
|
var data = {pageNum:init,pageSize:size};
|
|
data.obj = getObjParam("baseForm");
|
|
var idx = layer.msg('正在加载数据,请稍等...', {
|
|
icon: 16
|
|
,shade: 0.01
|
|
,time:'-1'
|
|
});
|
|
$.ajax({
|
|
type:"POST",
|
|
url:bonuspath +'/backstage/question/findByPage',
|
|
data: JSON.stringify(data),
|
|
dataType:"html",
|
|
contentType:"application/json",
|
|
success:function(data){
|
|
$("#baseTable tbody").html(data);
|
|
layer.close(idx);
|
|
}
|
|
})
|
|
}
|
|
|
|
//批量删除
|
|
function del() {
|
|
var ids = checkIdList();
|
|
if(ids == null || ids == ''){
|
|
var message = layer.confirm("<h4 style='color:red'>请至少选择一条数据</h4>",{btn:['确认','取消']},function(){
|
|
layer.close(message);
|
|
})
|
|
}else{
|
|
var indexMsg = layer.confirm("<h4 style='color:red'>您确定删除所选题目吗?</h4>", {btn: ['确认','取消']},function(){
|
|
layer.close(indexMsg);
|
|
var idx = layer.msg('正在提交数据,请稍等...', {
|
|
icon: 16
|
|
,shade: 0.01
|
|
,time:'-1'
|
|
});
|
|
$.ajax({
|
|
type:"POST",
|
|
url:bonuspath +'/backstage/question/deleteApply',
|
|
data:{ids:ids},
|
|
success:function(data) {
|
|
layer.close(idx);
|
|
var datas = JSON.parse(data);
|
|
var indexMsg = layer.confirm("<h3 style='color:red'>"+datas.resMsg+"</h3>", {btn: ['关闭']},function(){
|
|
layer.close(indexMsg);
|
|
getbaseList();
|
|
});
|
|
},
|
|
error:function(data){
|
|
layer.close(idx);
|
|
var indexMsg = layer.confirm('请求发送失败', {btn: ['关闭']},function(){
|
|
layer.close(indexMsg);
|
|
});
|
|
}
|
|
})
|
|
});
|
|
}
|
|
}
|
|
|
|
//全选checkbox功能
|
|
function checkAllId() {
|
|
var checkAll = document.getElementById("checkAll");
|
|
var checked = $(checkAll).prop('checked');
|
|
var ids = document.getElementsByName("ids");
|
|
if(checked){
|
|
for(var i in ids){
|
|
ids[i].checked = true;
|
|
}
|
|
}else{
|
|
for(var i in ids){
|
|
ids[i].checked = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
//获取多选ID
|
|
function checkIdList(){
|
|
var ids = '';
|
|
$("input[type='checkbox']:checked").each(function() {
|
|
var id = $(this).val();
|
|
ids += id + ',';
|
|
|
|
})
|
|
return ids;
|
|
}
|
|
|
|
function importData() {
|
|
var formData = new FormData($('form')[0]);
|
|
var name = $("#articleImageFile").val();
|
|
if(name==null|| name == "") {
|
|
return;
|
|
}
|
|
if(!(name.endsWith(".xls") || name.endsWith(".xlsx") || name.endsWith(".xlsm"))) {
|
|
alert("请上传正确的Excel表格!");
|
|
$("#articleImageFile").val("");
|
|
return;
|
|
}
|
|
formData.append("file", $("#articleImageFile")[0].files[0]);
|
|
var idx = layer.msg('正在提交数据,请稍等...', {
|
|
icon: 16
|
|
,shade: 0.01
|
|
,time:'-1'
|
|
});
|
|
$.ajax({
|
|
url : bonuspath + "/backstage/question/import",
|
|
type : 'POST',
|
|
async : true,
|
|
data : formData,
|
|
timeout:20000,
|
|
// 告诉jQuery不要去处理发送的数据
|
|
processData : false,
|
|
// 告诉jQuery不要去设置Content-Type请求头
|
|
contentType : false,
|
|
success : function(data) {
|
|
layer.close(idx);
|
|
var datas = JSON.parse(data);
|
|
var indexMsg = layer.confirm("<h3 style='color:red'>"+datas.resMsg+"</h3>", {btn: ['关闭']},function(){
|
|
layer.close(indexMsg);
|
|
getbaseList();
|
|
});
|
|
},
|
|
error:function(XMLHttpRequest, textStatus, errorThrown) {
|
|
console.log(JSON.stringify(errorThrown));
|
|
layer.close(idx);
|
|
var datas = JSON.parse(data);
|
|
var indexMsg = layer.confirm("<h3 style='color:red'>"+datas.resMsg+"</h3>", {btn: ['关闭']},function(){
|
|
layer.close(indexMsg);
|
|
});
|
|
}
|
|
});
|
|
$("#articleImageFile").val("");
|
|
}
|
|
|
|
function importTemplate() {
|
|
//document.location= bonuspath+"/static/js/model/题库导入模板.xls";
|
|
//$(location).attr("href",bonuspath +'/backstage/user/downloadExcel?type=3');
|
|
document.location= bonuspath+"/static/js/model/题库模板.xls";
|
|
}
|
|
</script>
|
|
</body>
|
|
</html> |