first commit
This commit is contained in:
102
WebRoot/jsp/safety/staffArchivesImport.jsp
Normal file
102
WebRoot/jsp/safety/staffArchivesImport.jsp
Normal file
@ -0,0 +1,102 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8" %>
|
||||
<%@page import="com.sipai.tools.CommUtil" %>
|
||||
<%request.setAttribute("nowDate", CommUtil.nowDate().replaceAll("[[\\s-:punct:]]", "")); %>
|
||||
<style type="text/css">
|
||||
.select2-container .select2-selection--single {
|
||||
height: 30px;
|
||||
line-height: 34px;
|
||||
}
|
||||
|
||||
.select2-selection__arrow {
|
||||
margin-top: 3px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
var control;
|
||||
|
||||
function initUpload(ctrlName, uploadUrl) {
|
||||
control = $('#' + ctrlName);
|
||||
control.fileinput({
|
||||
language: 'zh', //设置语言
|
||||
uploadUrl: uploadUrl, //上传的地址
|
||||
uploadAsync: true, //默认异步上传
|
||||
showCaption: true,//是否显示标题
|
||||
showUpload: false, //是否显示上传按钮
|
||||
browseClass: "btn btn-primary", //按钮样式
|
||||
allowedFileExtensions: ["xls", "xlsx"], //接收的文件后缀
|
||||
maxFileCount: 1,//最大上传文件数限制
|
||||
previewFileIcon: '<i class="glyphicon glyphicon-file"></i>',
|
||||
showPreview: false, //是否显示预览
|
||||
previewFileIconSettings: {
|
||||
'docx': '<i ass="fa fa-file-word-o text-primary"></i>',
|
||||
'xlsx': '<i class="fa fa-file-excel-o text-success"></i>',
|
||||
'xls': '<i class="fa fa-file-excel-o text-success"></i>',
|
||||
'pptx': '<i class="fa fa-file-powerpoint-o text-danger"></i>',
|
||||
'jpg': '<i class="fa fa-file-photo-o text-warning"></i>',
|
||||
'pdf': '<i class="fa fa-file-archive-o text-muted"></i>',
|
||||
'zip': '<i class="fa fa-file-archive-o text-muted"></i>',
|
||||
},
|
||||
//参数
|
||||
uploadExtraData: function () {
|
||||
var data = {
|
||||
<%--"companyId": '${param.companyId}',//此处自定义传参--%>
|
||||
<%--"plan_type": '${param.plan_type}'--%>
|
||||
};
|
||||
return data;
|
||||
}
|
||||
});
|
||||
control.on("fileuploaded", function (event, data, previewId, index) {
|
||||
if (data.response.status == true) {
|
||||
closeModal('subModal');
|
||||
$("#table").bootstrapTable('refresh');
|
||||
//初始化 从事岗位下拉
|
||||
postPulldown();
|
||||
showAlert('s', data.response.msg, 'mainAlertdiv');
|
||||
} else {
|
||||
showAlert('d', data.response.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(function () {
|
||||
initUpload("filelist", ext.contextPath + "/safety/staffArchives/importExcel.do");
|
||||
});
|
||||
|
||||
//导入上传文件的数据
|
||||
function importExcelFun() {
|
||||
if ($("#filelist").val() == null || $("#filelist").val() == "") {
|
||||
showAlert('d', '上传的文件不能为空!');
|
||||
} else {
|
||||
control.fileinput("upload");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
<div class="modal fade" id="subModal">
|
||||
<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 id="importFile" name="importFile" class="form-horizontal" method="post"
|
||||
enctype="multipart/form-data">
|
||||
<div id="alertDiv"></div>
|
||||
<div class="box-body">
|
||||
<div>
|
||||
<input id="filelist" name="filelist" class="file-loading" type="file" multiple
|
||||
accept=".xls,.xlsx">
|
||||
</div>
|
||||
</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="importExcelFun()" id="btn_save">导入</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user