function load(vollevel) {
			var i ;
			vollevel=$("#choose option:selected").val();
			$.ajax({
				method : "post",
				url : "/pqs9900/importGridTop/getGirdTop",
				data : {
					vollevel:vollevel	
				},
				beforeSend: function () {  
	                i = ityzl_SHOW_LOAD_LAYER();  
	            },
				success : function(data) {
					//没有权限的请求
					if(data==300){
						location.href='/pqs9900/auth/unauthorized';
					//没有登陆的请求
					}else if(data==301){
						location.href='/pqs9900';
					}else{
						if (data.body == null) {
							//没有数据
							initTable(null);
						} else {
							initTable(data);
						}
					}
					//***********关闭loading
		        	ityzl_CLOSE_LOAD_LAYER(i); 
				}
		});
}
function initTable(data){
	var heightTemp=screen.height;
	var length;
	if(heightTemp==768){
		length=8;
	}else if(heightTemp<=733){
		length=7;
	}else{
		length=12;
	}
	var p=$("#roleJ").val();
	 $('#vdlist').dataTable().fnClearTable(); 
	if(data==null){
		$('#vdlist').DataTable({
			columnDefs : [ {
				orderable : false,
				targets : [1,2,3 ]
			} ],
			destroy : true,
			data : data,
			pageLength:length,
	        language : {
				url:'/pqs9900/json/chine.json'
			}
		});
	}else{
		   var table=$('#vdlist').DataTable({
				columnDefs : [ {
					orderable : false,
					targets : [1,2,3]
				} ],
				destroy : true,
				data : data.body,
				pageLength:length,
		        language : {
					url:'/pqs9900/json/chine.json'
				},
				'fnDrawCallback': function(table) {    
				    $("#vdlist_paginate").append("<div style='float:right;padding-top:4px;padding-left:10px'>到第 <input type='text' id='changePage' class='input-text' style='width:50px;height:28px;'> 页  <button class='btn btn-primary' id='dataTable-btn'>确定</button></div>");    
				    var oTable = $("#vdlist").dataTable();    
				    $('#dataTable-btn').click(function(e) {
				        if($("#changePage").val() && $("#changePage").val() > 0) {    
				            var redirectpage = $("#changePage").val() - 1;    
				        } else {    
				            var redirectpage = 0;    
				        }    
				        oTable.fnPageChange(redirectpage);
				    });    
				},
		});  
	   }
}
$("#importGirdTop").click(function(){
	var options=$("#choose option:selected").val();
	var i;
	var uploadEventFile=$("#inputfile").val();


	/**
	 * xuyang
	 * 前端对所选文件的大小做个简单判断
	 */
	var uploadFile = document.getElementById("inputfile").files;
	//文件大小
	var size = uploadFile[0].size;
	if (Math.floor(size/1024) <= 3072){
		if(uploadEventFile == ''){
			layer.msg("请选择Excel文件，再上传！",{icon:5,time:2000},function(){
				layer.closeAll()});
		}else if(uploadEventFile.lastIndexOf(".xls")<0){//可判断以.xls和.xlsx结尾的excel
			layer.msg("只能上传Excel文件",{icon:5,time:2000},function(){
				layer.closeAll()});
		}else{
			var formData = new FormData($('#uploadForm')[0]);
			formData.append("volLevel",options);
			$.ajax({
				method : "post",
				url : "/pqs9900/importGridTop/importGirdTop",
				data :formData,
				beforeSend: function () {
					i = ityzl_SHOW_LOAD_LAYER();
				},
				success : function(data) {
					if(data==1){
						layer.msg("上传成功",{icon:1,time:2000},function(){
							layer.closeAll()});
						load();
						//***********关闭loading
						ityzl_CLOSE_LOAD_LAYER(i);
					} else if (data==2){
						layer.msg("上传失败，文件大小超过3M！",{icon:1,time:2000},function(){
							layer.closeAll()});
						load();
						//***********关闭loading
						ityzl_CLOSE_LOAD_LAYER(i);
					} else if (data==3){
						layer.msg("上传失败，文件类型错误！",{icon:1,time:2000},function(){
							layer.closeAll()});
						load();
						//***********关闭loading
						ityzl_CLOSE_LOAD_LAYER(i);
					} else{
						layer.msg("上传失败,上传的文件字段不正确",{icon:5,time:2000},function(){
							layer.closeAll()});
						//***********关闭loading
						ityzl_CLOSE_LOAD_LAYER(i);
					}

				},
				cache: false,
				contentType: false,
				processData: false
			});
		}
	} else {
		layer.msg("上传失败,文件大小超过3M!",{icon:5,time:2000},function(){
			layer.closeAll()});
	}
})

$(document).ready(function() {
	load();
	$("#choose").change(function(){
		var options=$("#choose option:selected");  //获取选中的项
		load((options.val()));
	})
});
