var isSubmit = true;
$(document).ready(function(){

	
})

var user = {
	
	save : function(){
		if (isSubmit){
			isSubmit = false;
			var formData = new FormData(); 
			formData.append('file', $('#input_file')[0].files[0]);
			formData.append('type', $('#type').val());
			
			$.ajax({
				  	url: '/user/import',
				  	type: 'POST',
					cache: false,
					data: formData,
					processData: false,
					contentType: false,
					dataType:"json",
					beforeSend: function(){
					    
					},
					success: function(data){
					  var status=data.status;
					  
					  if(status==1){//注册成功
							bootbox.dialog({
								message:"导入成功",
									buttons:{
										"success":{
											"label":"继续添加",
											"className":"btn-sm btn-primary",
											"callback": function () {
												window.location.href = webPath + '/user/list';
					                        }
										}
							
									}
								});
							
						} else if (status == 0){
							isSubmit = true;
							bootbox.dialog({
								message:"请选择数据类型",
									buttons:{
										"success":{
											"label":"确定",
											"className":"btn-sm btn-primary",
											"callback": function () {
												
					                        }
										}
							
									}
								});
						} 
					  
					  
				  }
			});
			

			
			
		}
		
	}
	
}


















