function deleteRoleByIndex(index){
		var roleIndex=index;
		layer.confirm('确定删除？', function(index){
			$.ajax({
				type : "POST",
				url : "/pqs9200/role/deleteRoleByIndex",
				dataType : "text",
				data:{
					index:roleIndex
				},
				success : function(data) {
					//没有权限的请求
					if(data==300){
						location.href='/pqs9200/auth/unauthorized';
					//没有登陆的请求
					}else if(data==301){
						location.href='/pqs9200';
					}else{
						var info = $.parseJSON(data);
						if (info.code == 500) {
							//删除角色异常、或者失败
							layer.msg(info.message, {
								icon: 5,
								time: 1000
								},function(){
									refresh();
								});
						} else {
							//删除角色成功
							layer.msg(info.message, {
								  icon:6,
								  time: 1000 
								}, function(){
									refresh();
								}); 
						}
					}		
				}
			});
			  layer.close(index);
		});
	}
	$(document).ready(function() {
		refresh();
	});
	$("#addRole").click(function(){
		layer.open({
			  type: 2,
			  title: '新增角色',
			  shadeClose: true,
			  shade: 0.3,
			  area: ['380px', '300px'],
			  maxmin : false,
			  content: 'addrole', //iframe的url
			  scrollbar: false,
			  end:function(){
				  refresh();
			  }
			});
	});
	
	function refresh(){
		$.ajax({
			type : "POST",
			url : "/pqs9200/role/getRoleList",
			dataType : "text",
			success : function(data) {
				//没有权限的请求
				if(data==300){
					location.href='/pqs9200/auth/unauthorized';
				//没有登陆的请求
				}else if(data==301){
					location.href='/pqs9200';
				}else{
					var info = $.parseJSON(data);
					if (info.code == 500) {
						$('#example').DataTable({
							columnDefs : [ {
								orderable : false,
								targets : 3
							} ],
							data : [],
							destroy : true,
							lengthMenu : [ 200 ],
							language : {
								url:'/pqs9200/json/chine.json'
							}
						});
					} else {
						$('#example').DataTable({
							columnDefs : [ {
								orderable : false,
								targets : 3
							} ],
							data : info.body,
							destroy : true,
							lengthMenu : [ 200 ],
							language : {
								url:'/pqs9200/json/chine.json'
							}
						});
					}
				}
			}
		});
	}