<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
 	<%@include file="../../../frame/assets/header-all.jsp"%>
	<style>
	.form-line .text-content{
		width:160px;
	}
	<!--

* { font-size:13px}

body { margin:0}

.line { position:relative; float:left; padding:8px 0;    border-left: 0 !important;}

.line span { float:left}

input { border:1px solid #888; vertical-align:middle}

.file { position:absolute; left:90px; top:8px; display:none;filter:alpha(opacity=0);opacity:0}

.file1 { padding:6px 13px; display:block; float:left; background:#67c23a; color:#fff; z-index:1; margin-left:5px; vertical-align:middle; cursor: pointer}

.inputstyle {     width: 180px;height: 26px;border:1px solid #888; z-index:99}
.fail{padding:0 5px;}
-->
.LIEVK{
	overflow: auto;
    height: 114px;
}
.datagrid-body{
	height:85px !important;
}
	</style>
	
</head>
<body style = "overflow : hidden;">
<form id="form1" method="post" target="hidden_frame" action="ywarchivevideoinfoAction!imp_Ywarchivevideoinfo.do" enctype="multipart/form-data">
	<div class="form-line clearfix">			
		<div class='fl'>
			<!-- 
				 <input type="file" id='myfile' name='file'   value="请选择文件">
			 -->
				<div class="line"> <span>
				
					<label  style="padding: 6px 0;">上传文件：</label>
					
					<input name="" type="text" id="viewfile"  readonly onmouseout="document.getElementById('myfile').style.display='none';" class="inputstyle" />
					
					</span>
					
					<label for="unload" onmouseover="document.getElementById('myfile').style.display='block';" class="file1">浏览...</label>
					
					<input type="file" onchange="document.getElementById('viewfile').value=this.value;this.style.display='none';" class="file"   id='myfile' name='file' />
								
				</div>
						 
		</div>		
	</div>
	<div class="form-line clearfix">			
		<div class="fl"> 
			<span >设备编号重复是否覆盖：</span> 
			<input type="radio" name ="sbbh" value="1" checked>是 
			<input type="radio" name ="sbbh" value="0" >否 
		</div> 					
	</div>
</form>
<iframe id="hidden_frame" name='hidden_frame' style='display: none'></iframe>
<div class="fail">
	<div id="sucNum" style="    line-height: 24px;overflow:hidden;height:24px;"></div>
	<div id="repeatNum" style="    line-height: 24px;overflow:hidden;height:24px;"></div>
	<div id="repeatMsg" class="LIEVK"></div>
	<div id="failNum" style="    line-height: 24px;overflow:hidden;height:24px;"></div>
	<div  style="height: 266px; width: 100%;  overflow-y: auto;overflow-x: hidden">
	<table id='failMsgGrid'></table>
	</div>
	
</div>
</body>
</html>
<script type="text/javascript">
	$(function(){
		$('#hidden_frame').load(function(){					//添加iframe的onload事件
			var resText = $(this).contents().find("body").find('pre').text();
			var res = JSON.parse(resText);	//获取返回结果
//			console.log("返回结果：",res);
			if(res){
//				console.log("判断成功！！！！");
				
				$('#sucNum').html("成功导入："+res.sucNum+" 条！");
				
				$('#repeatNum').html("重复数据："+res.reprkNum+" 条！");				
				var repeatMsg = "";
				res.repeatData.forEach(function(item){
					repeatMsg += item+'<br/>';
				})
				$('#repeatMsg').html(repeatMsg);
				
				
				$('#failNum').html("导入失败数据："+res.failNum+" 条！");
				/* var failMsg = "";
				res.failData.forEach(function(item){
					failMsg += item.xh+"第"+item.row+"行,第"+item.colu+"列,"+item.sbbm+item.errMsg+'<br/>';
				})	 */	
				
				var failData = res.failData;
//				console.log("表格显示：",failData);
				if(failData){
					$('#failMsgGrid').datagrid({
						data : failData,
						columns : [[
							{field:'xh',title:'序号',hidden:false,width:85},
							{field:'row',title:'行号',hidden:false,width:65},
							{field:'colu',title:'列信息',hidden:false,width:150},
							{field:'sbbm',title:'设备编号',hidden:false,width:125},
							{field:'errMsg',title:'错误描述',hidden:false,width:180},
						]],
					})
				}
				
			}else{
				alert("导入出错！！！");
			}
		})
	})
	

 	
</script>