first commit
This commit is contained in:
123
WebRoot/jsp/teacher/fileAdd.jsp
Normal file
123
WebRoot/jsp/teacher/fileAdd.jsp
Normal file
@ -0,0 +1,123 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<script type="text/javascript">
|
||||
var filelist = new Array();
|
||||
var control;
|
||||
var allowedFileExtensions = [];
|
||||
var allowedFileTypes = [];
|
||||
var fileExtensions = '${param.fileExtensions}';
|
||||
var fileTypes = '${param.fileTypes}';
|
||||
var fileTableID = '${param.fileTableID}';
|
||||
//初始化fileinput控件(第一次初始化)
|
||||
function initFileInput(ctrlName, uploadUrl) {
|
||||
control = $('#' + ctrlName);
|
||||
control.fileinput({
|
||||
language: 'zh', //设置语言
|
||||
uploadUrl: uploadUrl, //上传的地址
|
||||
uploadAsync: true,
|
||||
allowedFileExtensions : allowedFileExtensions,//接收的文件后缀
|
||||
//allowedFileTypes : allowedFileTypes,//接收的文件类型
|
||||
showUpload: false, //是否显示上传按钮
|
||||
showRemove: false,
|
||||
showCaption: true,//是否显示标题
|
||||
showClose:false,//右上角关闭按钮
|
||||
dropZoneEnabled: false,//是否显示拖拽区域
|
||||
fileActionSettings:{
|
||||
showDrag:false
|
||||
},
|
||||
browseClass: "btn btn-primary", //按钮样式
|
||||
maxFileCount: 10, //表示允许同时上传的最大文件个数
|
||||
enctype: 'multipart/form-data',
|
||||
validateInitialCount:true,
|
||||
previewFileIcon: "<i class='fa fa-file'></i>",
|
||||
preferIconicPreview: true,//是否强制相关文件展示icon
|
||||
initialPreviewAsData: true,
|
||||
previewFileType: ['image', 'html', 'text', 'video', 'audio', 'flash', 'object','other'],
|
||||
previewFileIconSettings: {
|
||||
'doc': '<i class="fa fa-file-word-o" style="color:#3c8dbc;"></i>',
|
||||
'docx': '<i class="fa fa-file-word-o" style="color:#3c8dbc;"></i>',
|
||||
'xls': '<i class="fa fa-file-excel-o" style="color:#00a65a ;"></i>',
|
||||
|
||||
'xlsx': '<i class="fa fa-file-excel-o" style="color:#00a65a ;"></i>',
|
||||
'pptx': '<i class="fa fa-file-powerpoint-o" style="color:#f39c12; "></i>',
|
||||
'ppt': '<i class="fa fa-file-powerpoint-o" style="color:#f39c12; "></i>',
|
||||
//'jpg': '<i class="fa fa-file-image-o" style="color:#00a65a "></i>',
|
||||
'pdf': '<i class="fa fa-file-pdf-o" style="color:#dd4b39 ;"></i>',
|
||||
'zip': '<i class="fa fa-file-zip-o" ></i>',
|
||||
},
|
||||
uploadExtraData:function (previewId, index) { //传参
|
||||
var data = {
|
||||
"masterId": '${masterId}', //此处自定义传参
|
||||
"tbName": '${tbName}',
|
||||
"nameSpace": '${nameSpace}'
|
||||
};
|
||||
return data;
|
||||
},
|
||||
//设置缩略图上的按钮,为空不显示,默认显示
|
||||
layoutTemplates:{
|
||||
// actionDelete:'',
|
||||
actionUpload:''
|
||||
},
|
||||
});
|
||||
/* control.on("filebatchselected", function (event, data, previewId, index) {
|
||||
$(this).fileinput("upload");
|
||||
}); */
|
||||
//导入文件上传完成之后的事件
|
||||
control.on("fileuploaded", function (event, data, previewId, index) {
|
||||
//alert(previewId);
|
||||
if(data.response.suc) {
|
||||
closeModal('fileInputModal');
|
||||
$("#fileTable"+fileTableID).bootstrapTable('refresh');
|
||||
}
|
||||
});
|
||||
control.on('fileerror', function(event, data, msg) {
|
||||
console.log(msg);
|
||||
showAlert('d',msg,'alertFileDiv');
|
||||
});
|
||||
}
|
||||
$(function() {
|
||||
var fileExtensions = '${param.fileExtensions}';
|
||||
if(fileExtensions!= null && fileExtensions!=undefined && fileExtensions!=""){
|
||||
allowedFileExtensions = fileExtensions.split(",");
|
||||
}
|
||||
var fileTypes = '${param.fileTypes}';
|
||||
if(fileTypes!= null && fileTypes!=undefined && fileTypes!=""){
|
||||
allowedFileTypes = fileTypes.split(",");
|
||||
}
|
||||
initFileInput("filelist",ext.contextPath+ "/teacher/teacherfile/inputFile.do");
|
||||
})
|
||||
//导入上传文件的数据
|
||||
function uploadFun(){
|
||||
if($("#filelist").val() == null || $("#filelist").val()==""){
|
||||
showAlert('d','上传的文件不能为空!','alertFileDiv');
|
||||
}else{
|
||||
control.fileinput("upload");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<div class="modal fade" id="fileInputModal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<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强制为subForm -->
|
||||
<form class="form-horizontal" id="fileInputModalForm" style="padding:10px">
|
||||
<div id="alertFileDiv"></div>
|
||||
<%-- <input type="hidden" class="form-control" id ="masterId" name ="masterId" value="${masterId}"> --%>
|
||||
<div class="form-group" >
|
||||
<input type="file" name="filelist" id="filelist" multiple class="file-loading" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
<button type="button" class="btn btn-primary" onclick="uploadFun()" id="btn_upload"><i class="glyphicon glyphicon-upload"></i>上传</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
299
WebRoot/jsp/teacher/teacherFileEdit.jsp
Normal file
299
WebRoot/jsp/teacher/teacherFileEdit.jsp
Normal file
@ -0,0 +1,299 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||||
<style type="text/css">
|
||||
.select2-container .select2-selection--single{
|
||||
height:34px;
|
||||
line-height: 34px;
|
||||
}
|
||||
.select2-selection__arrow{
|
||||
margin-top:3px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
var masterId='${param.id}';
|
||||
var tbName ='tb_teacher_file'; //数据表
|
||||
var nameSpace='Document';//保存文件夹
|
||||
//编辑模态框
|
||||
var editModelFun = function (id) {
|
||||
$.post(ext.contextPath + '/teacher/teacherfile/doedit.do', {id : id}, function (data) {
|
||||
$("#editDiv").html(data);
|
||||
openModal('editModel');
|
||||
});
|
||||
};
|
||||
//上传文件
|
||||
var fileinput = function() {
|
||||
$.post(ext.contextPath + '/teacher/teacherfile/fileinput.do', {masterId:masterId,tbName:tbName,nameSpace:nameSpace} , function(data) {
|
||||
$("#fileInputDiv").html(data);
|
||||
openModal('fileInputModal');
|
||||
});
|
||||
};
|
||||
//下载文件
|
||||
var fileDownload = function(id) {
|
||||
window.open(ext.contextPath + "/base/downloadFile.do?key="+id+"&tbName="+tbName,"_self");
|
||||
// $.post(ext.contextPath + '/base/downloadFile.do', {key:id,tbName:tbName} , function(data) {
|
||||
|
||||
// });
|
||||
};
|
||||
|
||||
var delFileFun = function(id) {
|
||||
stopBubbleDefaultEvent();
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
dangerMode: true,
|
||||
buttons: {
|
||||
cancel: {
|
||||
text: "取消",
|
||||
value: null,
|
||||
visible: true,
|
||||
className: "btn btn-default btn-sm",
|
||||
closeModal: true,
|
||||
},
|
||||
confirm: {
|
||||
text: "确定",
|
||||
value: true,
|
||||
visible: true,
|
||||
className: "btn btn-danger btn-sm",
|
||||
closeModal: true
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(function(willDelete){
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/teacher/teacherfile/dodeleteFile.do', {id : id,tbName:tbName}, function(data) {
|
||||
if(data == 1){
|
||||
$("#fileTable").bootstrapTable('refresh');
|
||||
}else{
|
||||
showAlert('d','删除失败','mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
$(function() {
|
||||
$("#fileTable").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/teacher/teacherfile/getFileList.do', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [5,10,15], // 设置页面可以显示的数据条数
|
||||
pageSize: 5, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order, // 排序规则
|
||||
masterId: masterId,
|
||||
tbName : tbName
|
||||
}
|
||||
},
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
columns: [
|
||||
{
|
||||
field: 'filename', // 返回json数据中的name
|
||||
title: '名称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}, {
|
||||
field: 'filefolder', // 返回json数据中的name
|
||||
title: '归属文件夹', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',// 上下居中
|
||||
// formatter:function(value,row,index){
|
||||
// return '<a onclick="fileDownload(\'' + row.id + '\')">'+value+'</a>'
|
||||
// }
|
||||
}, {
|
||||
field: 'type', // 返回json数据中的name
|
||||
title: '类型', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',// 上下居中
|
||||
}, {
|
||||
field: 'size', // 返回json数据中的name
|
||||
title: '大小', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',// 上下居中
|
||||
formatter: function (value, row, index) {
|
||||
// console.log(typeof value);
|
||||
// console.log(value);
|
||||
// if(value<1073741825){
|
||||
// console.log('right');
|
||||
// return 1000000;
|
||||
// }
|
||||
if(value<1024){
|
||||
return value.toFixed(2)+"B";
|
||||
}else if(1024<=value&&value<1048576){
|
||||
return (value/1024).toFixed(2)+"K";
|
||||
}else if(1048576<=value&&value<1073741824){
|
||||
return (value/1048576).toFixed(2)+"M";
|
||||
}
|
||||
}
|
||||
}, {
|
||||
// field: '大小', // 返回json数据中的name
|
||||
// title: '上传者', // 表格表头显示文字
|
||||
// align: 'center', // 左右居中
|
||||
// valign: 'middle',// 上下居中
|
||||
// }, {
|
||||
// field: 'insdt', // 返回json数据中的name
|
||||
// title: '上传时间', // 表格表头显示文字
|
||||
// align: 'center', // 左右居中
|
||||
// valign: 'middle', // 上下居中
|
||||
// }, {
|
||||
field: 'memo', // 返回json数据中的name
|
||||
title: '摘要', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
}, {
|
||||
title: "操作",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: 200, // 定义列的宽度,单位为像素px
|
||||
formatter: function (value, row, index) {
|
||||
var buts= '';
|
||||
buts+='<button class="btn btn-default btn-sm" title="下载" onclick="fileDownload(\'' + row.id + '\')"><i class="fa fa-download"></i><span class="hidden-md hidden-lg">下载</span></button>';
|
||||
buts+='<button class="btn btn-default btn-sm" title="编辑" onclick="editModelFun(\'' + 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="delFileFun(\''+row.id+'\')"><i class="fa fa-trash-o"></i><span class="hidden-md hidden-lg">删除</span></button>';
|
||||
buts='<div class="btn-group" >'+buts+'</div>';
|
||||
return buts;
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function(){ //加载成功时执行
|
||||
//$(".bs-checkbox").css({'text-align':'center','vertical-align':'middle'})
|
||||
adjustBootstrapTableView("fileTable");
|
||||
},
|
||||
onLoadError: function(){ //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
$(function() {
|
||||
$("#parentTable").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/teacher/teacherfile/getparentFileList.do', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [5,10,15], // 设置页面可以显示的数据条数
|
||||
pageSize: 5, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order, // 排序规则
|
||||
masterId: masterId,
|
||||
tbName : tbName
|
||||
}
|
||||
},
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
columns: [
|
||||
{
|
||||
field: 'filename', // 返回json数据中的name
|
||||
title: '名称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}, {
|
||||
field: 'filefolder', // 返回json数据中的name
|
||||
title: '归属文件夹', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',// 上下居中
|
||||
// formatter:function(value,row,index){
|
||||
// return '<a onclick="fileDownload(\'' + row.id + '\')">'+value+'</a>'
|
||||
// }
|
||||
}, {
|
||||
field: 'type', // 返回json数据中的name
|
||||
title: '类型', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',// 上下居中
|
||||
}, {
|
||||
field: 'size', // 返回json数据中的name
|
||||
title: '大小', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',// 上下居中
|
||||
formatter: function (value, row, index) {
|
||||
// console.log(typeof value);
|
||||
// console.log(value);
|
||||
// if(value<1073741825){
|
||||
// console.log('right');
|
||||
// return 1000000;
|
||||
// }
|
||||
if(value<1024){
|
||||
return value.toFixed(2)+"B";
|
||||
}else if(1024<=value&&value<1048576){
|
||||
return (value/1024).toFixed(2)+"K";
|
||||
}else if(1048576<=value&&value<1073741824){
|
||||
return (value/1048576).toFixed(2)+"M";
|
||||
}
|
||||
}
|
||||
}, {
|
||||
// field: '大小', // 返回json数据中的name
|
||||
// title: '上传者', // 表格表头显示文字
|
||||
// align: 'center', // 左右居中
|
||||
// valign: 'middle',// 上下居中
|
||||
// }, {
|
||||
// field: 'insdt', // 返回json数据中的name
|
||||
// title: '上传时间', // 表格表头显示文字
|
||||
// align: 'center', // 左右居中
|
||||
// valign: 'middle', // 上下居中
|
||||
// }, {
|
||||
field: 'memo', // 返回json数据中的name
|
||||
title: '摘要', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
}, {
|
||||
title: "操作",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: 200, // 定义列的宽度,单位为像素px
|
||||
formatter: function (value, row, index) {
|
||||
var buts= '';
|
||||
buts+='<button class="btn btn-default btn-sm" title="下载" onclick="fileDownload(\'' + row.id + '\')"><i class="fa fa-download"></i><span class="hidden-md hidden-lg">下载</span></button>';
|
||||
buts+='<button class="btn btn-default btn-sm" title="编辑" onclick="editModelFun(\'' + 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="delFileFun(\''+row.id+'\')"><i class="fa fa-trash-o"></i><span class="hidden-md hidden-lg">删除</span></button>';
|
||||
buts='<div class="btn-group" >'+buts+'</div>';
|
||||
return buts;
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function(){ //加载成功时执行
|
||||
//$(".bs-checkbox").css({'text-align':'center','vertical-align':'middle'})
|
||||
adjustBootstrapTableView("fileTable");
|
||||
},
|
||||
onLoadError: function(){ //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="box box-solid" >
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">课件资料</h3>
|
||||
<div class="box-tools pull-right">
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body ">
|
||||
<div >
|
||||
<div class="btn-group" style="width: 220px;padding-bottom:10px;">
|
||||
<c:if test="${lastnode=='yes'}">
|
||||
<button type="button" class="btn btn-default" onclick="fileinput();"><i class="fa fa-plus"></i>上传文件</button>
|
||||
</c:if>
|
||||
<!-- <button type="button" class="btn btn-default" onclick="delDocFun();"><i class="fa fa-trash"></i> 删除</button> -->
|
||||
</div>
|
||||
<c:if test="${lastnode=='yes'}">
|
||||
<table id="fileTable"></table>
|
||||
</c:if>
|
||||
<c:if test="${lastnode=='no'}">
|
||||
<table id="parentTable"></table>
|
||||
</c:if>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
68
WebRoot/jsp/teacher/teacherFileEditModel.jsp
Normal file
68
WebRoot/jsp/teacher/teacherFileEditModel.jsp
Normal file
@ -0,0 +1,68 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||||
<style type="text/css">
|
||||
.select2-container .select2-selection--single{
|
||||
height:34px;
|
||||
line-height: 34px;
|
||||
}
|
||||
.select2-selection__arrow{
|
||||
margin-top:3px;
|
||||
}
|
||||
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
|
||||
function doupdate() {
|
||||
// alert("${teacherFile.id}")
|
||||
$.post(ext.contextPath + '/teacher/teacherfile/doupdate.do', $("#subForm").serialize(), function(result) {
|
||||
if (result == 1) {
|
||||
editFun(masterId);
|
||||
closeModal('editModel');
|
||||
}else if(result == null){
|
||||
showAlert('d','保存失败');
|
||||
}else{
|
||||
showAlert('d',result);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(function() {
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="modal fade" id="editModel">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<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">
|
||||
<form class="form-horizontal " id="subForm">
|
||||
<!-- 界面提醒div强制id为alertDiv -->
|
||||
<div id="alertDiv"></div>
|
||||
<div class="form-group">
|
||||
<input type="hidden" class="form-control" id="id" name ="id" value="${teacherFile.id}">
|
||||
<label class="col-sm-2 control-label">名称</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="filename" name ="filename" placeholder="名称" value="${teacherFile.filename }">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">备注</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea class="form-control " id="memo" name="memo" rows="2">${teacherFile.memo}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a onclick="doupdate()" class="btn btn-default" data-toggle="tooltip" title="保存">保存</a>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
305
WebRoot/jsp/teacher/teacherFileEditview.jsp
Normal file
305
WebRoot/jsp/teacher/teacherFileEditview.jsp
Normal file
@ -0,0 +1,305 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||||
<style type="text/css">
|
||||
.select2-container .select2-selection--single{
|
||||
height:34px;
|
||||
line-height: 34px;
|
||||
}
|
||||
.select2-selection__arrow{
|
||||
margin-top:3px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
var masterId='${param.id}';
|
||||
var tbName ='tb_teacher_file'; //数据表
|
||||
var nameSpace='Document';//保存文件夹
|
||||
//编辑模态框
|
||||
var editModelFun = function (id) {
|
||||
$.post(ext.contextPath + '/teacher/teacherfile/doedit.do', {id : id}, function (data) {
|
||||
$("#editDiv").html(data);
|
||||
openModal('editModel');
|
||||
});
|
||||
};
|
||||
//上传文件
|
||||
var fileinput = function() {
|
||||
$.post(ext.contextPath + '/teacher/teacherfile/fileinput.do', {masterId:masterId,tbName:tbName,nameSpace:nameSpace} , function(data) {
|
||||
$("#fileInputDiv").html(data);
|
||||
openModal('fileInputModal');
|
||||
});
|
||||
};
|
||||
//下载文件
|
||||
var fileDownload = function(id) {
|
||||
window.open(ext.contextPath + "/base/downloadFile.do?key="+id+"&tbName="+tbName,"_self");
|
||||
// $.post(ext.contextPath + '/base/downloadFile.do', {key:id,tbName:tbName} , function(data) {
|
||||
|
||||
// });
|
||||
};
|
||||
|
||||
//浏览 暂时浏览图片
|
||||
var viewFun = function(urlpath,id){
|
||||
$.post(ext.contextPath + '/teacher/teacherfile/doview.do', {urlpath:urlpath,id} , function(data) {
|
||||
$("#subDiv").html(data);
|
||||
openModal('subModal');
|
||||
});
|
||||
}
|
||||
|
||||
var delFileFun = function(id) {
|
||||
stopBubbleDefaultEvent();
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
dangerMode: true,
|
||||
buttons: {
|
||||
cancel: {
|
||||
text: "取消",
|
||||
value: null,
|
||||
visible: true,
|
||||
className: "btn btn-default btn-sm",
|
||||
closeModal: true,
|
||||
},
|
||||
confirm: {
|
||||
text: "确定",
|
||||
value: true,
|
||||
visible: true,
|
||||
className: "btn btn-danger btn-sm",
|
||||
closeModal: true
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(function(willDelete){
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/teacher/teacherfile/dodeleteFile.do', {id : id,tbName:tbName}, function(data) {
|
||||
if(data == 1){
|
||||
$("#fileTable").bootstrapTable('refresh');
|
||||
}else{
|
||||
showAlert('d','删除失败','mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
$(function() {
|
||||
$("#fileTable").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/teacher/teacherfile/getFileList.do', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [8,10,15], // 设置页面可以显示的数据条数
|
||||
pageSize: 8, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order, // 排序规则
|
||||
masterId: masterId,
|
||||
tbName : tbName
|
||||
}
|
||||
},
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
columns: [
|
||||
{
|
||||
field: 'filename', // 返回json数据中的name
|
||||
title: '名称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}, {
|
||||
field: 'filefolder', // 返回json数据中的name
|
||||
title: '归属文件夹', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',// 上下居中
|
||||
// formatter:function(value,row,index){
|
||||
// return '<a onclick="fileDownload(\'' + row.id + '\')">'+value+'</a>'
|
||||
// }
|
||||
}, {
|
||||
field: 'type', // 返回json数据中的name
|
||||
title: '类型', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',// 上下居中
|
||||
}, {
|
||||
field: 'size', // 返回json数据中的name
|
||||
title: '大小', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',// 上下居中
|
||||
formatter: function (value, row, index) {
|
||||
// console.log(typeof value);
|
||||
// console.log(value);
|
||||
// if(value<1073741825){
|
||||
// console.log('right');
|
||||
// return 1000000;
|
||||
// }
|
||||
if(value<1024){
|
||||
return value.toFixed(2)+"B";
|
||||
}else if(1024<=value&&value<1048576){
|
||||
return (value/1024).toFixed(2)+"K";
|
||||
}else if(1048576<=value&&value<1073741824){
|
||||
return (value/1048576).toFixed(2)+"M";
|
||||
}
|
||||
}
|
||||
}, {
|
||||
// field: '大小', // 返回json数据中的name
|
||||
// title: '上传者', // 表格表头显示文字
|
||||
// align: 'center', // 左右居中
|
||||
// valign: 'middle',// 上下居中
|
||||
// }, {
|
||||
// field: 'insdt', // 返回json数据中的name
|
||||
// title: '上传时间', // 表格表头显示文字
|
||||
// align: 'center', // 左右居中
|
||||
// valign: 'middle', // 上下居中
|
||||
// }, {
|
||||
field: 'memo', // 返回json数据中的name
|
||||
title: '摘要', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
}, {
|
||||
title: "操作",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: 200, // 定义列的宽度,单位为像素px
|
||||
formatter: function (value, row, index) {
|
||||
var buts= '';
|
||||
buts+='<button class="btn btn-default btn-sm" title="下载" onclick="fileDownload(\'' + row.id + '\')"><i class="fa fa-download"></i><span class="hidden-md hidden-lg">下载</span></button>';
|
||||
buts+='<button class="btn btn-default btn-sm" title="浏览" onclick="viewFun(\'' + row.urlpath + '\',\'' + row.id + '\')"><i class="fa fa-eye"></i><span class="hidden-md hidden-lg">浏览</span></button>';
|
||||
buts='<div class="btn-group" >'+buts+'</div>';
|
||||
return buts;
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function(){ //加载成功时执行
|
||||
//$(".bs-checkbox").css({'text-align':'center','vertical-align':'middle'})
|
||||
adjustBootstrapTableView("fileTable");
|
||||
},
|
||||
onLoadError: function(){ //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
$(function() {
|
||||
$("#parentTable").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/teacher/teacherfile/getparentFileList.do', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [5,10,15], // 设置页面可以显示的数据条数
|
||||
pageSize: 5, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset/params.limit+1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order, // 排序规则
|
||||
masterId: masterId,
|
||||
tbName : tbName
|
||||
}
|
||||
},
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
columns: [
|
||||
{
|
||||
field: 'filename', // 返回json数据中的name
|
||||
title: '名称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}, {
|
||||
field: 'filefolder', // 返回json数据中的name
|
||||
title: '归属文件夹', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',// 上下居中
|
||||
// formatter:function(value,row,index){
|
||||
// return '<a onclick="fileDownload(\'' + row.id + '\')">'+value+'</a>'
|
||||
// }
|
||||
}, {
|
||||
field: 'type', // 返回json数据中的name
|
||||
title: '类型', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',// 上下居中
|
||||
}, {
|
||||
field: 'size', // 返回json数据中的name
|
||||
title: '大小', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle',// 上下居中
|
||||
formatter: function (value, row, index) {
|
||||
// console.log(typeof value);
|
||||
// console.log(value);
|
||||
// if(value<1073741825){
|
||||
// console.log('right');
|
||||
// return 1000000;
|
||||
// }
|
||||
if(value<1024){
|
||||
return value.toFixed(2)+"B";
|
||||
}else if(1024<=value&&value<1048576){
|
||||
return (value/1024).toFixed(2)+"K";
|
||||
}else if(1048576<=value&&value<1073741824){
|
||||
return (value/1048576).toFixed(2)+"M";
|
||||
}
|
||||
}
|
||||
}, {
|
||||
// field: '大小', // 返回json数据中的name
|
||||
// title: '上传者', // 表格表头显示文字
|
||||
// align: 'center', // 左右居中
|
||||
// valign: 'middle',// 上下居中
|
||||
// }, {
|
||||
// field: 'insdt', // 返回json数据中的name
|
||||
// title: '上传时间', // 表格表头显示文字
|
||||
// align: 'center', // 左右居中
|
||||
// valign: 'middle', // 上下居中
|
||||
// }, {
|
||||
field: 'memo', // 返回json数据中的name
|
||||
title: '摘要', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
}, {
|
||||
title: "操作",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: 200, // 定义列的宽度,单位为像素px
|
||||
formatter: function (value, row, index) {
|
||||
var buts= '';
|
||||
buts+='<button class="btn btn-default btn-sm" title="下载" onclick="fileDownload(\'' + row.id + '\')"><i class="fa fa-download"></i><span class="hidden-md hidden-lg">下载</span></button>';
|
||||
buts+='<button class="btn btn-default btn-sm" title="浏览" onclick="viewFun(\'' + row.urlpath + '\',\'' + row.masterid + '\')"><i class="fa fa-eye"></i><span class="hidden-md hidden-lg">浏览</span></button>';
|
||||
buts='<div class="btn-group" >'+buts+'</div>';
|
||||
return buts;
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function(){ //加载成功时执行
|
||||
//$(".bs-checkbox").css({'text-align':'center','vertical-align':'middle'})
|
||||
adjustBootstrapTableView("fileTable");
|
||||
},
|
||||
onLoadError: function(){ //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="box box-solid" >
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">课件资料</h3>
|
||||
<div class="box-tools pull-right">
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body ">
|
||||
<div >
|
||||
<div class="btn-group" style="width: 220px;padding-bottom:10px;">
|
||||
<c:if test="${lastnode=='yes'}">
|
||||
<!-- <button type="button" class="btn btn-default" onclick="fileinput();"><i class="fa fa-plus"></i>上传文件</button> -->
|
||||
</c:if>
|
||||
<!-- <button type="button" class="btn btn-default" onclick="delDocFun();"><i class="fa fa-trash"></i> 删除</button> -->
|
||||
</div>
|
||||
<c:if test="${lastnode=='yes'}">
|
||||
<table id="fileTable"></table>
|
||||
</c:if>
|
||||
<c:if test="${lastnode=='no'}">
|
||||
<table id="parentTable"></table>
|
||||
</c:if>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
153
WebRoot/jsp/teacher/teacherFileManage.jsp
Normal file
153
WebRoot/jsp/teacher/teacherFileManage.jsp
Normal file
@ -0,0 +1,153 @@
|
||||
<%@ page language="java" 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"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
|
||||
<%@ page import="com.sipai.entity.base.ServerObject"%>
|
||||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
|
||||
<!DOCTYPE html>
|
||||
<!-- <html lang="zh-CN"> -->
|
||||
<!-- BEGIN HEAD -->
|
||||
<head>
|
||||
<title><%= ServerObject.atttable.get("TOPTITLE")%></title>
|
||||
<!-- 引用页头及CSS页-->
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
<!-- 文件上传-->
|
||||
<link rel="stylesheet" href="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/css/fileinput.min.css"/>
|
||||
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/fileinput.min.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/locales/zh.js" charset="utf-8"></script>
|
||||
<script type="text/javascript">
|
||||
var editFun = function(id) {
|
||||
$.post(ext.contextPath + '/teacher/teacherfile/doeditTeacherFile.do', {id:id} , function(data) {
|
||||
$("#teachertypeBox").html(data);
|
||||
});
|
||||
};
|
||||
var deleteFun = function(id) {
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
dangerMode: true,
|
||||
buttons: {
|
||||
cancel: {
|
||||
text: "取消",
|
||||
value: null,
|
||||
visible: true,
|
||||
className: "btn btn-default btn-sm",
|
||||
closeModal: true,
|
||||
},
|
||||
confirm: {
|
||||
text: "确定",
|
||||
value: true,
|
||||
visible: true,
|
||||
className: "btn btn-danger btn-sm",
|
||||
closeModal: true
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(function(willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/work/group/delete.do', {id : id}, function(data) {
|
||||
if(data==1){
|
||||
$("#table").bootstrapTable('refresh');
|
||||
}else{
|
||||
showAlert('d','删除失败','mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
var deletesFun = function() {
|
||||
var checkedItems = $("#table").bootstrapTable('getSelections');
|
||||
var datas="";
|
||||
$.each(checkedItems, function(index, item){
|
||||
datas+=item.id+",";
|
||||
});
|
||||
if(datas==""){
|
||||
showAlert('d','请先选择记录','mainAlertdiv');
|
||||
}else{
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
dangerMode: true,
|
||||
buttons: {
|
||||
cancel: {
|
||||
text: "取消",
|
||||
value: null,
|
||||
visible: true,
|
||||
className: "btn btn-default btn-sm",
|
||||
closeModal: true,
|
||||
},
|
||||
confirm: {
|
||||
text: "确定",
|
||||
value: true,
|
||||
visible: true,
|
||||
className: "btn btn-danger btn-sm",
|
||||
closeModal: true
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(function(willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/work/group/deletes.do', {ids:datas} , function(data) {
|
||||
if(data>0){
|
||||
$("#table").bootstrapTable('refresh');
|
||||
}else{
|
||||
showAlert('d','删除失败','mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
var initTreeView = function() {
|
||||
$.post(ext.contextPath + '/teacher/teachertype/getTeachertypesJson.do', {ng:''} , function(data) {
|
||||
//console.info(data)
|
||||
$('#tree').treeview({data: data,
|
||||
});
|
||||
$('#tree').on('nodeSelected', function(event, data) {
|
||||
editFun(data.id);
|
||||
//var node=$('#tree').treeview('getSelected');
|
||||
});
|
||||
},'json');
|
||||
$("#teachertypeBox").html("");
|
||||
};
|
||||
$(function() {
|
||||
initTreeView();
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body class="hold-transition ${cu.themeclass} sidebar-mini">
|
||||
<div class="wrapper">
|
||||
<div class="content-wrapper">
|
||||
<!-- Main content -->
|
||||
<section class="content container-fluid">
|
||||
<div id="mainAlertdiv"></div>
|
||||
<div id="subDiv"></div>
|
||||
<div id="fileInputDiv"></div>
|
||||
<div id="editDiv"></div>
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="box box-solid">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">课件类型列表</h3>
|
||||
<div class="box-tools">
|
||||
<!-- <button type="button" class="btn btn-box-tool" onclick="addFun();"><i class="fa fa-plus"></i>
|
||||
</button> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
<div id="tree" style="height:550px;overflow:auto; "></div>
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-9" id="teachertypeBox"></div>
|
||||
</div>
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
153
WebRoot/jsp/teacher/teacherFileManageview.jsp
Normal file
153
WebRoot/jsp/teacher/teacherFileManageview.jsp
Normal file
@ -0,0 +1,153 @@
|
||||
<%@ page language="java" 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"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
|
||||
<%@ page import="com.sipai.entity.base.ServerObject"%>
|
||||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
|
||||
<!DOCTYPE html>
|
||||
<!-- <html lang="zh-CN"> -->
|
||||
<!-- BEGIN HEAD -->
|
||||
<head>
|
||||
<title><%= ServerObject.atttable.get("TOPTITLE")%></title>
|
||||
<!-- 引用页头及CSS页-->
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
<!-- 文件上传-->
|
||||
<link rel="stylesheet" href="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/css/fileinput.min.css"/>
|
||||
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/fileinput.min.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/locales/zh.js" charset="utf-8"></script>
|
||||
<script type="text/javascript">
|
||||
var editFun = function(id) {
|
||||
$.post(ext.contextPath + '/teacher/teacherfile/doeditTeacherFileview.do', {id:id} , function(data) {
|
||||
$("#teachertypeBox").html(data);
|
||||
});
|
||||
};
|
||||
var deleteFun = function(id) {
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
dangerMode: true,
|
||||
buttons: {
|
||||
cancel: {
|
||||
text: "取消",
|
||||
value: null,
|
||||
visible: true,
|
||||
className: "btn btn-default btn-sm",
|
||||
closeModal: true,
|
||||
},
|
||||
confirm: {
|
||||
text: "确定",
|
||||
value: true,
|
||||
visible: true,
|
||||
className: "btn btn-danger btn-sm",
|
||||
closeModal: true
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(function(willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/work/group/delete.do', {id : id}, function(data) {
|
||||
if(data==1){
|
||||
$("#table").bootstrapTable('refresh');
|
||||
}else{
|
||||
showAlert('d','删除失败','mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
var deletesFun = function() {
|
||||
var checkedItems = $("#table").bootstrapTable('getSelections');
|
||||
var datas="";
|
||||
$.each(checkedItems, function(index, item){
|
||||
datas+=item.id+",";
|
||||
});
|
||||
if(datas==""){
|
||||
showAlert('d','请先选择记录','mainAlertdiv');
|
||||
}else{
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
dangerMode: true,
|
||||
buttons: {
|
||||
cancel: {
|
||||
text: "取消",
|
||||
value: null,
|
||||
visible: true,
|
||||
className: "btn btn-default btn-sm",
|
||||
closeModal: true,
|
||||
},
|
||||
confirm: {
|
||||
text: "确定",
|
||||
value: true,
|
||||
visible: true,
|
||||
className: "btn btn-danger btn-sm",
|
||||
closeModal: true
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(function(willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/work/group/deletes.do', {ids:datas} , function(data) {
|
||||
if(data>0){
|
||||
$("#table").bootstrapTable('refresh');
|
||||
}else{
|
||||
showAlert('d','删除失败','mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
var initTreeView = function() {
|
||||
$.post(ext.contextPath + '/teacher/teachertype/getTeachertypesJson.do', {ng:''} , function(data) {
|
||||
//console.info(data)
|
||||
$('#tree').treeview({data: data,
|
||||
});
|
||||
$('#tree').on('nodeSelected', function(event, data) {
|
||||
editFun(data.id);
|
||||
//var node=$('#tree').treeview('getSelected');
|
||||
});
|
||||
},'json');
|
||||
$("#teachertypeBox").html("");
|
||||
};
|
||||
$(function() {
|
||||
initTreeView();
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body class="hold-transition ${cu.themeclass} sidebar-mini">
|
||||
<div class="wrapper">
|
||||
<div class="content-wrapper">
|
||||
<!-- Main content -->
|
||||
<section class="content container-fluid">
|
||||
<div id="mainAlertdiv"></div>
|
||||
<div id="subDiv"></div>
|
||||
<div id="fileInputDiv"></div>
|
||||
<div id="editDiv"></div>
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<div class="box box-solid">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">课件类型列表</h3>
|
||||
<div class="box-tools">
|
||||
<!-- <button type="button" class="btn btn-box-tool" onclick="addFun();"><i class="fa fa-plus"></i>
|
||||
</button> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
<div id="tree" style="height:550px;overflow:auto; "></div>
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-10" id="teachertypeBox"></div>
|
||||
</div>
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
43
WebRoot/jsp/teacher/teachertype4select.jsp
Normal file
43
WebRoot/jsp/teacher/teachertype4select.jsp
Normal file
@ -0,0 +1,43 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<script type="text/javascript">
|
||||
var selectMenu = function() {
|
||||
|
||||
alert('${param.hiddenId}'+'${param.textId}');
|
||||
}
|
||||
$(function() {
|
||||
$.post(ext.contextPath + '/teacher/teachertype/getTeachertypesJson.do', {ng:''} , function(data) {
|
||||
console.info(data);
|
||||
if(data.length>0){
|
||||
$('#menu_select_tree').treeview({
|
||||
data: data,
|
||||
});
|
||||
$('#menu_select_tree').on('nodeSelected', function(event, data) {
|
||||
$('#${param.formId} #${param.hiddenId}').val(data.id);
|
||||
$('#${param.formId} #${param.textId}').val(data.text);
|
||||
closeModal("teachertype4SelectModel")
|
||||
});
|
||||
}
|
||||
},'json');
|
||||
|
||||
});
|
||||
</script>
|
||||
<div class="modal fade" id="teachertype4SelectModel">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<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">
|
||||
<div id="menu_select_tree" style="height:430px;overflow:auto;width:100%"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
<!-- <button type="button" class="btn btn-primary" onclick="selectMenu()">保存</button> -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
163
WebRoot/jsp/teacher/teachertypeAdd.jsp
Normal file
163
WebRoot/jsp/teacher/teachertypeAdd.jsp
Normal file
@ -0,0 +1,163 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<style type="text/css">
|
||||
.select2-container .select2-selection--single {
|
||||
height: 34px;
|
||||
line-height: 34px;
|
||||
}
|
||||
|
||||
.select2-selection__arrow {
|
||||
margin-top: 3px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
var showTeachertype4SelectFun = function () {
|
||||
$.post(ext.contextPath + '/teacher/teachertype/showTeachertype4Select.do', { formId: "subForm", hiddenId: "pid", textId: "_pname" }, function (data) {
|
||||
$("#teachertype4SelectDiv").html(data);
|
||||
openModal('teachertype4SelectModel');
|
||||
});
|
||||
};
|
||||
function dosave() {
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/teacher/teachertype/saveTeachertype.do", $("#subForm").serialize(), function (result) {
|
||||
if (result == 1) {
|
||||
initTreeView();
|
||||
//showAlert('s','保存成功');
|
||||
} else {
|
||||
showAlert('d', '保存失败');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$("#subForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '名称不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
state: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '状态不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
ord: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '顺序不能为空'
|
||||
},
|
||||
regexp: {
|
||||
regexp: /^[0-9]*$/,
|
||||
message: '顺序必须为数字'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
// function saveDefault() {
|
||||
// if($("#location").val()==''){
|
||||
// top.$.messager.alert('提示','请先填写菜单地址','info');
|
||||
// }else{
|
||||
// if ($(".form").form('validate')) {
|
||||
// $.post(ext.contextPath + "/user/saveDefaultFunc.do", $(".form").serialize(), function(result) {
|
||||
// if (result > 0) {
|
||||
// top.$.messager.alert('提示', "保存成功", 'info', function() {
|
||||
// $('#grid').datagrid('reload');
|
||||
// });
|
||||
// } else {
|
||||
// top.$.messager.alert('提示', "保存失败", 'info');
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// function dodel() {
|
||||
// top.$.messager.confirm('提示', '确定删除此菜单?', function(r) {
|
||||
// if (r) {
|
||||
// $.post(ext.contextPath + "/user/deleteMenu.do", $(".form").serialize(), function(result) {
|
||||
// if (result.res > 0) {
|
||||
// top.$.messager.alert('提示', "删除成功", 'info', function() {
|
||||
// //刷新树
|
||||
// parent.reloadTree();
|
||||
// parent.$("#mainFrame").attr("src",ext.contextPath+"/user/showMenuAdd.do?pid="+$("#pid").val());
|
||||
// });
|
||||
// } else {
|
||||
// top.$.messager.alert('提示', result.msg, 'info');
|
||||
// }
|
||||
// },'json');
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
$(function () {
|
||||
//var active=$("#active").select2();
|
||||
$("#state").select2({ minimumResultsForSearch: -1 }).val("${teachertype.state}").trigger("change");
|
||||
});
|
||||
</script>
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">新增</h3>
|
||||
|
||||
<div class="box-tools pull-right">
|
||||
<a onclick="dosave()" class="btn btn-box-tool" data-toggle="tooltip" title="保存"><i
|
||||
class="glyphicon glyphicon-floppy-disk"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body ">
|
||||
<form class="form-horizontal " id="subForm">
|
||||
<input id="id" name="id" type="hidden" value="${teachertype.id}" />
|
||||
<!-- 界面提醒div强制id为alertDiv -->
|
||||
<div id="alertDiv"></div>
|
||||
<div id="teachertype4SelectDiv"></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="name" name="name" placeholder="名称"
|
||||
value="${teachertype.name }">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">上级菜单</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="_pname" name="_pname" placeholder="上级菜单"
|
||||
onclick="showTeachertype4SelectFun();" value="${pname}">
|
||||
<input id="pid" name="pid" type="hidden" value="${param.pid}" />
|
||||
</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="ord" name="ord" placeholder="顺序"
|
||||
value="${teachertype.ord}">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">启用</label>
|
||||
<div class="col-sm-4">
|
||||
<select id="state" name="state" class="form-control select2">
|
||||
<option value="启用" selected>启用</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 " id="memo" name="memo" rows="2">${teachertype.memo}</textarea>
|
||||
<!-- <input type="textarea" class="form-control" id="memo" name="memo" placeholder="课件摘要"
|
||||
value="${teachertype.memo}"> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
321
WebRoot/jsp/teacher/teachertypeEdit.jsp
Normal file
321
WebRoot/jsp/teacher/teachertypeEdit.jsp
Normal file
@ -0,0 +1,321 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||||
<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">
|
||||
var showTeachertype4SelectFun = function () {
|
||||
$.post(ext.contextPath + '/teacher/showTeachertype4Select.do', { formId: "subForm", hiddenId: "pid", textId: "_pname" }, function (data) {
|
||||
$("#teachertype4SelectDiv").html(data);
|
||||
openModal("teachertype4SelectModel")
|
||||
});
|
||||
};
|
||||
function dosave() {
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/teacher/teachertype/updateTeachertype.do", $("#subForm").serialize(), function (result) {
|
||||
if (result == 1) {
|
||||
showAlert('s', '保存成功');
|
||||
initTreeView();
|
||||
} else {
|
||||
showAlert('d', '保存失败');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$("#subForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
name: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '名称不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
// _pname: {
|
||||
// validators: {
|
||||
// notEmpty: {
|
||||
// message: '上级菜单不能为空'
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
ord: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '顺序不能为空'
|
||||
},
|
||||
regexp: {
|
||||
regexp: /^[0-9]*$/,
|
||||
message: '顺序必须为数字'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// function saveDefault() {
|
||||
// if ($("#location").val() == '') {
|
||||
// showAlert('i', '请先填写菜单地址')
|
||||
// } else {
|
||||
// //if ($(".form").form('validate')) {
|
||||
// $.post(ext.contextPath + "/user/saveDefaultFunc.do", $("#subForm").serialize(), function (result) {
|
||||
// if (result > 0) {
|
||||
// $("#table").bootstrapTable('refresh');
|
||||
// } else {
|
||||
// showAlert('d', '默认权限添加失败', 'alertDiv_power');
|
||||
// }
|
||||
// });
|
||||
// //}
|
||||
// }
|
||||
// }
|
||||
|
||||
function dodel() {
|
||||
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
dangerMode: true,
|
||||
buttons: {
|
||||
cancel: {
|
||||
text: "取消",
|
||||
value: null,
|
||||
visible: true,
|
||||
className: "btn btn-default btn-sm",
|
||||
closeModal: true,
|
||||
},
|
||||
confirm: {
|
||||
text: "确定",
|
||||
value: true,
|
||||
visible: true,
|
||||
className: "btn btn-danger btn-sm",
|
||||
closeModal: true
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(function (willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/teacher/teachertype/deleteTeachertype.do', $("#subForm").serialize(), function (data) {
|
||||
if (data.res > 0) {
|
||||
initTreeView();
|
||||
} else {
|
||||
showAlert('d', '删除失败');
|
||||
}
|
||||
}, 'json');
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
// function delPowerFun(id) {
|
||||
|
||||
// swal({
|
||||
// text: "您确定要删除此记录?",
|
||||
// dangerMode: true,
|
||||
// buttons: {
|
||||
// cancel: {
|
||||
// text: "取消",
|
||||
// value: null,
|
||||
// visible: true,
|
||||
// className: "btn btn-default btn-sm",
|
||||
// closeModal: true,
|
||||
// },
|
||||
// confirm: {
|
||||
// text: "确定",
|
||||
// value: true,
|
||||
// visible: true,
|
||||
// className: "btn btn-danger btn-sm",
|
||||
// closeModal: true
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// .then(function (willDelete) {
|
||||
// if (willDelete) {
|
||||
// $.post(ext.contextPath + '/user/deleteMenu.do', { id: id }, function (data) {
|
||||
// if (data.res > 0) {
|
||||
// $("#table").bootstrapTable('refresh');
|
||||
// } else {
|
||||
// showAlert('d', '删除失败', 'alertDiv_power');
|
||||
// }
|
||||
// }, 'json');
|
||||
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// var addPowerFun = function () {
|
||||
// $.post(ext.contextPath + '/user/showFuncAdd.do', { pid: "${menu.id}" }, function (data) {
|
||||
// $("#powerDiv").html(data);
|
||||
// openModal('powerModal')
|
||||
// });
|
||||
// };
|
||||
// var editPowerFun = function (id) {
|
||||
// $.post(ext.contextPath + '/user/showFuncEdit.do', { id: id }, function (data) {
|
||||
// $("#powerDiv").html(data);
|
||||
// openModal('powerModal')
|
||||
// });
|
||||
// };
|
||||
$(function () {
|
||||
$("#state").select2({ minimumResultsForSearch: -1 }).val("${teachertype.state}").trigger("change");
|
||||
//包含的子菜单,并可以拖动排序
|
||||
$("#table").bootstrapTable({ // 对应table标签的id
|
||||
url: ext.contextPath + '/teacher/teachertype/getPidJson.do?id=${teachertype.id}', // 获取表格数据的url
|
||||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||||
striped: true, //表格显示条纹,默认为false
|
||||
pagination: true, // 在表格底部显示分页组件,默认false
|
||||
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
|
||||
pageSize: 50, // 页面数据条数
|
||||
pageNumber: 1, // 首页页码
|
||||
sidePagination: 'server', // 设置为服务器端分页
|
||||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||||
return {
|
||||
rows: params.limit, // 每页要显示的数据条数
|
||||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||||
sort: params.sort, // 要排序的字段
|
||||
order: params.order // 排序规则
|
||||
}
|
||||
},
|
||||
sortName: 'id', // 要排序的字段
|
||||
sortOrder: 'desc', // 排序规则
|
||||
columns: [
|
||||
{
|
||||
field: 'name', // 返回json数据中的name
|
||||
title: '名称', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}, {
|
||||
field: 'state', // 返回json数据中的name
|
||||
title: '状态', // 表格表头显示文字
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle' // 上下居中
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
$(".bs-checkbox").css({ 'text-align': 'center', 'vertical-align': 'middle' })
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.info("加载数据失败");
|
||||
},
|
||||
// //当选中行,拖拽时的哪行数据,并且可以获取这行数据的上一行数据和下一行数据
|
||||
// onReorderRowsDrag: function(table, row) {
|
||||
// //取索引号
|
||||
// dragbeforeidx = $(row).attr("data-index");
|
||||
// },
|
||||
// //拖拽完成后的这条数据,并且可以获取这行数据的上一行数据和下一行数据
|
||||
// onReorderRowsDrop: function (table, row) {
|
||||
// //取索引号
|
||||
// draglateridx = $(row).attr("data-index");
|
||||
// },
|
||||
//当拖拽结束后,整个表格的数据
|
||||
onReorderRow: function (newData) {
|
||||
//这里的newData是整个表格数据,数组形式
|
||||
//console.log(newData); 调试用代码
|
||||
$.post(ext.contextPath + '/teacher/teachertype/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="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">详情</h3>
|
||||
|
||||
<div class="box-tools pull-right">
|
||||
<a onclick="dosave()" class="btn btn-box-tool" data-toggle="tooltip" title="保存"><i
|
||||
class="glyphicon glyphicon-floppy-disk"></i></a>
|
||||
<a onclick="dodel()" class="btn btn-box-tool" data-toggle="tooltip" title="删除"><i
|
||||
class="glyphicon glyphicon-trash"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-body ">
|
||||
<form class="form-horizontal " id="subForm">
|
||||
<input id="id" name="id" type="hidden" value="${teachertype.id}" />
|
||||
<!-- 界面提醒div强制id为alertDiv -->
|
||||
<div id="alertDiv"></div>
|
||||
<div id="teachertype4SelectDiv"></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="name" name="name" placeholder="名称" value="${teachertype.name }">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">上级菜单</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="_pname" name="_pname" placeholder="上级菜单"
|
||||
onclick="showTeachertype4SelectFun();" value="${teachertype._pname}">
|
||||
<input id="pid" name="pid" type="hidden" value="${teachertype.pid}" />
|
||||
</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="ord" name="ord" placeholder="顺序" value="${teachertype.ord}">
|
||||
</div>
|
||||
<label class="col-sm-2 control-label">启用</label>
|
||||
<div class="col-sm-4">
|
||||
<select id="state" name="state" class="form-control select2">
|
||||
<option value="启用">启用</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 " id="memo" name="memo" rows="2">${teachertype.memo}</textarea>
|
||||
<!-- <input type="text" class="form-control" id="memo" name="memo" placeholder="备注"
|
||||
value="${teachertype.memo}"> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box box-solid">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title"></h3>
|
||||
|
||||
<div class="box-tools pull-right">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box-body ">
|
||||
<div>
|
||||
<div id="alertDiv_power"></div>
|
||||
<!-- <div class="btn-group" style="width: 220px;padding-bottom:10px;">
|
||||
<button type="button" class="btn btn-default" onclick="addPowerFun();"><i class="fa fa-plus"></i> 新增</button>
|
||||
<button type="button" class="btn btn-default" onclick="saveDefault();"><i class="fa fa-plus-square"></i>
|
||||
默认</button>
|
||||
|
||||
</div> -->
|
||||
<div id="powerDiv"></div>
|
||||
<div id="menu4SelectDiv_func"></div>
|
||||
<br>
|
||||
<table id="table" data-reorderable-rows="true" data-toggle="table" data-use-row-attr-func="true"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
157
WebRoot/jsp/teacher/teachertypeManage.jsp
Normal file
157
WebRoot/jsp/teacher/teachertypeManage.jsp
Normal file
@ -0,0 +1,157 @@
|
||||
<%@ page language="java" 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"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
|
||||
<%@ page import="com.sipai.entity.base.ServerObject"%>
|
||||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
|
||||
<!DOCTYPE html>
|
||||
<!-- <html lang="zh-CN"> -->
|
||||
<!-- BEGIN HEAD -->
|
||||
<head>
|
||||
<title><%= ServerObject.atttable.get("TOPTITLE")%></title>
|
||||
<!-- 引用页头及CSS页-->
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
<script type="text/javascript">
|
||||
var addFun = function() {
|
||||
var node=$('#tree').treeview('getSelected');
|
||||
var pid="";
|
||||
if(node!=null && node.length>0){
|
||||
pid=node[0].id;
|
||||
}
|
||||
$.post(ext.contextPath + '/teacher/teachertype/showTeachertypeAdd.do', {pid:pid} , function(data) {
|
||||
$("#teachertypeBox").html(data);
|
||||
});
|
||||
};
|
||||
var editFun = function(id) {
|
||||
$.post(ext.contextPath + '/teacher/teachertype/showTeachertypeEdit.do', {id:id} , function(data) {
|
||||
$("#teachertypeBox").html(data);
|
||||
});
|
||||
};
|
||||
var deleteFun = function(id) {
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
dangerMode: true,
|
||||
buttons: {
|
||||
cancel: {
|
||||
text: "取消",
|
||||
value: null,
|
||||
visible: true,
|
||||
className: "btn btn-default btn-sm",
|
||||
closeModal: true,
|
||||
},
|
||||
confirm: {
|
||||
text: "确定",
|
||||
value: true,
|
||||
visible: true,
|
||||
className: "btn btn-danger btn-sm",
|
||||
closeModal: true
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(function(willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/work/group/delete.do', {id : id}, function(data) {
|
||||
if(data==1){
|
||||
$("#table").bootstrapTable('refresh');
|
||||
}else{
|
||||
showAlert('d','删除失败','mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
var deletesFun = function() {
|
||||
var checkedItems = $("#table").bootstrapTable('getSelections');
|
||||
var datas="";
|
||||
$.each(checkedItems, function(index, item){
|
||||
datas+=item.id+",";
|
||||
});
|
||||
if(datas==""){
|
||||
showAlert('d','请先选择记录','mainAlertdiv');
|
||||
}else{
|
||||
swal({
|
||||
text: "您确定要删除此记录?",
|
||||
dangerMode: true,
|
||||
buttons: {
|
||||
cancel: {
|
||||
text: "取消",
|
||||
value: null,
|
||||
visible: true,
|
||||
className: "btn btn-default btn-sm",
|
||||
closeModal: true,
|
||||
},
|
||||
confirm: {
|
||||
text: "确定",
|
||||
value: true,
|
||||
visible: true,
|
||||
className: "btn btn-danger btn-sm",
|
||||
closeModal: true
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(function(willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/work/group/deletes.do', {ids:datas} , function(data) {
|
||||
if(data>0){
|
||||
$("#table").bootstrapTable('refresh');
|
||||
}else{
|
||||
showAlert('d','删除失败','mainAlertdiv');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
var initTreeView = function() {
|
||||
$.post(ext.contextPath + '/teacher/teachertype/getTeachertypesJson.do', {ng:''} , function(data) {
|
||||
//console.info(data)
|
||||
$('#tree').treeview({data: data,
|
||||
});
|
||||
$('#tree').on('nodeSelected', function(event, data) {
|
||||
editFun(data.id);
|
||||
//var node=$('#tree').treeview('getSelected');
|
||||
});
|
||||
},'json');
|
||||
$("#teachertypeBox").html("");
|
||||
};
|
||||
$(function() {
|
||||
initTreeView();
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body class="hold-transition ${cu.themeclass} sidebar-mini">
|
||||
<div class="wrapper">
|
||||
<div class="content-wrapper">
|
||||
<!-- Main content -->
|
||||
<section class="content container-fluid">
|
||||
<div id="mainAlertdiv"></div>
|
||||
<div id="subDiv"></div>
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="box box-solid">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">课件类型列表</h3>
|
||||
<div class="box-tools">
|
||||
<button type="button" class="btn btn-box-tool" onclick="addFun();"><i class="fa fa-plus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body no-padding">
|
||||
<div id="tree" style="height:550px;overflow:auto; "></div>
|
||||
</div>
|
||||
<!-- /.box-body -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-9" id="teachertypeBox"></div>
|
||||
</div>
|
||||
</section>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
198
WebRoot/jsp/teacher/viewpic.jsp
Normal file
198
WebRoot/jsp/teacher/viewpic.jsp
Normal file
@ -0,0 +1,198 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8" %>
|
||||
<style type="text/css">
|
||||
.select2-container .select2-selection--single {
|
||||
height: 34px;
|
||||
line-height: 34px;
|
||||
}
|
||||
|
||||
.select2-selection__arrow {
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
|
||||
.krajee-default.file-preview-fram {
|
||||
width: 48%;
|
||||
}
|
||||
|
||||
</style>
|
||||
<!-- 文件上传-->
|
||||
<link rel="stylesheet" href="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/css/fileinput.min.css"/>
|
||||
<script type="text/javascript"
|
||||
src="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/fileinput.min.js"
|
||||
charset="utf-8"></script>
|
||||
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/locales/zh.js"
|
||||
charset="utf-8"></script>
|
||||
<style type="text/css">
|
||||
.krajee-default.file-preview-frame .kv-file-content {
|
||||
width: auto;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
var id = '${param.id}';
|
||||
var masterId = '${param.masterId}';
|
||||
var tbName = '${param.tbName}'; //数据表
|
||||
var nameSpace = 'Document';//保存文件夹
|
||||
var previews = new Array();
|
||||
var previewConfigs = new Array();
|
||||
|
||||
function showFileInput(ctrlName) {
|
||||
var control = $('#' + ctrlName);
|
||||
|
||||
control.fileinput('destroy');
|
||||
control.fileinput({
|
||||
language: 'zh', //设置语言
|
||||
showUpload: false, //是否显示上传按钮
|
||||
allowedFileExtensions: ['jpg', 'png', 'gif', 'pdf', 'doc', 'xls', 'docx', 'ppt', 'pptx', 'xlsx', 'wmv', 'mp4'],
|
||||
showRemove: false,
|
||||
showCaption: false,//是否显示标题
|
||||
showBrowse: false,//选择按钮
|
||||
showClose: false,//右上角关闭按钮
|
||||
dropZoneEnabled: false,//是否显示拖拽区域
|
||||
fileActionSettings: {
|
||||
showDrag: false
|
||||
},
|
||||
browseClass: "btn btn-primary", //按钮样式
|
||||
maxFileCount: 10, //表示允许同时上传的最大文件个数
|
||||
enctype: 'multipart/form-data',
|
||||
validateInitialCount: true,
|
||||
previewFileIcon: "<i class='fa fa-file'></i>",
|
||||
initialPreviewAsData: true,
|
||||
initialPreview: previews,
|
||||
initialPreviewConfig: previewConfigs,
|
||||
layoutTemplates: {
|
||||
actionDelete: '', //这行可以隐藏删除按钮
|
||||
actionUpload: '' //这行可以隐藏上传按钮
|
||||
},
|
||||
deleteUrl: ext.contextPath + "/base/deleteInputFile.do",
|
||||
deleteExtraData: function () { //传参
|
||||
var data = {
|
||||
"tbName": tbName
|
||||
};
|
||||
return data;
|
||||
}
|
||||
});
|
||||
control.on('filezoomhide', function (event, params) {
|
||||
//关闭预览模态框后清空内部,防止音视频继续播放
|
||||
$(params.modal).find('.kv-zoom-body').empty();
|
||||
});
|
||||
$('#kvFileinputModal').on("hidden.bs.modal", function () {
|
||||
$(this).removeData("bs.modal");
|
||||
//modal重复打开会导致前面的滚动条失去作用
|
||||
$('.modal').css("overflow", "auto");
|
||||
});
|
||||
}
|
||||
|
||||
//名称定义不可修改
|
||||
var getFileList = function () {
|
||||
$.post(ext.contextPath + '/base/getInputFileListById.do', {
|
||||
id: id,
|
||||
masterId: masterId,
|
||||
tbName: tbName
|
||||
}, function (data) {
|
||||
//console.info(data)
|
||||
if (data.length > 0) {
|
||||
previews = new Array();
|
||||
$('#maintenancefile').show();
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var previewConfig = new Object();
|
||||
var path = data[i].abspath;
|
||||
path = path.substring(path.indexOf('webapps') + 7, path.length);
|
||||
path = ext.basePath.replace(ext.contextPath, '') + path.replace(/\\/g, "\/");
|
||||
;
|
||||
previews.push(path);
|
||||
previewConfig['width'] = '2500px';
|
||||
previewConfig['caption'] = data[i].filename;
|
||||
previewConfig['key'] = data[i].id;
|
||||
if (data[i].type.split("/")[0] == 'application') {
|
||||
previewConfig['type'] = 'pdf';
|
||||
} else {
|
||||
previewConfig['type'] = data[i].type.split("/")[0];
|
||||
}
|
||||
previewConfig['size'] = data[i].size;
|
||||
previewConfig['filetype'] = data[i].type;
|
||||
previewConfigs.push(previewConfig);
|
||||
}
|
||||
showFileInput("teacherFileDiv");
|
||||
} else {
|
||||
$('#teacherFileDiv').hide();
|
||||
}
|
||||
}, 'json');
|
||||
|
||||
};
|
||||
/* var fileinput = function() {
|
||||
//var url='/maintenance/updateProblemFile.do';//保存数据表方法
|
||||
$.post(ext.contextPath + '/base/fileinput.do', {masterId:masterId,tbName:tbName,nameSpace:nameSpace} , function(data) {
|
||||
$("#fileInputDiv").html(data);
|
||||
openModal('fileInputModal');
|
||||
});
|
||||
}; */
|
||||
var closeModal = function () {
|
||||
setTimeout(function () {
|
||||
$("#subDiv").empty();
|
||||
}, 2000);
|
||||
};
|
||||
|
||||
var viewText = function() {
|
||||
$.post(ext.contextPath + '/documentData/viewText.do', {masterId: id} , function(data) {
|
||||
$("#div1").html(data)
|
||||
});
|
||||
}
|
||||
|
||||
$(function () {
|
||||
if (tbName == null || tbName == '' || tbName == undefined) {
|
||||
tbName = 'tb_teacher_file';
|
||||
}
|
||||
getFileList();
|
||||
viewText();
|
||||
})
|
||||
|
||||
</script>
|
||||
<div class="modal fade" id="subModal">
|
||||
<div class="modal-dialog modal-xlg">
|
||||
<div class="modal-content">
|
||||
<input type="hidden" name="id" id="id" value="${param.id}"/>
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close" onclick="closeModal();">
|
||||
<span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">浏览</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<!-- 新增界面formid强制为subForm -->
|
||||
<!-- <form class="form-horizontal" id="subForm" enctype="multipart/form-data" > -->
|
||||
<!-- 界面提醒div强制id为alertDiv
|
||||
<div id="alertDiv"></div>
|
||||
<div style="height: 323px;width: 550px;">
|
||||
<image style="width: 100%;height: 100%;" src="/JNSXIMG${relpath}"></image>
|
||||
</div> -->
|
||||
|
||||
<div class="form-group" style="margin:8px;">
|
||||
<input type="file" name="teacherFileDiv" id="teacherFileDiv" multiple class="file-loading"/>
|
||||
</div>
|
||||
<div style="background:#FFFFFF;text-align:center;" valign="middle"
|
||||
align="left">
|
||||
<%--<div style="background:#FFFFFF;height:500px;text-align:center;" valign="middle"
|
||||
align="left">--%>
|
||||
<div id="titleDiv2">
|
||||
<font id="content">资料内容</font>
|
||||
</div>
|
||||
<%-- 资料内容 --%>
|
||||
<div class="box-body" align="left">
|
||||
<%--<div id="div1" style="height:400px;">--%>
|
||||
<div id="div1">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- </form> -->
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-right" data-dismiss="modal" onclick="closeModal();">
|
||||
关闭
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
157
WebRoot/jsp/teacher/viewpic_Layer.jsp
Normal file
157
WebRoot/jsp/teacher/viewpic_Layer.jsp
Normal file
@ -0,0 +1,157 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<style type="text/css">
|
||||
.select2-container .select2-selection--single{
|
||||
height:34px;
|
||||
line-height: 34px;
|
||||
}
|
||||
.select2-selection__arrow{
|
||||
margin-top:3px;
|
||||
}
|
||||
|
||||
|
||||
.krajee-default.file-preview-fram {
|
||||
width: 48%;
|
||||
}
|
||||
|
||||
</style>
|
||||
<!-- 文件上传-->
|
||||
<link rel="stylesheet" href="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/css/fileinput.min.css"/>
|
||||
<script type="text/javascript"
|
||||
src="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/fileinput.min.js"
|
||||
charset="utf-8"></script>
|
||||
<script type="text/javascript" src="<%=request.getContextPath()%>/node_modules/bootstrap-fileinput/js/locales/zh.js"
|
||||
charset="utf-8"></script>
|
||||
<style type="text/css">
|
||||
.krajee-default.file-preview-frame .kv-file-content {
|
||||
width: auto;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
var masterId='${param.id}';
|
||||
var tbName='${param.tbName}'; //数据表
|
||||
var nameSpace='Document';//保存文件夹
|
||||
var previews = new Array();
|
||||
var previewConfigs = new Array();
|
||||
function showFileInput(ctrlName) {
|
||||
var control = $('#' + ctrlName);
|
||||
|
||||
control.fileinput('destroy');
|
||||
control.fileinput({
|
||||
language: 'zh', //设置语言
|
||||
showUpload: false, //是否显示上传按钮
|
||||
allowedFileExtensions : ['jpg', 'png','gif','pdf','doc','xls','docx','ppt','pptx','xlsx','wmv','mp4'],
|
||||
showRemove:false,
|
||||
showCaption: false,//是否显示标题
|
||||
showBrowse:false,//选择按钮
|
||||
showClose:false,//右上角关闭按钮
|
||||
dropZoneEnabled: false,//是否显示拖拽区域
|
||||
fileActionSettings:{
|
||||
showDrag:false
|
||||
},
|
||||
browseClass: "btn btn-primary", //按钮样式
|
||||
maxFileCount: 10, //表示允许同时上传的最大文件个数
|
||||
enctype: 'multipart/form-data',
|
||||
validateInitialCount:true,
|
||||
previewFileIcon: "<i class='glyphicon glyphicon-king'></i>",
|
||||
initialPreviewAsData: true,
|
||||
initialPreview: previews,
|
||||
initialPreviewConfig:previewConfigs,
|
||||
layoutTemplates:{
|
||||
actionDelete:'', //这行可以隐藏删除按钮
|
||||
actionUpload:'' //这行可以隐藏上传按钮
|
||||
},
|
||||
deleteUrl:ext.contextPath+"/base/deleteInputFile.do",
|
||||
deleteExtraData:function () { //传参
|
||||
var data = {
|
||||
"tbName": tbName
|
||||
};
|
||||
return data;
|
||||
}
|
||||
});
|
||||
$('#kvFileinputModal').on("hidden.bs.modal", function() {
|
||||
$(this).removeData("bs.modal");
|
||||
//modal重复打开会导致前面的滚动条失去作用
|
||||
$('.modal').css("overflow","auto");
|
||||
});
|
||||
}
|
||||
//名称定义不可修改
|
||||
var getFileList = function() {
|
||||
$.post(ext.contextPath + '/base/getInputFileListById.do', {id:masterId,tbName:tbName} , function(data) {
|
||||
//console.info(data)
|
||||
if(data.length>0){
|
||||
previews=new Array();
|
||||
$('#maintenancefile').show();
|
||||
for(var i=0;i<data.length;i++){
|
||||
var previewConfig = new Object();
|
||||
var path = data[i].abspath;
|
||||
path=path.substring(path.indexOf('webapps')+7,path.length);
|
||||
path =ext.basePath.replace(ext.contextPath,'')+ path.replace(/\\/g,"\/");;
|
||||
previews.push(path);
|
||||
previewConfig['width']= '2500px';
|
||||
previewConfig['caption']= data[i].filename;
|
||||
previewConfig['key']= data[i].id;
|
||||
if( data[i].type.split("/")[0] == 'application'){
|
||||
previewConfig['type']= 'pdf';
|
||||
}else{
|
||||
previewConfig['type']= data[i].type.split("/")[0];
|
||||
}
|
||||
|
||||
previewConfig['filetype']= data[i].type;
|
||||
previewConfigs.push(previewConfig);
|
||||
}
|
||||
showFileInput("teacherFileDiv");
|
||||
}else{
|
||||
$('#teacherFileDiv').hide();
|
||||
}
|
||||
},'json');
|
||||
|
||||
};
|
||||
var fileinput = function() {
|
||||
//var url='/maintenance/updateProblemFile.do';//保存数据表方法
|
||||
$.post(ext.contextPath + '/base/fileinput.do', {masterId:masterId,tbName:tbName,nameSpace:nameSpace} , function(data) {
|
||||
$("#fileInputDiv").html(data);
|
||||
openModal('fileInputModal');
|
||||
});
|
||||
};
|
||||
|
||||
$(function() {
|
||||
if(tbName==null || tbName=='' || tbName==undefined){
|
||||
tbName = 'tb_teacher_file';
|
||||
}
|
||||
getFileList();
|
||||
})
|
||||
|
||||
</script>
|
||||
<div class="modal fade" id="subModal_Doc">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<input type="hidden" name="id" id="id" value="${param.id}"/>
|
||||
<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强制为subForm -->
|
||||
<!-- <form class="form-horizontal" id="subForm" enctype="multipart/form-data" > -->
|
||||
<!-- 界面提醒div强制id为alertDiv
|
||||
<div id="alertDiv"></div>
|
||||
<div style="height: 323px;width: 550px;">
|
||||
<image style="width: 100%;height: 100%;" src="/JNSXIMG${relpath}"></image>
|
||||
</div> -->
|
||||
|
||||
<div class="form-group" style="margin:8px;">
|
||||
<input type="file" name="teacherFileDiv" id="teacherFileDiv" multiple class="file-loading" />
|
||||
</div>
|
||||
|
||||
<!-- </form> -->
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default pull-right" data-dismiss="modal">关闭</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
Reference in New Issue
Block a user