Blame view

WebRoot/WEB-INF/jsp/system/user/uploadexcel.jsp 3.42 KB
ad5081d3   孙向锦   初始化项目
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
  <%@ page language="java" contentType="text/html; charset=UTF-8"
  	pageEncoding="UTF-8"%>
  <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
  <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
  <%
  	String path = request.getContextPath();
  	String basePath = request.getScheme() + "://"
  			+ request.getServerName() + ":" + request.getServerPort()
  			+ path + "/";
  %>
  <!DOCTYPE html>
  <html lang="en">
  <head>
  <base href="<%=basePath%>">
  
  <!-- jsp文件头和头部 -->
  <%@ include file="../index/top.jsp"%>
  
  </head>
  <body class="no-skin">
  
  	<!-- /section:basics/navbar.layout -->
  	<div class="main-container" id="main-container">
  		<!-- /section:basics/sidebar -->
  		<div class="main-content">
  			<div class="main-content-inner">
  				<div class="page-content">
  					<div class="row">
  						<div class="col-xs-12">
  							<form action="user/readExcel.do" name="Form" id="Form" method="post" enctype="multipart/form-data">
  								<div id="zhongxin">
  								<table style="width:95%;" >
  									<tr>
  										<td style="padding-top: 20px;"><input type="file" id="excel" name="excel" style="width:50px;" onchange="fileType(this)" /></td>
  									</tr>
  									<tr>
  										<td style="text-align: center;padding-top: 10px;">
  											<a class="btn btn-mini btn-primary" onclick="save();">导入</a>
  											<a class="btn btn-mini btn-danger" onclick="top.Dialog.close();">取消</a>
  											<a class="btn btn-mini btn-success" onclick="window.location.href='<%=basePath%>/user/downExcel.do'">下载模版</a>
  										</td>
  									</tr>
  								</table>
  								</div>
  								<div id="zhongxin2" class="center" style="display:none"><br/><img src="static/images/jzx.gif" /><br/><h4 class="lighter block green"></h4></div>
  							</form>
  						</div>
  						<!-- /.col -->
  					</div>
  					<!-- /.row -->
  				</div>
  				<!-- /.page-content -->
  			</div>
  		</div>
  		<!-- /.main-content -->
  	</div>
  	<!-- /.main-container -->
  
  	<!-- basic scripts -->
  	<!-- 页面底部js¨ -->
  	<%@ include file="../index/foot.jsp"%>
  	<!-- ace scripts -->
  	<script src="static/ace/js/ace/ace.js"></script>
  	<!-- 上传控件 -->
  	<script src="static/ace/js/ace/elements.fileinput.js"></script>
  	<!--提示框-->
  	<script type="text/javascript" src="static/js/jquery.tips.js"></script>
  	<script type="text/javascript">
  		$(top.hangge());
  		$(function() {
  			//上传
  			$('#excel').ace_file_input({
  				no_file:'请选择EXCEL ...',
  				btn_choose:'选择',
  				btn_change:'更改',
  				droppable:false,
  				onchange:null,
  				thumbnail:false, //| true | large
  				whitelist:'xls|xls',
  				blacklist:'gif|png|jpg|jpeg'
  				//onchange:''
  			});
  		});
  		
  		//保存
  		function save(){
  			if($("#excel").val()=="" || document.getElementById("excel").files[0] =='请选择xls格式的文件'){
  				
  				$("#excel").tips({
  					side:3,
  		            msg:'请选择文件',
  		            bg:'#AE81FF',
  		            time:3
  		        });
  				return false;
  			}
  			$("#Form").submit();
  			$("#zhongxin").hide();
  			$("#zhongxin2").show();
  		}
  		function fileType(obj){
  			var fileType=obj.value.substr(obj.value.lastIndexOf(".")).toLowerCase();//获得文件后缀名
  		    if(fileType != '.xls'){
  		    	$("#excel").tips({
  					side:3,
  		            msg:'请上传xls格式的文件',
  		            bg:'#AE81FF',
  		            time:3
  		        });
  		    	$("#excel").val('');
  		    	document.getElementById("excel").files[0] = '请选择xls格式的文件';
  		    }
  		}
  	</script>
  
  
  </body>
  </html>