109 lines
4.9 KiB
Plaintext
109 lines
4.9 KiB
Plaintext
|
|
<%@ page language="java" pageEncoding="UTF-8"%>
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
var filelist = new Array();
|
|||
|
|
var control;
|
|||
|
|
//初始化fileinput控件(第一次初始化)
|
|||
|
|
function initFileInput(ctrlName, uploadUrl) {
|
|||
|
|
control = $('#' + ctrlName);
|
|||
|
|
control.fileinput({
|
|||
|
|
language: 'zh', //设置语言
|
|||
|
|
uploadUrl: uploadUrl, //上传的地址
|
|||
|
|
uploadAsync:true,
|
|||
|
|
allowedFileExtensions : ['jpg', 'png','gif','pdf','doc','xls','docx','ppt','pptx','xlsx'],//接收的文件后缀
|
|||
|
|
showUpload: false, //是否显示上传按钮
|
|||
|
|
showRemove:false,
|
|||
|
|
showCaption: false,//是否显示标题
|
|||
|
|
showClose: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,
|
|||
|
|
previewFileIconSettings: {
|
|||
|
|
'doc': '<i class="fa fa-file-word-o" style="color:#3c8dbc;margin-left:-100px"></i>',
|
|||
|
|
'docx': '<i class="fa fa-file-word-o" style="color:#3c8dbc;margin-left:-100px"></i>',
|
|||
|
|
'xls': '<i class="fa fa-file-excel-o" style="color:#00a65a ;margin-left:-100px"></i>',
|
|||
|
|
|
|||
|
|
'xlsx': '<i class="fa fa-file-excel-o" style="color:#00a65a ;margin-left:-100px"></i>',
|
|||
|
|
'pptx': '<i class="fa fa-file-powerpoint-o" style="color:#f39c12;margin-left:-100px "></i>',
|
|||
|
|
'ppt': '<i class="fa fa-file-powerpoint-o" style="color:#f39c12;margin-left:-100px "></i>',
|
|||
|
|
//'jpg': '<i class="fa fa-file-image-o" style="color:#00a65a "></i>',
|
|||
|
|
'pdf': '<i class="fa fa-file-pdf-o" style="color:#dd4b39 ;margin-left:-100px"></i>',
|
|||
|
|
'zip': '<i class="fa fa-file-zip-o" ></i>',
|
|||
|
|
},
|
|||
|
|
|
|||
|
|
uploadExtraData:function (previewId, index) { //传参
|
|||
|
|
var data = {
|
|||
|
|
"masterId": '${masterId}', //此处自定义传参
|
|||
|
|
"tbName": '${tbName}',
|
|||
|
|
"nameSpace": '${nameSpace}',
|
|||
|
|
"equipmentIds":$("#equipmentIds").val()
|
|||
|
|
};
|
|||
|
|
return data;
|
|||
|
|
},
|
|||
|
|
//设置缩略图上的按钮,为空不显示,默认显示
|
|||
|
|
layoutTemplates:{
|
|||
|
|
actionDelete:'',
|
|||
|
|
actionUpload:''
|
|||
|
|
},
|
|||
|
|
});
|
|||
|
|
/* control.on("filebatchselected", function (event, data, previewId, index) {
|
|||
|
|
$(this).fileinput("upload");
|
|||
|
|
}); */
|
|||
|
|
//导入文件上传完成之后的事件
|
|||
|
|
control.on("fileuploaded", function (event, data, previewId, index) {
|
|||
|
|
if(data.response.suc) {
|
|||
|
|
closeModal('fileInputModal');
|
|||
|
|
$("#fileTable").bootstrapTable('refresh');
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
$(function() {
|
|||
|
|
initFileInput("filelist",ext.contextPath+ "/document/inputFile.do");
|
|||
|
|
})
|
|||
|
|
//导入上传文件的数据
|
|||
|
|
function uploadFun(){
|
|||
|
|
if($("#filelist").val() == null || $("#filelist").val()==""){
|
|||
|
|
showAlert('d','上传的文件不能为空!','alertFileDiv');
|
|||
|
|
}else{
|
|||
|
|
control.fileinput("upload");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
var showEquipment4SelectsFun = function(formId,hiddenId,textId,equipcode) {
|
|||
|
|
var companyId='${param.companyId}';
|
|||
|
|
var equipmentIds=$('#'+hiddenId).val();;
|
|||
|
|
$.post(ext.contextPath + '/equipment/showEquipmentCardForSelects.do', {formId:formId,hiddenId:hiddenId,textId:textId,companyId:companyId,equipmentIds:equipmentIds,equipcode:equipcode} , function(data) {
|
|||
|
|
$("#equ4SelectDiv").html(data);
|
|||
|
|
openModal("equipment4SelectModal");
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
</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>
|
|||
|
|
<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>
|