first commit
This commit is contained in:
287
WebRoot/jsp/info/infoView.jsp
Normal file
287
WebRoot/jsp/info/infoView.jsp
Normal file
@ -0,0 +1,287 @@
|
||||
<%@ 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"%>
|
||||
<script type="text/javascript">
|
||||
var recvid = document.getElementById("recvid");
|
||||
$(function() {
|
||||
$.post(ext.contextPath + "/info/getListForSelect.do", function(data) {
|
||||
var select =$("#typeid").select2({
|
||||
data: data,
|
||||
placeholder:'请选择',//默认文字提示
|
||||
allowClear: false,//允许清空
|
||||
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
|
||||
language: "zh-CN",
|
||||
minimumInputLength: 0,
|
||||
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
||||
formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果
|
||||
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
|
||||
});
|
||||
$(".select2-selection--single").css({'height':'30px','paddingTop':'4px'})
|
||||
select.val('${info.typeid}').trigger("change");
|
||||
select.on("change",function(e){
|
||||
var typeid=$(this).val();
|
||||
if(typeid != '系统公告'){
|
||||
|
||||
$("#recvdiv").attr("class",'form-group ');
|
||||
|
||||
//$("#recvdiv").show();
|
||||
}else{
|
||||
$('#recvid').val("");
|
||||
$("#recvdiv").attr("class",'form-group hidden');
|
||||
//$("#recvdiv").hide();
|
||||
}
|
||||
});
|
||||
},'json');
|
||||
})
|
||||
$(function() {
|
||||
$.post(ext.contextPath + "/user/getUnits4Select.do",{}, function(data) {
|
||||
var select1 =$("#recvid").select2({
|
||||
data: data,
|
||||
placeholder:'请选择',//默认文字提示
|
||||
allowClear: false,//允许清空
|
||||
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
|
||||
language: "zh-CN",
|
||||
minimumInputLength: 0,
|
||||
minimumResultsForSearch: 10,//数据超过十个启用搜索框
|
||||
multiple : true,
|
||||
formatResult: function formatRepo(repo){return repo.nodes;}, // 函数用来渲染结果
|
||||
formatSelection: function formatRepoSelection(repo){return repo.nodes;} // 函数用于呈现当前的选择
|
||||
});
|
||||
$(".select2-selection--single").css({'height':'30px','paddingTop':'4px'});
|
||||
|
||||
var items=new Array();
|
||||
/* $.each(JSON.parse(roles),function(index,value,array){
|
||||
items.put(value.id);
|
||||
}); */
|
||||
<c:forEach var="current" items="${unit}">
|
||||
items.push("${current.id}");
|
||||
</c:forEach>
|
||||
select1.val(items).trigger("change");
|
||||
},'json');
|
||||
})
|
||||
$(function() {
|
||||
$('#publishtime1').datepicker({
|
||||
language: 'zh-CN',
|
||||
autoclose: true,
|
||||
todayHighlight: true,
|
||||
format:'yyyy-mm-dd',
|
||||
}).on('hide',function(e) {
|
||||
//当日期选择框关闭时,执行刷新校验
|
||||
|
||||
});
|
||||
$('#publishtime2').datepicker({
|
||||
language: 'zh-CN',
|
||||
autoclose: true,
|
||||
todayHighlight: true,
|
||||
format:'yyyy-mm-dd',
|
||||
}).on('hide',function(e) {
|
||||
//当日期选择框关闭时,执行刷新校验
|
||||
|
||||
});
|
||||
});
|
||||
function dolaunch() {
|
||||
$('#status').val('${Status_Launch}');
|
||||
dosave();
|
||||
}
|
||||
function doupdate() {
|
||||
$("#subForm").bootstrapValidator('validate');//提交验证
|
||||
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||||
$.post(ext.contextPath + "/info/update.do", $("#subForm").serialize(), function(data) {
|
||||
if (data.res == 1) {
|
||||
closeModal('subModal')
|
||||
$("#table").bootstrapTable('refresh');
|
||||
|
||||
}else if(data.res == 0){
|
||||
showAlert('d','保存失败');
|
||||
}else{
|
||||
showAlert('d',data.res);
|
||||
}
|
||||
},'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 masterId=$('#id').val();
|
||||
var tbName='tb_info_file'; //数据表
|
||||
var nameSpace='InfoFile';//保存文件夹
|
||||
var previews = new Array();
|
||||
var previewConfigs = new Array();
|
||||
var key=$("a").attr("data-key");
|
||||
/* var student = {
|
||||
"caption":"lilei",
|
||||
|
||||
}
|
||||
previewConfigs[0]=student; */
|
||||
//初始化fileinput控件(第一次初始化)
|
||||
function showFileInput(ctrlName) {
|
||||
var control = $('#' + ctrlName);
|
||||
|
||||
control.fileinput('destroy');
|
||||
control.fileinput({
|
||||
language: 'zh', //设置语言
|
||||
//uploadUrl: uploadUrl, //上传的地址
|
||||
uploadAsync:true,
|
||||
allowedFileExtensions : ['jpg', 'png','gif','pdf','doc','xls','docx','ppt','pptx','xlsx'],//接收的文件后缀
|
||||
showUpload: false, //是否显示上传按钮
|
||||
showRemove:false,
|
||||
showPreview :true, //是否显示预览
|
||||
previewFileType:['pdf','image', 'html', 'text', 'video', 'audio', 'flash', 'object','other'],
|
||||
showCaption: false,//是否显示标题
|
||||
showBrowse:false,//选择按钮
|
||||
showClose:false,//右上角关闭按钮
|
||||
dropZoneEnabled: false,//是否显示拖拽区域
|
||||
fileActionSettings:{
|
||||
showDrag:false,
|
||||
|
||||
},
|
||||
/* otherActionButtons:'<a type="button" href="'
|
||||
+ ext.contextPath
|
||||
+ '/base/downloadFile.do"'
|
||||
+' class="kv-file-down btn btn-sm btn-default" {dataKey} title="下载附件"><i class="fa fa-cloud-download"></i></a>', */
|
||||
otherActionButtons:'<a type="button" onclick="downloadfile(this)" class="kv-file-down btn btn-sm btn-default" {dataKey} title="下载附件"><i class="fa fa-cloud-download"></i></a>',
|
||||
browseClass: "btn btn-primary", //按钮样式
|
||||
maxFileCount: 10, //表示允许同时上传的最大文件个数
|
||||
enctype: 'multipart/form-data',
|
||||
validateInitialCount:true,
|
||||
previewFileIcon: "<i class='glyphicon glyphicon-king'></i>",
|
||||
uploadExtraData:function (previewId, index) { //传参
|
||||
var data = {
|
||||
"masterId": '${masterId}', //此处自定义传参
|
||||
"tbName": '${tbName}',
|
||||
"nameSpace": '${nameSpace}'
|
||||
};
|
||||
return data;
|
||||
},
|
||||
initialPreviewAsData: true,
|
||||
initialPreview: previews,
|
||||
initialPreviewConfig:previewConfigs,
|
||||
layoutTemplates:{
|
||||
actionUpload:'',//不显示缩略图上传按钮
|
||||
actionDelete:'',//不显示删除按钮
|
||||
actionZoom:''//不显示放大按钮
|
||||
},
|
||||
//allowedPreviewTypes : [ 'image','text','pdf'],//配置所有的被预览文件类型
|
||||
//allowedPreviewMimeTypes : [ 'jpg', 'png', 'gif' ,'pdf','txt','doc'],//控制被预览的所有mime类型
|
||||
/* minImageWidth: 50, //图片的最小宽度
|
||||
minImageHeight: 50,//图片的最小高度
|
||||
maxImageWidth: 1000,//图片的最大宽度
|
||||
maxImageHeight: 1000,//图片的最大高度 */
|
||||
//initialPreviewDownloadUrl: ext.contextPath + '/base/downloadFile.do?{dataKey}'+'&tbName='+tbName,
|
||||
preferIconicPreview: true,//是否强制相关文件展示icon
|
||||
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>',
|
||||
},
|
||||
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");
|
||||
});
|
||||
}
|
||||
/* $(".kv-file-down btn btn-sm btn-default").click(function(e) {
|
||||
alert();
|
||||
var id = $(e.target).data("key");
|
||||
alert(id);
|
||||
}) */
|
||||
function downloadfile(obj){
|
||||
var key = $(obj).data('key');
|
||||
window.open(ext.contextPath + '/base/downloadFile.do?key='+key+'&tbName='+tbName);
|
||||
}
|
||||
//名称定义不可修改
|
||||
var getFileList = function() {
|
||||
$.post(ext.contextPath + '/base/getInputFileList.do', {masterId:masterId,tbName:tbName} , function(data) {
|
||||
console.info(data)
|
||||
if(data.length>0){
|
||||
previews=new Array();
|
||||
$('#infofile').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']= '50px';
|
||||
previewConfig['caption']= data[i].filename;
|
||||
previewConfig['key']= data[i].id;
|
||||
previewConfig['size']= data[i].size;
|
||||
previewConfig['data']= data[i].abspath;
|
||||
previewConfigs.push(previewConfig);
|
||||
}
|
||||
showFileInput("infofile");
|
||||
}else{
|
||||
$('#infofile').hide();
|
||||
}
|
||||
},'json');
|
||||
|
||||
};
|
||||
getFileList();
|
||||
$("#subForm").bootstrapValidator({
|
||||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||||
fields: {
|
||||
title: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '标题不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
recvid: {
|
||||
validators: {
|
||||
notEmpty: {
|
||||
message: '发布对象不能为空'
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<div class="modal fade" id="subModal">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<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">
|
||||
<input id ="id" name="id" type="hidden" value="${info.id}"/>
|
||||
<h2 >${info.title }</h2>
|
||||
<h5>${fn:substring(info.publishtime1,0,10)}   ${user.caption }</h5>
|
||||
<p>${info.matter }</p>
|
||||
<div class="form-group" style="margin:8px;">
|
||||
<input type="file" name="infofile" id="infofile" multiple class="file-loading" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default " data-dismiss="modal">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
Reference in New Issue
Block a user