<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/include/header.jsp"%>
<link rel="stylesheet"  type="text/css" href="${ctx}/css/indexNew/jquery-ui.min.css" />
<link type="text/css" rel="stylesheet" href="${ctx}/css/zTreeStyle.css" />
<link type="text/css" rel="stylesheet" href="${ctx}/css/baseFrame.css" />
<link type="text/css" rel="stylesheet" href="${ctx}/css/index.css" />
<script src="${ctx}/component/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<title>专项模型数据导入</title>
<style>
	/*导入数据按钮,2018-01-08*/
	.exportData_btn{
		color: #fff;
		margin-top: 10px;
	}
	.exportData_btn li{
		float: left;
		margin-right: 5px;
	}
	.exportData_btn li .data_btn{
		cursor: pointer;
	    height: 22px;
	    padding: 1px 5px;
	    text-align: center;
	    line-height: 22px;
	    background-color: #00bb9c;
	    border-radius: 3px;
	}
	
</style>
</head>
<body class="bg1">
	<div class="headCon">
		<jsp:include page="/WEB-INF/jsp/top.jsp">
			<jsp:param name="index" value="专项模型" />
		</jsp:include>
	</div>	
	<div class="searchCon">
		<ul>
			<hna:permission privilege="sysUser.view">
			<li><a href="${ctx}/sysUser/list.do">用户管理</a></li>
			</hna:permission>
			<hna:permission privilege="sysRole.view">
			<li><a href="${ctx}/sysRole/list.do">角色管理</a></li>
			</hna:permission>
			<hna:permission privilege="sysAuthority.view">
			<li><a href="${ctx}/sysAuthority/list.do">权限管理</a></li>
			</hna:permission>
			<hna:permission privilege="sysLog.view">
			<li><a href="${ctx}/sysLog/list.do">日志查看</a></li>
			</hna:permission>
			<hna:permission privilege="sysTask.issuing">
			<li><a href="${ctx}/sysTask/list.do">任务管理</a></li>
			</hna:permission>
			<li class="on"><a href="${ctx}/sysTaskPlus/specialImport.do">模型数据导入</a></li>
		</ul>
	</div>
	<!-- <div id="resultCon1" class="resultCon" style="margin-left: 255px;"> -->
	<div class="resultCon" style="margin-left: 255px;position:relative;">
		<input type="hidden" id="CSRFToken" value="${csrfToken }"/>
		<div class="m_right">
				<div class="switch" id="switch"></div>
				<div class="p_bar">您当前的位置：专项模型数据导入</div>
		</div>
		<ul class="exportData_btn">
			<li>
				<span class="data_btn" id="importBtn">导入</span>
				<input type="file" id="importBtnCon" name="markFile" style="display:none;"/>
			</li>
			<li><span class="data_btn" id="importModelBtn">下载模板</sapn></li>
		</ul>
	</div>

	<script src="${ctx}/js/lib/core.js"></script>
	<script src="${ctx}/js/lib/jquery.ajaxfileupload.js"></script>
	<script>		
		//导入数据
		$(function(){
			//导入数据模板下载
			$("#importModelBtn").click(function(){
				window.location.href="${ctx}/sysTaskPlus/downSpecialModel.do";
			});
			//导入数据
			$("#importBtn").click(function(){
				$("#importBtnCon").click();
			})
			$("#importBtnCon").ajaxfileupload({
			    action:'${ctx}/sysTaskPlus/specialModelToMysql.do',
			    valid_extensions : ['xls','xlsx'],
			    params: {
					extra: 'markFile'
			    },				
			    onComplete: function(data,a,b,c) {
					if(data.status=="err"){
						alert(data.mess);
						$("#importBtn").text("导入");
						return;
					}else{
						alert(data.mess);
						$("#importBtn").text("导入");
					}
					var result=data;

					console.log(data);
					//alert(JSON.stringify(data));
			    },
			    onStart: function() {
					$("#importBtn").text("正在导入...");
					$("#importBtn").attr("title","正在导入...");
					//if(weWantedTo) return false; // cancels upload
			    },
			    onCancel: function() {
					console.log('no file selected');
			    },
				errow:function(data){
					alert("上传失败");
				}
			});
			//窗口大小变化
			resize();
            $(window).resize(function(){
				resize();
			});
			function resize(){
				//获取窗口高度
				var windowheight=$(window).height();
				var leftList = windowheight-40;
				$(".searchCon").css({"height":leftList+"px"});
				$(".resultCon").css({"height":leftList-10+"px"});
			}
		});
	</script>
</body>
</html>
