function viewPermission(index){
		$("#findex").val(index);
		var roleIndex=index;
		layer.open({
			  type: 2,
			  title: '已有资源',
			  shadeClose: true,
			  shade: 0.3,
			  area: ['280px', '60%'],
			  maxmin : false,
			  content: 'viewpermission' 
			}); 
		
	}
	function destributePermission(index){
		$("#findex").val(index);
		var roleIndex=index;
		layer.open({
			  type: 2,
			  title: '资源分配',
			  content: '资源分配',
			  shade: 0.3,
			  area: ['280px', '60%'],
			  maxmin : false,
			  content: 'destributepermission', //iframe的url
			  end:function(){
				  refresh();
			  }
		});
	}
	$(document).ready(function() {
		refresh();
	});
	function refresh(){
		$.ajax({
			type : "POST",
			url : "/pqs9200/permission/getRolePermission",
			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) {
						var oTable=$('#example').DataTable({
							columnDefs : [ {
								orderable : false,
								targets : 3
							} ],
							data : [],
							destroy : true,
							lengthMenu : [ 200 ],
							language : {
								url:'/pqs9200/json/chine.json'
							},
							'fnDrawCallback': function(oTable) {    
							    $("#example_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 table = $("#example").dataTable();    
							    $('#dataTable-btn').click(function(e) {
							        if($("#changePage").val() && $("#changePage").val() > 0) {    
							            var redirectpage = $("#changePage").val() - 1;    
							        } else {    
							            var redirectpage = 0;    
							        }    
							        table.fnPageChange(redirectpage);
							    });    
							}
						});
					} else {
						var oTable=$('#example').DataTable({
							columnDefs : [ {
								orderable : false,
								targets : 3
							} ],
							data : info.body,
							destroy : true,
							lengthMenu : [ 200 ],
							language : {
								url:'/pqs9200/json/chine.json'
							},
							'fnDrawCallback': function(oTable) {    
							    $("#example_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 table = $("#example").dataTable();    
							    $('#dataTable-btn').click(function(e) {
							        if($("#changePage").val() && $("#changePage").val() > 0) {    
							            var redirectpage = $("#changePage").val() - 1;    
							        } else {    
							            var redirectpage = 0;    
							        }    
							        table.fnPageChange(redirectpage);
							    });    
							}
						});
					}
				}
			}
		});
	}