341 lines
15 KiB
Plaintext
341 lines
15 KiB
Plaintext
|
|
<%@ 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 != 'system'){
|
|||
|
|
|
|||
|
|
$("#recvdiv").attr("class",'form-group ');
|
|||
|
|
|
|||
|
|
//$("#recvdiv").show();
|
|||
|
|
}else{
|
|||
|
|
$('#recvid').val("");
|
|||
|
|
$("#recvdiv").attr("class",'form-group hidden');
|
|||
|
|
//$("#recvdiv").hide();
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
},'json');
|
|||
|
|
})
|
|||
|
|
$(function() {
|
|||
|
|
$.post(ext.contextPath + "/user/getUnitsByUserId4Select.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) {
|
|||
|
|
//当日期选择框关闭时,执行刷新校验
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
//实例化编辑器
|
|||
|
|
var ue = new UE.ui.Editor();
|
|||
|
|
ue.render("myEditor");
|
|||
|
|
/* UE.delEditor("myEditor");
|
|||
|
|
var ue = UE.getEditor("myEditor"); */
|
|||
|
|
ue.addListener("ready", function () {
|
|||
|
|
// editor准备好之后才可以使用
|
|||
|
|
var value = $("#divdata").val();
|
|||
|
|
ue.setContent(value,false);
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
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);
|
|||
|
|
console.info(previewConfigs);
|
|||
|
|
control.fileinput('destroy');
|
|||
|
|
control.fileinput({
|
|||
|
|
language: 'zh', //设置语言
|
|||
|
|
uploadAsync:true,
|
|||
|
|
allowedFileExtensions : ['jpg', 'png','gif','pdf','doc','xls','docx','pptx','xlsx'],//接收的文件后缀
|
|||
|
|
allowedFileTypes:null,
|
|||
|
|
showPreview:true,
|
|||
|
|
autoReplace:true,
|
|||
|
|
previewFileType:['image', 'html', 'text', 'office' ,'audio', 'flash', 'object','other'],
|
|||
|
|
msgFilesTooMany : "选择上传的文件数量({n}) 超过允许的最大数值{m}!",
|
|||
|
|
preferIconicPreview: true,//是否强制相关文件展示icon
|
|||
|
|
initialPreviewAsData: true,
|
|||
|
|
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>',
|
|||
|
|
},
|
|||
|
|
|
|||
|
|
showUpload: false, //是否显示上传按钮
|
|||
|
|
showRemove:false,
|
|||
|
|
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>",
|
|||
|
|
initialPreviewAsData: true,
|
|||
|
|
initialPreview: previews,
|
|||
|
|
initialPreviewConfig:previewConfigs,
|
|||
|
|
layoutTemplates:{
|
|||
|
|
actionUpload:'',//不显示上传按钮
|
|||
|
|
actionZoom:''//不显示放大按钮
|
|||
|
|
},
|
|||
|
|
//initialPreviewDownloadUrl: ext.contextPath + '/base/downloadFile.do?{dataKey}'+'&tbName='+tbName,
|
|||
|
|
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.length);
|
|||
|
|
previewConfigs = new Array();
|
|||
|
|
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;
|
|||
|
|
previewConfigs.push(previewConfig);
|
|||
|
|
console.info(data[i].filename);
|
|||
|
|
}
|
|||
|
|
showFileInput("infofile");
|
|||
|
|
}else{
|
|||
|
|
$('#infofile').hide();
|
|||
|
|
}
|
|||
|
|
},'json');
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
getFileList();
|
|||
|
|
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');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$("#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">
|
|||
|
|
<!-- 新增界面formid强制为subForm -->
|
|||
|
|
<form class="form-horizontal" id="subForm">
|
|||
|
|
<!-- 界面提醒div强制id为alertDiv -->
|
|||
|
|
<div id="alertDiv"></div>
|
|||
|
|
<input id ="id" name="id" type="hidden" value="${info.id}"/>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">*公告类型</label>
|
|||
|
|
<div class="col-sm-3">
|
|||
|
|
<select class="form-control select2 " id="typeid" name ="typeid" style="width: 250px;">
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
<label class="col-sm-2 control-label">*发布人</label>
|
|||
|
|
<div class="col-sm-3">
|
|||
|
|
<input type="text" class="form-control" value="${info.userInsuser.caption}" readonly>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group <c:if test="${ info.typeid eq 'system'}">hidden</c:if>" id="recvdiv">
|
|||
|
|
<label class="col-sm-2 control-label">发布对象</label>
|
|||
|
|
<div class="col-sm-8">
|
|||
|
|
<select class="form-control select2 " id="recvid" name ="recvid" style="width: 250px;">
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">*标题</label>
|
|||
|
|
<div class="col-sm-8">
|
|||
|
|
<input type="text" class="form-control" id="title" name ="title" placeholder="标题" value="${info.title }">
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<label class="col-sm-2 control-label">发布期限</label>
|
|||
|
|
<div class="col-sm-8">
|
|||
|
|
<div class="input-group date"
|
|||
|
|
data-date="10/11/2012" data-date-format="yyyy-mm-dd">
|
|||
|
|
<input type="text" class="form-control input-small" id="publishtime1" name="publishtime1"
|
|||
|
|
value="${fn:substring(info.publishtime1,0,10)}" placeholder="起始日期"> <span
|
|||
|
|
class="input-group-addon"> 到 </span> <input type="text"
|
|||
|
|
class="form-control input-small" id="publishtime2" name="publishtime2" value="${fn:substring(info.publishtime2,0,10)}"
|
|||
|
|
placeholder="结束日期">
|
|||
|
|
|
|||
|
|
</span>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<div class="col-sm-12 col-md-12">
|
|||
|
|
<%-- <input type="text" name="solution" id="solution" value="${list.solution }"
|
|||
|
|
class="form-control "> --%>
|
|||
|
|
|
|||
|
|
<div id="myEditor" name="matter" style="width:100%;height:400px;">
|
|||
|
|
<textarea class="form-control " type="text" id="divdata"
|
|||
|
|
style="display:none" rows="3" >${info.matter }</textarea>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group">
|
|||
|
|
<div class="col-sm-12 col-md-12">
|
|||
|
|
<!-- <input id="f_upload" type="file" class="file" /> -->
|
|||
|
|
<button type="button" class="btn btn-default btn-file" onclick="fileinput()" id="btn_save"><i class="fa fa-paperclip"></i>上传附件</button>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<div class="form-group" style="margin:8px;">
|
|||
|
|
<input type="file" name="infofile" id="infofile" multiple class="file-loading" />
|
|||
|
|
</div>
|
|||
|
|
</form>
|
|||
|
|
</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()" id="btn_save">发布</button>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-content -->
|
|||
|
|
</div>
|
|||
|
|
<!-- /.modal-dialog -->
|
|||
|
|
</div>
|