mirror of https://gitee.com/karson/fastadmin.git
parent
e2772b164b
commit
cd37a9e7e4
|
|
@ -31,7 +31,7 @@ class Rule extends Backend
|
|||
}
|
||||
$this->model = model('AuthRule');
|
||||
// 必须将结果集转换为数组
|
||||
$ruleList = collection($this->model->field('condition,remark,createtime,updatetime', true)->order('weigh DESC,id ASC')->select())->toArray();
|
||||
$ruleList = \think\Db::name("auth_rule")->field('type,condition,remark,createtime,updatetime', true)->order('weigh DESC,id ASC')->select();
|
||||
foreach ($ruleList as $k => &$v) {
|
||||
$v['title'] = __($v['title']);
|
||||
}
|
||||
|
|
@ -44,6 +44,7 @@ class Rule extends Backend
|
|||
continue;
|
||||
}
|
||||
$ruledata[$v['id']] = $v['title'];
|
||||
unset($v['spacer']);
|
||||
}
|
||||
unset($v);
|
||||
$this->view->assign('ruledata', $ruledata);
|
||||
|
|
@ -57,7 +58,6 @@ class Rule extends Backend
|
|||
if ($this->request->isAjax()) {
|
||||
$list = $this->rulelist;
|
||||
$total = count($this->rulelist);
|
||||
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
|
|
|
|||
|
|
@ -24,21 +24,21 @@
|
|||
<div class="navbar-custom-menu">
|
||||
<ul class="nav navbar-nav">
|
||||
|
||||
<li>
|
||||
<a href="__PUBLIC__" target="_blank"><i class="fa fa-home" style="font-size:14px;"></i></a>
|
||||
<li class="hidden-xs">
|
||||
<a href="__PUBLIC__" target="_blank"><i class="fa fa-home" style="font-size:14px;"></i> {:__('Home')}</a>
|
||||
</li>
|
||||
|
||||
<!-- 清除缓存 -->
|
||||
<li>
|
||||
<li class="hidden-xs">
|
||||
<a href="javascript:;" data-toggle="dropdown" title="{:__('Wipe cache')}">
|
||||
<i class="fa fa-trash"></i>
|
||||
<i class="fa fa-trash"></i> {:__('Wipe cache')}
|
||||
</a>
|
||||
<ul class="dropdown-menu wipecache">
|
||||
<li><a href="javascript:;" data-type="all"><i class="fa fa-trash"></i> {:__('Wipe all cache')}</a></li>
|
||||
<li><a href="javascript:;" data-type="all"><i class="fa fa-trash fa-fw"></i> {:__('Wipe all cache')}</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="javascript:;" data-type="content"><i class="fa fa-file-text"></i> {:__('Wipe content cache')}</a></li>
|
||||
<li><a href="javascript:;" data-type="template"><i class="fa fa-file-image-o"></i> {:__('Wipe template cache')}</a></li>
|
||||
<li><a href="javascript:;" data-type="addons"><i class="fa fa-rocket"></i> {:__('Wipe addons cache')}</a></li>
|
||||
<li><a href="javascript:;" data-type="content"><i class="fa fa-file-text fa-fw"></i> {:__('Wipe content cache')}</a></li>
|
||||
<li><a href="javascript:;" data-type="template"><i class="fa fa-file-image-o fa-fw"></i> {:__('Wipe template cache')}</a></li>
|
||||
<li><a href="javascript:;" data-type="addons"><i class="fa fa-rocket fa-fw"></i> {:__('Wipe addons cache')}</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
|
@ -78,6 +78,16 @@
|
|||
<small>{$admin.logintime|date="Y-m-d H:i:s",###}</small>
|
||||
</p>
|
||||
</li>
|
||||
<li class="user-body">
|
||||
<div class="visible-xs">
|
||||
<div class="pull-left">
|
||||
<a href="__PUBLIC__" target="_blank"><i class="fa fa-home" style="font-size:14px;"></i> {:__('Home')}</a>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<a href="javascript:;" data-type="all" class="wipecache"><i class="fa fa-trash fa-fw"></i> {:__('Wipe all cache')}</a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<!-- Menu Footer-->
|
||||
<li class="user-footer">
|
||||
<div class="pull-left">
|
||||
|
|
|
|||
|
|
@ -55,58 +55,67 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
|
|||
pagination: false,
|
||||
search: false,
|
||||
commonSearch: false,
|
||||
rowAttributes: function (row, index) {
|
||||
if (this.totalRows > 500) {
|
||||
return row.pid == 0 ? {} : {style: "display:none"};
|
||||
}
|
||||
return row.haschild == 1 || row.ismenu == 1 ? {} : {style: "display:none"};
|
||||
}
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
|
||||
var btnSuccessEvent = function (data, ret) {
|
||||
if ($(this).hasClass("btn-change")) {
|
||||
var index = $(this).data("index");
|
||||
var row = Table.api.getrowbyindex(table, index);
|
||||
row.ismenu = $("i.fa.text-gray", this).length > 0 ? 1 : 0;
|
||||
table.bootstrapTable("updateRow", {index: index, row: row});
|
||||
} else if ($(this).hasClass("btn-delone")) {
|
||||
if ($(this).closest("tr[data-index]").find("a.btn-node-sub.disabled").length > 0) {
|
||||
$(this).closest("tr[data-index]").remove();
|
||||
} else {
|
||||
table.bootstrapTable('refresh');
|
||||
}
|
||||
} else if ($(this).hasClass("btn-dragsort")) {
|
||||
table.bootstrapTable('refresh');
|
||||
}
|
||||
Fast.api.refreshmenu();
|
||||
return false;
|
||||
};
|
||||
|
||||
//表格内容渲染前
|
||||
table.on('pre-body.bs.table', function (e, data) {
|
||||
var options = table.bootstrapTable("getOptions");
|
||||
options.escape = true;
|
||||
});
|
||||
|
||||
//当内容渲染完成后
|
||||
table.on('post-body.bs.table', function (e, data) {
|
||||
var options = table.bootstrapTable("getOptions");
|
||||
options.escape = false;
|
||||
//默认隐藏所有子节点
|
||||
//$("a.btn[data-id][data-pid][data-pid!=0]").closest("tr").hide();
|
||||
$(".btn-node-sub.disabled").closest("tr").hide();
|
||||
|
||||
//显示隐藏子节点
|
||||
$(".btn-node-sub").off("click").on("click", function (e) {
|
||||
var status = $(this).data("shown") ? true : false;
|
||||
$("a.btn[data-pid='" + $(this).data("id") + "']").each(function () {
|
||||
$(this).closest("tr").toggle(!status);
|
||||
});
|
||||
$(this).data("shown", !status);
|
||||
return false;
|
||||
});
|
||||
//点击切换/排序/删除操作后刷新左侧菜单
|
||||
$(".btn-change[data-id],.btn-delone,.btn-dragsort").data("success", function (data, ret) {
|
||||
if ($(this).hasClass("btn-change")) {
|
||||
var index = $(this).data("index");
|
||||
var row = Table.api.getrowbyindex(table, index);
|
||||
row.ismenu = $("i.fa.text-gray", this).length > 0 ? 1 : 0;
|
||||
table.bootstrapTable("updateRow", {index: index, row: row});
|
||||
} else if ($(this).hasClass("btn-delone")) {
|
||||
if ($(this).closest("tr[data-index]").find("a.btn-node-sub.disabled").length > 0) {
|
||||
$(this).closest("tr[data-index]").remove();
|
||||
} else {
|
||||
table.bootstrapTable('refresh');
|
||||
}
|
||||
} else if ($(this).hasClass("btn-dragsort")) {
|
||||
table.bootstrapTable('refresh');
|
||||
}
|
||||
Fast.api.refreshmenu();
|
||||
return false;
|
||||
});
|
||||
$(".btn-change[data-id],.btn-delone,.btn-dragsort").data("success", btnSuccessEvent);
|
||||
|
||||
});
|
||||
|
||||
//显示隐藏子节点
|
||||
$(document).on("click", ".btn-node-sub", function (e) {
|
||||
var status = $(this).data("shown") ? true : false;
|
||||
$("a.btn[data-pid='" + $(this).data("id") + "']").each(function () {
|
||||
$(this).closest("tr").toggle(!status);
|
||||
});
|
||||
$(this).data("shown", !status);
|
||||
return false;
|
||||
});
|
||||
|
||||
//批量删除后的回调
|
||||
$(".toolbar > .btn-del,.toolbar .btn-more~ul>li>a").data("success", function (e) {
|
||||
Fast.api.refreshmenu();
|
||||
});
|
||||
|
||||
//展开隐藏一级
|
||||
$(document.body).on("click", ".btn-toggle", function (e) {
|
||||
$("a.btn[data-id][data-pid][data-pid!=0].disabled").closest("tr").hide();
|
||||
|
|
@ -117,6 +126,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
|
|||
$("a.btn[data-id][data-pid][data-pid!=0]").not('.disabled').closest("tr").toggle(show);
|
||||
$(".btn-node-sub[data-pid=0]").data("shown", show);
|
||||
});
|
||||
|
||||
//展开隐藏全部
|
||||
$(document.body).on("click", ".btn-toggle-all", function (e) {
|
||||
var that = this;
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'adminlte', 'form'], functi
|
|||
});
|
||||
|
||||
//清除缓存
|
||||
$(document).on('click', "ul.wipecache li a", function () {
|
||||
$(document).on('click', "ul.wipecache li a,.wipecache", function () {
|
||||
$.ajax({
|
||||
url: 'ajax/wipecache',
|
||||
dataType: 'json',
|
||||
|
|
|
|||
Loading…
Reference in New Issue