Commit 6435afd8 authored by zfc's avatar zfc

权限3

parent 76774be4
......@@ -210,8 +210,13 @@ class Auth extends Basic
parent::setStatus($model);
}
//权限表界面
public function authRuleIndex(){
return view('auth_rule_index');
}
//权限列表
public function authList(){
public function authRuleList(){
$data['status'] = 200;
$data['msg'] = '';
......@@ -225,10 +230,11 @@ class Auth extends Basic
$where='a.status=1';
$order='a.pid asc,a.sort asc';
$join=[['auth_rule b', ' a.pid=b.id','left']];
$list=$table->authList($pageNo, $pageSize,$order,$field,$join, $where);
$data['list'] = $table->authRuleList($pageNo, $pageSize,$order,$field,$join, $where);
$data['total'] = $table->getTotal('status=1');
// prt($list);//转化arr
//prt(collection($list)->toArray());//转化arr
return $this->response(200,'成功',$list);
return $this->response(200,'成功',$data);
}
......
{layout name="global/frame_tpl" /}
<!--关联js元素-->
<input type="hidden" class="page-load" id="auth_rule_index" />
<!--关联js元素-->
<style>
.ids{position: absolute; top: -20%; left: -20%; display: block;
width: 140%; height: 140%; margin: 0px; padding: 0px; background: rgb(255, 255, 255) none repeat scroll 0% 0%;
border: 0px none; opacity: 0;}
ins{position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%;
margin: 0px; padding: 0px; background: rgb(255, 255, 255) none repeat scroll 0% 0%; border: 0px none; opacity: 0;}
</style>
<div id="pjax-container" class="content-wrapper" style="min-height: 1426px; width: 1035px; float: left; margin-left: 20px;">
<section class="content-header">
<!-- 面包屑导航 -->
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i> </a><a href="/admin.php/admin/dashboard/index.html">首页</a></li>
<li class="active">规则管理</li>
</ol>
</section>
<!--内容-->
<section class="content">
<div class="box box-solid">
<div class="box-header with-border">
<h3 class="box-title">规则管理</h3>
<div class="box-tools pull-right">
<button onclick="javascript:location.reload();" class="btn btn-box-tool f16" type="button"><i class="fa fa-refresh"></i></button>
</div>
</div>
<div class="box-body">
<div class="builder listbuilder-box">
<div class="builder-toolbar mt-10 mb-20">
<div class="row">
<div class="col-xs-12 col-sm-12 button-list clearfix">
<!-- 工具栏按钮 -->
<!--<div class="form-group">-->
<a href="/admin.php/admin/auth/ruleedit/pid/0.html" class="btn btn-primary btn-sm" title="新增">新增</a>&nbsp;
<a href="/admin.php/admin/auth/setstatus/status/resume/model/auth_rule.html" model="auth_rule" class="btn btn-success ajax-post confirm btn-sm" target-form="ids" title="启用">启用</a>&nbsp;
<a href="/admin.php/admin/auth/setstatus/status/forbid/model/auth_rule.html" model="auth_rule" class="btn btn-warning ajax-post confirm btn-sm" target-form="ids" title="禁用">禁用</a>&nbsp;
<a href="/admin.php/admin/auth/setstatus/status/delete/model/auth_rule.html" model="auth_rule" class="btn btn-danger ajax-post confirm btn-sm" target-form="ids" title="删除">删除</a>&nbsp;
<!--<a onclick="move_menuparent()" title="&lt;i class=&quot;fa fa-exchange&quot;&gt;&lt;/i&gt; 移动位置" class="btn btn-info btn-sm" target-form="ids"><i class="fa fa-exchange"></i> 移动位置</a>&nbsp;-->
<!--<a model="auth_rule" href="/admin.php/admin/auth/rule_sort/pid/0.html" class="btn btn-info btn-sm" name="排序" title="&lt;i class=&quot;fa fa-sort&quot;&gt;&lt;/i&gt; 排序"><i class="fa fa-sort"></i> 排序</a>&nbsp;-->
<!--&lt;!&ndash; </div>&ndash;&gt;-->
</div>
</div><!--row-->
</div>
<!-- 数据列表 -->
<div class="builder-container">
<div class="row">
<div class="builder-table col-sm-12">
<table class="table table-responsive table-bordered table-hover dataTable">
<thead>
<tr>
<th width="50" class="checkbox-toggle"><div class="icheckbox_minimal-blue" style="position: relative;" aria-checked="false" aria-disabled="false"><input type="checkbox" class="check-all" style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; background: rgb(255, 255, 255) none repeat scroll 0% 0%; border: 0px none; opacity: 0;"><ins class="iCheck-helper" style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; background: rgb(255, 255, 255) none repeat scroll 0% 0%; border: 0px none; opacity: 0;"></ins></div><!-- <span class="checkbox-toggle" style="color:#ddd;font-size:23px;cursor:pointer;"><i class="fa fa-square-o"></i></span> --></th>
<th>ID</th>
<th>名称</th>
<th>上级菜单</th>
<th>URL</th>
<th>来源标识</th>
<th>排序</th>
<th>菜单</th>
<th>状态</th>
<th>操作</th>
</tr>
</thead>
<tbody id="auth_rule_list">
</tbody>
</table>
<!-- 列表底部按钮 -->
<!--<div class="form-group">-->
<!-- </div>-->
<div class="paginations" id="pagediv">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
{layout name="global/frame_tpl" /}
<h4>权限管理</h4>
<h4>角色管理</h4>
<a href="/index/roleedit">添加角色</a>
......
......@@ -37,7 +37,7 @@
<a href="/admin.php/index/auth.html">角色管理</a>
</li>
<li role="presentation">
<a href="/admin.php/index/authList.html">权限管理</a>
<a href="/admin.php/index/authRuleIndex.html">权限管理</a>
</li>
<li role="presentation">
<a href="/admin.php/index/houseList.html">商铺列表</a>
......
......@@ -27,7 +27,18 @@ class AuthRule extends Model
*
*
*/
public function authList($p = 1, $pageSize = 20, $order_ = '', $field = '',$join='', $where = ''){
/**
* 记录总数
*
* @param $params
* @return int|string
*/
public function getTotal($params)
{
return $this->where($params)->count();
}
public function authRuleList($p = 1, $pageSize = 20, $order_ = '', $field = '',$join='', $where = ''){
$data = $this->field($field)
->alias('a')
->join($join)
......
......@@ -82,7 +82,8 @@ Route::group('index', [
'addAuth' => ['index/auth/addAuth', ['method' => 'post']], //添加角色
'accessLook'=>['index/auth/accessLook', ['method' => 'post']], //查看编辑角色权限
'setStatus'=>['index/auth/setStatus', ['method' => 'post']], //设置角色的状态
'authList'=>['index/auth/authList', ['method' => 'get']], //权限列表
'authRuleIndex'=>['index/auth/authRuleIndex', ['method' => 'get']], //权限列表界面
'authRuleList'=>['index/auth/authRuleList', ['method' => 'get']], //权限列表
'accessUser' => ['index/auth/accessUser', ['method' => 'get']], //成员授权
'BusinessDistrict' => ['index/BusinessDistrict/index', ['method' => 'get']], //商圈列表
'editBusinessDistrict' => ['index/BusinessDistrict/edit', ['method' => 'get | post']], //编辑商圈
......
define (['doT', 'text!temp/auth_rule_index_template_tpl.html', 'css!style/home.css','pagination','bootstrapJs'], function (doT, template) {
authRule={
pageNo:1,
pageSize:15,
init:function () {
//初始化dot
$("body").append(template);
authRule.getList();
authRule.event();
},
event:function () {
},
getList:function(pageNo){
authRule.pageNo =pageNo;
var params ={};
params.pageNo =authRule.pageNo;
params.pageSize=authRule.pageSize;
$.ajax({
url: '/index/AuthRulelist.html',
type: 'GET',
async: true,
data: params,
dataType: 'json',
success: function (data) {
var temp=document.getElementById('auth_rule_index_tpl').innerHTML;
var doTempl=doT.template(temp);
$("#auth_rule_list").html(doTempl(data.data.list));
/*分页代码*/
$ ("#pagediv").pagination ({
length: data.data.total,
current: pageNo,
every: authRule.pageSize,
onClick: function (el) {
authRule.getList (el.num.current);
}
});
}
})
}
}
return authRule;
});
\ No newline at end of file
<script id="auth_rule_index_tpl" type="text/template">
[% if(it) { %]
[% for(var item in it){ %]
<tr>
<td><div class="icheckbox_minimal-blue" style="position: relative;" aria-checked="false" aria-disabled="false">
<input type="checkbox" name="ids[]" value="1" class="ids" style="">
<ins class="iCheck-helper " style="">
</ins>
</div>
</td>
<td>[%= it[item]["id"] %]</td>
<td>[%= it[item]["title"] %]</td>
<td>[%= it[item]["name2"] %]</td>
<td>[%= it[item]["depend_flag"] %]</td>
<td>[%= it[item]["sort"] %]</td>
<td>[%= it[item]["is_menu"] %]</td>
<td>[%= it[item]["status"] %]</td>
<td><span class="fa fa-check text-success"></span></td>
<td>
<a style="margin-right:6px;" href="" class="btn btn-primary btn-xs" title="编辑">编辑</a>
<a style="margin-right:6px;" href="" class="btn btn-warning btn-xs ajax-get confirm" title="禁用">禁用</a>
</td>
</tr>
[% } %]
[% }else{ %]
<tr>
<td colspan="8" style="text-align:center;"> 暂无数据</td>
</tr>
[% } %]
</script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment