179916596bacb89ed0f811e447c1c26ff2d4d004.svn-base 4.03 KB
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>项目导入</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
		});
		var str = "正在导入文件数据,请稍等...";
		var seq = 0;
		var second=500; //间隔时间1秒钟
		function scroll() {
		msg = str.substring(0, seq+1);
		document.getElementById("word").innerHTML = msg;
		seq++;
		if (seq >= str.length){ seq = 0;}
		}
		//若onsubmit事件无法触发,使用绑定按钮点击事件代替  
		function check() {  
		    var excel_file = $("#excel_file").val();  
		    var issure = "${issure}";
//		    alert(issure+"1233333");
		    if ((excel_file == "" || excel_file.length == 0) && (issure == undefined || issure == null || issure =="")) {  
		        alert("请选择文件路径!");  
		        return false;  
		    } else {
				//重复执行某个方法  
				window.setInterval("scroll()",second); 
		        return true;  
		    }
		} 
		function checkDada(){
			var fileObj = document.getElementById("excel_file").files[0]; //  获取文件对象
            var FileController = "${ctx}/reg/base/regBaseXm/checkfiledata";  // 接收上传文件的后台地址            
            $.ajax({
                url:FileController,
                type:"post",
                data:form,
                processData:false,
                contentType:false,
                success:function(data){
                    window.clearInterval(timer);
                    console.log("over..");
                },
                error:function(e){
                    alert("错误!!");
                    window.clearInterval(timer);
                }
            });      
			
		}
// 		$("#excel_button").on('click', function() {  
// 	        var excel_file = $("#excel_file").val();  
// 	        if (excel_file == "" || excel_file.length == 0) {  
// 	            alert("请选择文件路径!");  
// 	            return false;  
// 	        } else {  
// 	            return true;  
// 	        }  
// 	    });
	</script>
	<style type="text/css">
		ol{padding-left:20px}
	</style>
</head>
<body>
	<form name="Form" action="${ctx}/reg/base/regBaseXm/importFile?issure=${issure}" method="post" enctype="multipart/form-data" onsubmit="return check();">  
		<br>
<%--		<input class="btn btn-default" id="excel_file" type="file" name="filename"  accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"/> --%> 
<%--	<input  id="check_button" class="btn btn-primary" type="button" onclick="checkDada()" value="数据验证"/> --%>
		<c:if test="${not empty issure}">
		<a href="${ctx}/reg/base/regBaseXm/importSave?issure=${issure}"><input  id="excel_button" class="btn btn-primary" type="button" value="确定导入"/></a></c:if>
		<c:if test="${empty issure}">
		<input class="btn btn-default" id="excel_file" type="file" name="filename"  accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"/>
		<input  id="excel_button" class="btn btn-primary" type="submit" value="数据验证并导入"/></c:if>
		<a href="${ctx}/reg/base/regBaseXm/download"><input type="button" class="btn btn-primary" value="下载excel模板"/></a>
	</form>
	<h3 id="word" ></h3><br/>
	<c:if test="${not empty issure}">
		<br>
		<h3 style="color:red;">以下信息需手动确认:</h3>
		<ol id="errormsg">
		<c:forEach items="${listtem}" var="str" varStatus="status">
			<li>${str }</li>
		</c:forEach>
		</ol> 
	</c:if> 
	<h3 id="word" ></h3><br/>
	<c:if test="${not empty VIEW}">
		<br>
		<h5 style="color:red;">错误信息如下:</h5>
		<ol id="errormsg">
		<c:forEach items="${errorList}" var="str" varStatus="status">
			<c:if test="${status.index!=0 }">
				<li>${str }</li>
			</c:if>
		</c:forEach>
		</ol> 
	</c:if> 
	<c:if test="${not empty msg}">
	<h4 style="color:red;">${msg }</h4>
	</c:if>
	<a href="${ctx}/reg/base/regBaseXm/"><input type="button" class="btn btn-primary" value="返 回"/></a>
</body>
</html>