509 lines
22 KiB
Plaintext
509 lines
22 KiB
Plaintext
<!DOCTYPE html
|
||
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
|
||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
|
||
<style type="text/css">
|
||
.select2-container .select2-selection--single {
|
||
height: 34px;
|
||
line-height: 34px;
|
||
}
|
||
|
||
.select2-selection__arrow {
|
||
margin-top: 3px;
|
||
}
|
||
|
||
</style>
|
||
|
||
<link rel="stylesheet" href="<%=request.getContextPath()%>/plugins/bootstrap-table/extensions/reorder-rows/bootstrap-table-reorder-rows.css"/>
|
||
<script type="text/javascript" src="<%=request.getContextPath()%>/plugins/bootstrap-table/jquery.tablednd.js" charset="utf-8"></script>
|
||
<script type="text/javascript" src="<%=request.getContextPath()%>/plugins/bootstrap-table/extensions/reorder-rows/bootstrap-table-reorder-rows.js" charset="utf-8"></script>
|
||
<script type="text/javascript">
|
||
function doupdate() {
|
||
$("#editForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#editForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/exam/examplan/updateExamPlan.do", $("#editForm").serialize(), function (result) {
|
||
if (result == 1) {
|
||
document.getElementById("subModal").setAttribute("class", "modal hidden fade");
|
||
$(".modal-backdrop").remove();
|
||
// closeModal('subModal');
|
||
$("#table").bootstrapTable('refresh');
|
||
} else if (result == 0) {
|
||
showAlert('d', '用户信息保存失败');
|
||
} else {
|
||
showAlert('d', result);
|
||
}
|
||
}, 'json');
|
||
}
|
||
}
|
||
|
||
$("#editForm").bootstrapValidator({
|
||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
fields: {
|
||
// passscore: {
|
||
// validators: {
|
||
// notEmpty: {
|
||
// message: '及格分数不能为空'
|
||
// }
|
||
// }
|
||
// },
|
||
examname: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '考试名称不能为空'
|
||
}
|
||
}
|
||
},
|
||
examnum: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '允许考试次数不能为空'
|
||
},
|
||
regexp: {
|
||
regexp: /^[0-9]*$/,
|
||
message: '允许考试次数必须为数字'
|
||
}
|
||
}
|
||
},
|
||
// releasetime: {
|
||
// validators: {
|
||
// notEmpty: {
|
||
// message: '发布时间不能为空'
|
||
// }
|
||
// }
|
||
// },
|
||
startdate: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '考试开始日期不能为空'
|
||
}
|
||
}
|
||
},
|
||
enddate: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '考试结束日期不能为空'
|
||
}
|
||
}
|
||
},
|
||
examminutes: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '考试时间(分钟)不能为空'
|
||
},
|
||
regexp: {
|
||
regexp: /^[0-9]*$/,
|
||
message: '考试时间(分钟)必须为数字'
|
||
}
|
||
}
|
||
},
|
||
examuserids: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '考试人员不能为空'
|
||
}
|
||
}
|
||
}
|
||
}
|
||
});
|
||
var addDetailFun = function() {
|
||
var questitleid=$('#id').val();
|
||
// stopBubbleDefaultEvent();
|
||
$.post(ext.contextPath + '/exam/examTitleRange/showExamTitleRangeAdd.do' ,{questitleid:questitleid}, function(data) {
|
||
$("#subDetailDiv").html(data);
|
||
openModal('subDetailModal');
|
||
});
|
||
};
|
||
|
||
var editDetailFun = function(id) {
|
||
// stopBubbleDefaultEvent();
|
||
$.post(ext.contextPath + '/exam/examTitleRange/showExamTitleRangeEdit.do', {id:id} , function(data) {
|
||
$("#subDetailDiv").html(data);
|
||
$("#subDetailModal").modal("show");
|
||
});
|
||
};
|
||
var deleteDetailFun = function(id) {
|
||
// stopBubbleDefaultEvent();
|
||
if(confirm("信息删除后不能恢复,请问要执行删除操作吗?")){
|
||
$.post(ext.contextPath + '/exam/examTitleRange/deleteExamTitleRange.do', {id : id}, function(data) {
|
||
if(data==1){
|
||
$("#table_Detail").bootstrapTable('refresh');
|
||
}else{
|
||
showAlert('d','删除失败','mainAlertDetaildiv');
|
||
}
|
||
});
|
||
}
|
||
};
|
||
|
||
function gotoDate(){
|
||
var sdt = $('#startdate').val();
|
||
var edt = $('#enddate').val();
|
||
|
||
if(sdt!=null && sdt!='' && edt!=null && edt!=''){
|
||
if(edt<sdt){
|
||
alert('结束时间不能小于开始时间!');
|
||
$('#enddate').val('');
|
||
$('#_examminutes').val('');
|
||
$('#examminutes').val('');
|
||
}else{
|
||
var sdttime = new Date(sdt);
|
||
var endtime = new Date(edt);
|
||
var span = endtime.getTime() - sdttime.getTime();
|
||
|
||
//相差分钟数
|
||
var leave1 = span % (24 * 3600 * 1000);
|
||
var hours = Math.floor(leave1 / (60 * 1000))
|
||
$('#_examminutes').val(hours);//用于显示
|
||
$('#examminutes').val(hours);//存数据库
|
||
}
|
||
}
|
||
}
|
||
|
||
var deletesDetailFun = function() {
|
||
var checkedItems = $("#table_Detail").bootstrapTable('getSelections');
|
||
var datas="";
|
||
$.each(checkedItems, function(index, item){
|
||
datas+=item.id+",";
|
||
});
|
||
if(datas==""){
|
||
showAlert('d','请先选择记录','mainAlertDetaildiv');
|
||
}else{
|
||
if(confirm("信息删除后不能恢复,请问要执行删除操作吗?")){
|
||
$.post(ext.contextPath + '/exam/examTitleRange/deleteExamTitleRanges.do', {ids:datas} , function(data) {
|
||
if(data>0){
|
||
$("#table_Detail").bootstrapTable('refresh');
|
||
}else{
|
||
showAlert('d','删除失败','mainAlertDetaildiv');
|
||
}
|
||
});
|
||
}
|
||
|
||
}
|
||
};
|
||
var showUser4SelectsFun = function() {
|
||
var userIds= $("#examuserids").val();
|
||
$.post(ext.contextPath + '/user/userForSelect.do', {formId:"editForm",hiddenId:"examuserids",textId:"_auditMan",userIds:userIds} , function(data) {
|
||
$("#user4SelectDiv").html(data);
|
||
openModal("user4SelectModal");
|
||
});
|
||
};
|
||
var typechange = function(){
|
||
if($("#examtype").val()=="正式考试"){
|
||
$("#frequency-div").hide();
|
||
|
||
// $("#computescore-label").show();
|
||
// $("#computescore-div").show();
|
||
$("#computescore").val("是");
|
||
// $("#passscore-label").show();
|
||
// $("#passscore-div").show();
|
||
// $("#passscore").val("60");
|
||
// $("#frequency").attr("value","");
|
||
}else if($("#examtype").val()=="模拟考试"){
|
||
$("#frequency-div").show();
|
||
|
||
// $("#computescore-label").hide();
|
||
// $("#computescore-div").hide();
|
||
$("#computescore").val("否");
|
||
// $("#passscore-label").hide();
|
||
// $("#passscore-div").hide();
|
||
// $("#passscore").val("");
|
||
}
|
||
}
|
||
var scorechange = function(){
|
||
if($("#computescore").val()=="否"){
|
||
$("#passscore-label").hide();
|
||
$("#passscore-div").hide();
|
||
$("#passscore").val("");
|
||
}else if($("#computescore").val()=="是"){
|
||
$("#passscore-label").show();
|
||
$("#passscore-div").show();
|
||
}
|
||
}
|
||
$(function () {
|
||
// $("#status").select2({ minimumResultsForSearch: -1 }).val("${rankType.status}").trigger("change");
|
||
// scorechange();
|
||
// $("#computescore").change(function(){
|
||
// scorechange();
|
||
// })
|
||
typechange();
|
||
|
||
$("#examtype").change(function(){
|
||
typechange();
|
||
})
|
||
|
||
$("#startdate").datetimepicker({
|
||
language:'zh-CN',
|
||
format: 'yyyy-mm-dd hh:ii',
|
||
dateFormat: 'yyyy-mm-dd',//日期显示格式
|
||
timeFormat: 'HH:mm',//时间显示格式
|
||
startView: "year", //初始化视图是‘年’
|
||
minView: 0,
|
||
maxView: "year",
|
||
minuteStep: 30,//分钟间隔1分钟
|
||
autoclose: true
|
||
}).on('changeDate', function () {
|
||
$('#editForm')
|
||
.data('bootstrapValidator')
|
||
.updateStatus('startdate', 'NOT_VALIDATED', null)
|
||
.validateField('startdate');
|
||
});
|
||
$("#enddate").datetimepicker({
|
||
language:'zh-CN',
|
||
format: 'yyyy-mm-dd hh:ii',
|
||
dateFormat: 'yyyy-mm-dd',//日期显示格式
|
||
timeFormat: 'HH:mm',//时间显示格式
|
||
startView: "year", //初始化视图是‘年’
|
||
minView: 0,
|
||
maxView: "year",
|
||
minuteStep: 30,//分钟间隔1分钟
|
||
autoclose: true
|
||
}).on('changeDate', function () {
|
||
$('#editForm')
|
||
.data('bootstrapValidator')
|
||
.updateStatus('enddate', 'NOT_VALIDATED', null)
|
||
.validateField('enddate');
|
||
});
|
||
|
||
var examPlanId=$('#id').val();
|
||
$("#table_Detail").bootstrapTable({ // 对应table标签的id
|
||
url: ext.contextPath + '/exam/examTitleRange/getExamTitleRangeList.do', // 获取表格数据的url
|
||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||
striped: true, //表格显示条纹,默认为false
|
||
pagination: true, // 在表格底部显示分页组件,默认false
|
||
pageList: [10, 20,50], // 设置页面可以显示的数据条数
|
||
pageSize: 5, // 页面数据条数
|
||
pageNumber: 1, // 首页页码
|
||
paginationDetailHAlign:' hidden',//去除分页的显示
|
||
sidePagination: 'server', // 设置为服务器端分页
|
||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||
return {
|
||
rows: params.limit, // 每页要显示的数据条数
|
||
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||
sort: params.sort, // 要排序的字段
|
||
order: params.order,
|
||
examPlanId: examPlanId
|
||
}
|
||
},
|
||
// sortName: 'ord', // 要排序的字段
|
||
// sortOrder: 'asc', // 排序规则
|
||
onClickRow: function (row) {//单击行事件,执行查看功能
|
||
//viewFun(row.id);
|
||
},
|
||
columns: [
|
||
{
|
||
checkbox: true, // 显示一个勾选框
|
||
},{
|
||
field: '_subjectTypeName', // 返回json数据中的name
|
||
title: '问卷类型', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居h中
|
||
// width: '30%'
|
||
},{
|
||
field: '_rankTypeName', // 返回json数据中的name
|
||
title: '难度等级', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
width: 110
|
||
},{
|
||
field: '_questTypeName', // 返回json数据中的name
|
||
title: '题型', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
// width: '10%'
|
||
},{
|
||
field: 'singlyscore', // 返回json数据中的name
|
||
title: '单题分值', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
// width: '10%'
|
||
},{
|
||
field: 'titlenum', // 返回json数据中的name
|
||
title: '抽题数量', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
// width: '10%'
|
||
},{
|
||
field: '_score', // 返回json数据中的name
|
||
title: '合计(分)', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
// width: '10%'
|
||
},{
|
||
title: "操作",
|
||
align: 'center',
|
||
valign: 'middle',
|
||
width: 90, // 定义列的宽度,单位为像素px
|
||
formatter: function (value, row, index) {
|
||
var buts= '';
|
||
buts+= '<button class="btn btn-default btn-sm" title="编辑" onclick="editDetailFun(\'' + row.id + '\')"><i class="fa fa-edit"></i><span class="hidden-md hidden-lg"> 编辑</span></button>';
|
||
buts+='<button class="btn btn-default btn-sm" title="删除" onclick="deleteDetailFun(\''+row.id+'\')"><i class="fa fa fa-trash-o"></i><span class="hidden-md hidden-lg">删除</span></button';
|
||
|
||
buts='<div class="btn-group" >'+buts+'</div>';
|
||
return buts;
|
||
}
|
||
}
|
||
],
|
||
onLoadSuccess: function(){ //加载成功时执行
|
||
adjustBootstrapTableView("table_Detail");
|
||
},
|
||
onLoadError: function(){ //加载失败时执行
|
||
console.info("加载数据失败");
|
||
},
|
||
//当拖拽结束后,整个表格的数据
|
||
onReorderRow: function (newData) {
|
||
//这里的newData是整个表格数据,数组形式
|
||
//console.log(newData); 调试用代码
|
||
$.post(ext.contextPath + '/exam/examTitleRange/dosort.do',
|
||
{ jsondata: JSON.stringify(newData) },//将整张表数据Post,当然,先序列化成Json
|
||
function(data) {
|
||
if (data == 1) {
|
||
$("#table").bootstrapTable('refresh');
|
||
showAlert('s','排序成功','mainAlertdiv');
|
||
}else{
|
||
showAlert('d','数据错误','mainAlertdiv');
|
||
}
|
||
});
|
||
|
||
}
|
||
|
||
|
||
});
|
||
});
|
||
</script>
|
||
<div class="modal fade" id="subModal">
|
||
<div class="modal-dialog">
|
||
<div class="modal-content" style="width: 800px">
|
||
<div class="modal-header">
|
||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||
<span aria-hidden="true">×</span></button>
|
||
<h4 class="modal-title">编辑界面</h4>
|
||
</div>
|
||
<div class="modal-body">
|
||
<!-- 新增界面formid强制为editForm -->
|
||
<form class="form-horizontal" id="editForm">
|
||
<div id="alertDiv"></div>
|
||
<input type="hidden" id="id" name="id" value="${examPlan.id}" />
|
||
<!-- 界面提醒div强制id为alertdiv -->
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*考试名称</label>
|
||
<div class="col-sm-10">
|
||
<input type="text" class="form-control" id="examname" name="examname" placeholder="考试名称" value="${examPlan.examname}" style="border-radius:4px">
|
||
</div>
|
||
</div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*考试方式</label>
|
||
<div class="col-sm-4">
|
||
<select id="exammethod" name="exammethod" class="form-control select2">
|
||
<option value="应知考试" <c:if test="${examPlan.exammethod=='应知考试'}">selected</c:if>>应知考试</option>
|
||
<option value="应会考试" <c:if test="${examPlan.exammethod=='应会考试'}">selected</c:if>>应会考试</option>
|
||
</select>
|
||
</div>
|
||
<label class="col-sm-2 control-label">*考试类型</label>
|
||
<div class="col-sm-4">
|
||
<select id="examtype" name="examtype" class="form-control select2">
|
||
<option value="正式考试" <c:if test="${examPlan.examtype=='正式考试'}">selected</c:if>>正式考试</option>
|
||
<option value="模拟考试" <c:if test="${examPlan.examtype=='模拟考试'}">selected</c:if>>模拟考试</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*考试开始时间</label>
|
||
<div class="col-sm-4">
|
||
<div class="input-group date">
|
||
<div class="input-group-addon">
|
||
<i class="fa fa-calendar"></i>
|
||
</div>
|
||
<input type="text" class="form-control" id="startdate" name="startdate" placeholder="请选择" value="${examPlan.startdate.substring(0,19)}"/>
|
||
</div>
|
||
</div>
|
||
<label class="col-sm-2 control-label">*考试结束时间</label>
|
||
<div class="col-sm-4">
|
||
<div class="input-group date">
|
||
<div class="input-group-addon">
|
||
<i class="fa fa-calendar"></i>
|
||
</div>
|
||
<input type="text" class="form-control" id="enddate" name="enddate" placeholder="请选择" value="${examPlan.enddate.substring(0,19)}"/>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label" id="computescore-label">*是否计分</label>
|
||
<div class="col-sm-4" id="computescore-div">
|
||
<select id="computescore" name="computescore" class="form-control select2">
|
||
<option value="是" <c:if test="${examPlan.computescore=='是'}">selected</c:if>>是</option>
|
||
<option value="否" <c:if test="${examPlan.computescore=='否'}">selected</c:if>>否</option>
|
||
</select>
|
||
</div>
|
||
<label class="col-sm-2 control-label" id="passscore-label">*及格分数</label>
|
||
<div class="col-sm-4" id="passscore-div">
|
||
<input type="text" class="form-control" id="passscore" name="passscore" placeholder="及格分数" value="${examPlan.passscore}" style="border-radius:4px">
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*允许考试次数</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="examnum" name="examnum" placeholder="允许考试次数" value="${examPlan.examnum}" style="border-radius:4px">
|
||
</div>
|
||
<label class="col-sm-2 control-label">*考试时长(分钟)</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="examminutes" name="examminutes" placeholder="根据时间自动计算" value="${examPlan.examminutes}" style="border-radius:4px">
|
||
<input type="hidden" class="form-control" id="_examminutes" name="_examminutes" >
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group" id="frequency-div" style="display: none;">
|
||
<label class="col-sm-2 control-label">*考试频率</label>
|
||
<div class="col-sm-6">
|
||
<select id="frequency" name="frequency" class="form-control select2">
|
||
<option value="每天" <c:if test="${examPlan.frequency=='每天'}">selected</c:if>>每天</option>
|
||
<option value="每周" <c:if test="${examPlan.frequency=='每周'}">selected</c:if>>每周</option>
|
||
<option value="每月" <c:if test="${examPlan.frequency=='每月'}">selected</c:if>>每月</option>
|
||
<!-- <option value="一次">一次</option> -->
|
||
</select>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">考试人员</label>
|
||
<div class="col-sm-10">
|
||
<textarea class="form-control" rows="2" id ="_auditMan" name ="_auditMan" placeholder="点击选择" onclick="showUser4SelectsFun();">${_auditMan}</textarea>
|
||
<input id="examuserids" name="examuserids" type="hidden" value="${examPlan.examuserids}"/>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">备注</label>
|
||
<div class="col-sm-10">
|
||
<textarea class="form-control" rows="2" id ="memo" name ="memo" placeholder="备注...">${examPlan.memo}</textarea>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
|
||
<div class="box box-primary" >
|
||
<div id="mainAlertDetaildiv"></div>
|
||
<div id="subDetailDiv"></div>
|
||
<div class="box-header with-border">
|
||
<h3 class="box-title">抽题范围</h3>
|
||
<div class="box-tools pull-right">
|
||
<a onclick="addDetailFun()" class="btn btn-box-tool" data-toggle="tooltip" title="新增"><i class="glyphicon glyphicon-plus"></i></a>
|
||
<a onclick="deletesDetailFun()" class="btn btn-box-tool" data-toggle="tooltip" title="删除"><i class="glyphicon glyphicon-minus"></i></a>
|
||
</div>
|
||
</div>
|
||
<div class="box-body ">
|
||
<table id="table_Detail" data-use-row-attr-func="true" data-reorderable-rows="true"></table>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</button>
|
||
<button type="button" class="btn btn-primary" onclick="doupdate()">保存</button>
|
||
</div>
|
||
</div>
|
||
<!-- /.modal-content -->
|
||
</div>
|
||
<!-- /.modal-dialog -->
|
||
</div> |