<?php /*a:3:{s:60:"/www/wwwroot/btn.millet-mirth.com/view/admin/rule/index.html";i:1645090132;s:60:"/www/wwwroot/btn.millet-mirth.com/view/admin/common/top.html";i:1625466448;s:63:"/www/wwwroot/btn.millet-mirth.com/view/admin/common/bottom.html";i:1629163316;}*/ ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title><?php echo config('common.CMS_NAME'); ?></title>
<link rel="stylesheet" href="/static/tqcms/css/common.css">
<link rel="stylesheet" href="/static/tqcms/layui/css/layui.css"><!--layui css-->
<link rel="stylesheet" href="/static/tqcms/css/skin.css">
<script src="/static/tqcms/js/jquery.js"></script>
</head>
<body>
<div class="body_top">
	<ul class="title">
    	<li><a href="<?php echo url('admin/index'); ?>">账号管理</a></li>
    	<li><a href="<?php echo url('Rule/group'); ?>">权限分组管理</a></li>
    	<li><a href="<?php echo url('Content/group'); ?>">内容权限分组管理</a></li>
    	<li class="active"><a href="<?php echo url('Rule/index'); ?>">权限节点管理</a></li>
    </ul>
</div>

<div class="body_content_list">

<script type="text/html" id="barDemo">
<span class="tq_table_bar">
  <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
  <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</span>
</script>

<script type="text/html" id="sort">
<span class="tq_table_bar">
	<a class="layui-btn layui-btn-xs tq_sort"><input type="text" name="{{d.id}}" autocomplete="off" value="{{d.sort}}"></a>
  	<a class="layui-btn layui-btn-xs" lay-event="sort_t">置顶</a>
  	<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="sort_p">上移</a>
  	<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="sort_n">下移</a>
</span>
</script>

<script type="text/html" id="is_super">
	{{#  if(d.is_super==2){}}
		<span style="color:#66ccff">超级账号</span>
	{{#  } else { }}
		<span>普通账号</span>
	{{#  } }}
</script>

<script type="text/html" id="is_effect">
<span class="tq_table_bar">
	<input type="checkbox" name="is_effect" value="{{d.id}}" lay-skin="switch" lay-text="停用|启用" lay-filter="is_effect" {{ d.is_effect ==2 ? 'checked' : '' }}>
</span>
</script>

<script type="text/html" id="tq_btn">
  	<a class="layui-btn layui-btn-normal layui-btn-sm" lay-event="add">添加</a>
  	<a class="layui-btn layui-btn-sm" lay-event="sort_all">排序</a>
</script>

<table class="layui-hide" id="list" lay-filter="list"></table>

</div>


<script src="/static/tqcms/layui/layui.js"></script><!--layui js-->
<script src="/static/tqcms/layui/laytq.js"></script><!--layui js-->
<script src="/static/tqcms/js/common.js"></script>
<script src="/static/tqcms/js/md5.js"></script>
<script src="/static/tqcms/js/url.js"></script>
</body>
</html>
<input name="" id="add_type" type="hidden" value="0" />
<script>
iname=self.frameElement.name;
layui.use('table', function(){
  var table = layui.table,form = layui.form;
  var mpage=1;

  table.render({
    elem: '#list'
	,title:'管理员列表信息'
    ,url:'<?php echo url("admin/Rule/rule_list"); ?>'
    ,cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
	,even: true
	,toolbar: '#tq_btn'
	,defaultToolbar: ['filter']
	,height: 'full-70'
	//,page: { //支持传入 laypage 组件的所有参数（某些参数除外，如：jump/elem） - 详见文档
//      layout: ['limit','count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
//      //,curr: 5 //设定初始在第 5 页
//	  ,limit:mpage //每页显示的数据条数
//	  ,limits:[10, 20, 30]
//      ,groups:8 //只显示 1 个连续页码
//	  ,theme: 'leng'
//
//    }
	,cols: [[
      {field:'id', width:80, title: '编号', sort: true}
      ,{field:'id', width:222, title: '排序',templet:'#sort'}
      ,{field:'name', title: '名称'}
      ,{field:'url', title: '模块'}
      ,{field:'url_parameter', title: '参数'}
      ,{field:'is_effect', width:130 ,align:'center', title:'节点状态',templet:'#is_effect', sort: true}
      ,{field:'id', width:130,align:'center',toolbar:'#barDemo', title: '操作'}
    ]]
  });
  
//table列表内工具条操作
table.on('tool(list)', function(obj){
	var data = obj.data;
	if(obj.event==='del'){
		window.top.delete_c(obj,iname);
	}
	if(obj.event==='edit'){
		var title='修改权限节点';
		var url="<?php echo url('Rule/edit'); ?>?id="+data.id+"";
		var area=["500px", "390px"];
		window.top.openiframe(title,url,area,iname);
	}
	
	if(obj.event==='sort_t'){
		is_sort('t',data['id'],'auth_rule',data['sort'],data['pid']);
	}
	if(obj.event==='sort_p'){
		is_sort('p',data['id'],'auth_rule',data['sort'],data['pid']);
	}
	if(obj.event==='sort_n'){
		is_sort('n',data['id'],'auth_rule',data['sort'],data['pid']);
	}
});

//表头按钮操作
table.on('toolbar(list)', function(obj){

	//添加
	if(obj.event==='add'){
		var title='添加权限节点';
		var url="<?php echo url('Rule/add'); ?>";
		var area=["500px", "390px"];
		window.top.openiframe(title,url,area,iname);
	}	
	
	if(obj.event==='sort_all'){
		var idArray = new Array();
		var sortArray = new Array();
		$('.tq_sort input').each(function(){
            idArray.push($(this).attr('name'));
            sortArray.push($(this).val());
		});
		$.post('/admin/Common/sort_all',{id:idArray,sort:sortArray,dbname:'auth_rule'},function(data){
			table.reload('list', { where: {} });
		});
	}
		
});

//监听账号状态操作 列表内
form.on('switch(is_effect)', function(obj){
	var is_effect=obj.elem.checked==true?2:1;
	$.post('/admin/Common/is_edit',{id:this.value,is_effect:is_effect,dbname:'auth_rule'},function(data){ });
});


});


//删除
function delete_id(info){
	$.post('/admin/Common/delete_id',{id:info.data.id,table:'auth_rule'},function(data){ info.del(); });
}

//排序
function is_sort(type,id,dbname,sort,pid){
	$.post('/admin/Common/is_sort',{type:type,id:id,dbname:dbname,sort:sort,pid:pid},function(data){
		if(data['type']==1){
			layui.use('table', function(){
				var table = layui.table;
				table.reload('list', { where: {} });
			});
		}
	});
}
</script>