mirror of https://gitee.com/karson/fastadmin.git
parent
e2772b164b
commit
cd37a9e7e4
|
|
@ -31,7 +31,7 @@ class Rule extends Backend
|
||||||
}
|
}
|
||||||
$this->model = model('AuthRule');
|
$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) {
|
foreach ($ruleList as $k => &$v) {
|
||||||
$v['title'] = __($v['title']);
|
$v['title'] = __($v['title']);
|
||||||
}
|
}
|
||||||
|
|
@ -44,6 +44,7 @@ class Rule extends Backend
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$ruledata[$v['id']] = $v['title'];
|
$ruledata[$v['id']] = $v['title'];
|
||||||
|
unset($v['spacer']);
|
||||||
}
|
}
|
||||||
unset($v);
|
unset($v);
|
||||||
$this->view->assign('ruledata', $ruledata);
|
$this->view->assign('ruledata', $ruledata);
|
||||||
|
|
@ -57,7 +58,6 @@ class Rule extends Backend
|
||||||
if ($this->request->isAjax()) {
|
if ($this->request->isAjax()) {
|
||||||
$list = $this->rulelist;
|
$list = $this->rulelist;
|
||||||
$total = count($this->rulelist);
|
$total = count($this->rulelist);
|
||||||
|
|
||||||
$result = array("total" => $total, "rows" => $list);
|
$result = array("total" => $total, "rows" => $list);
|
||||||
|
|
||||||
return json($result);
|
return json($result);
|
||||||
|
|
|
||||||
|
|
@ -24,21 +24,21 @@
|
||||||
<div class="navbar-custom-menu">
|
<div class="navbar-custom-menu">
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
|
|
||||||
<li>
|
<li class="hidden-xs">
|
||||||
<a href="__PUBLIC__" target="_blank"><i class="fa fa-home" style="font-size:14px;"></i></a>
|
<a href="__PUBLIC__" target="_blank"><i class="fa fa-home" style="font-size:14px;"></i> {:__('Home')}</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<!-- 清除缓存 -->
|
<!-- 清除缓存 -->
|
||||||
<li>
|
<li class="hidden-xs">
|
||||||
<a href="javascript:;" data-toggle="dropdown" title="{:__('Wipe cache')}">
|
<a href="javascript:;" data-toggle="dropdown" title="{:__('Wipe cache')}">
|
||||||
<i class="fa fa-trash"></i>
|
<i class="fa fa-trash"></i> {:__('Wipe cache')}
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu wipecache">
|
<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 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="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"></i> {:__('Wipe template 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"></i> {:__('Wipe addons cache')}</a></li>
|
<li><a href="javascript:;" data-type="addons"><i class="fa fa-rocket fa-fw"></i> {:__('Wipe addons cache')}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
@ -78,6 +78,16 @@
|
||||||
<small>{$admin.logintime|date="Y-m-d H:i:s",###}</small>
|
<small>{$admin.logintime|date="Y-m-d H:i:s",###}</small>
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</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-->
|
<!-- Menu Footer-->
|
||||||
<li class="user-footer">
|
<li class="user-footer">
|
||||||
<div class="pull-left">
|
<div class="pull-left">
|
||||||
|
|
|
||||||
|
|
@ -55,58 +55,67 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
|
||||||
pagination: false,
|
pagination: false,
|
||||||
search: false,
|
search: false,
|
||||||
commonSearch: 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);
|
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) {
|
table.on('pre-body.bs.table', function (e, data) {
|
||||||
var options = table.bootstrapTable("getOptions");
|
var options = table.bootstrapTable("getOptions");
|
||||||
options.escape = true;
|
options.escape = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
//当内容渲染完成后
|
//当内容渲染完成后
|
||||||
table.on('post-body.bs.table', function (e, data) {
|
table.on('post-body.bs.table', function (e, data) {
|
||||||
var options = table.bootstrapTable("getOptions");
|
var options = table.bootstrapTable("getOptions");
|
||||||
options.escape = false;
|
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) {
|
$(".btn-change[data-id],.btn-delone,.btn-dragsort").data("success", btnSuccessEvent);
|
||||||
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;
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//显示隐藏子节点
|
||||||
|
$(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) {
|
$(".toolbar > .btn-del,.toolbar .btn-more~ul>li>a").data("success", function (e) {
|
||||||
Fast.api.refreshmenu();
|
Fast.api.refreshmenu();
|
||||||
});
|
});
|
||||||
|
|
||||||
//展开隐藏一级
|
//展开隐藏一级
|
||||||
$(document.body).on("click", ".btn-toggle", function (e) {
|
$(document.body).on("click", ".btn-toggle", function (e) {
|
||||||
$("a.btn[data-id][data-pid][data-pid!=0].disabled").closest("tr").hide();
|
$("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);
|
$("a.btn[data-id][data-pid][data-pid!=0]").not('.disabled').closest("tr").toggle(show);
|
||||||
$(".btn-node-sub[data-pid=0]").data("shown", show);
|
$(".btn-node-sub[data-pid=0]").data("shown", show);
|
||||||
});
|
});
|
||||||
|
|
||||||
//展开隐藏全部
|
//展开隐藏全部
|
||||||
$(document.body).on("click", ".btn-toggle-all", function (e) {
|
$(document.body).on("click", ".btn-toggle-all", function (e) {
|
||||||
var that = this;
|
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({
|
$.ajax({
|
||||||
url: 'ajax/wipecache',
|
url: 'ajax/wipecache',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue