thinkphp-wechat/application/user/view/admin/index/access.html
Wenbin.Wang d49c9fde59 代码
2021-12-24 16:40:05 +08:00

176 lines
7.6 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{extend name="$_admin_base_layout" /}
{block name="plugins-css"}
<link href="__LIBS__/jstree/themes/default/style.min.css" rel="stylesheet" />
{/block}
{block name="content"}
{notempty name="page_tips"}
<div class="alert alert-{$tips_type|default='info'} alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<p>{$page_tips|raw|default=''}</p>
</div>
{/notempty}
<div class="row">
<div class="col-md-12">
<div class="block">
{notempty name="tab_nav.tab_list"}
<ul class="nav nav-tabs">
{volist name="tab_nav['tab_list']" id="vo"}
<li {eq name="tab_nav.curr_tab" value="$key"}class="active"{/eq}>
<a href="{$vo.url}">{$vo.title}</a>
</li>
{/volist}
<li class="pull-right">
<ul class="block-options push-10-t push-10-r">
<li>
<button type="button" data-toggle="block-option" data-action="fullscreen_toggle"></button>
</li>
<li>
<button type="button" data-toggle="block-option" data-action="refresh_toggle" data-action-mode="demo"><i class="si si-refresh"></i></button>
</li>
<li>
<button type="button" data-toggle="block-option" data-action="content_toggle"></button>
</li>
<li>
<button type="button" data-toggle="block-option" data-action="close"><i class="si si-close"></i></button>
</li>
</ul>
</li>
</ul>
{else/}
<div class="block-header bg-gray-lighter">
<ul class="block-options">
<li>
<button type="button" data-toggle="block-option" data-action="fullscreen_toggle"></button>
</li>
<li>
<button type="button" data-toggle="block-option" data-action="refresh_toggle" data-action-mode="demo"><i class="si si-refresh"></i></button>
</li>
<li>
<button type="button" data-toggle="block-option" data-action="content_toggle"></button>
</li>
<li>
<button type="button" data-toggle="block-option" data-action="close"><i class="si si-close"></i></button>
</li>
</ul>
<h3 class="block-title">{$page_title}</h3>
</div>
{/notempty}
<form name="form-builder" id="form" class="form-horizontal form-builder">
<input type="hidden" name="uid" value="{:input('param.uid', '')}">
<input type="hidden" name="tab_name" value="{$tab_name|default=''}">
<div class="block-content tab-content">
<div class="tab-pane fade in active push-20">
{notempty name="access"}
<div class="row data-table-toolbar">
<div class="col-sm-12">
<div class="toolbar-btn-action">
<button title="全选" type="button" class="btn btn-info" id="check-all"><i class="fa fa-check-circle-o"></i> 全选</button>
<button title="取消全选" type="button" class="btn btn-danger" id="uncheck-all"><i class="fa fa-ban"></i> 取消全选</button>
<button title="展开所有节点" type="button" class="btn btn-success" id="expand-all"><i class="fa fa-plus"></i> 展开所有节点</button>
<button title="收起所有节点" type="button" class="btn btn-warning" id="collapse-all"><i class="fa fa-minus"></i> 收起所有节点</button>
</div>
</div>
</div>
<div class="block block-bordered">
<ul class="nav nav-tabs">
{volist name="access" id="vo"}
<li {eq name="key" value="$tab"}class="active"{/eq}>
<a href="{$vo.url|default=''}">{$vo.title|default=''}</a>
</li>
{/volist}
</ul>
<div class="block-content tab-content">
<div class="tab-pane active" id="btabs-static-home">
<div id="jstree" class="push">{$nodes|raw|default=''}</div>
</div>
</div>
</div>
{else/}
<div class="form-empty">
<p class="text-center text-muted empty-info">
<i class="fa fa-database"></i> 暂无授权数据<br>
</p>
</div>
{/notempty}
</div>
<div class="push-20">
{notempty name="access"}
<button class="btn btn-minw btn-primary" type="submit">
确定
</button>
{/notempty}
<a class="btn btn-default" href="{:url('index')}">
返回
</a>
</div>
</div>
</form>
</div>
</div>
</div>
{/block}
{block name="script"}
<script src="__LIBS__/jstree/jstree.min.js"></script>
<script>
$(document).ready(function(){
$('#jstree').jstree({
plugins: ["checkbox", "search"],
"checkbox" : {
"keep_selected_style" : false,
"three_state" : false,
"cascade" : 'down+up'
},
"search" : {
'show_only_matches' : true,
'show_only_matches_children' : true
},
"core" : {
"themes" : {
'icons' : false
}
}
});
// 全选
$('#check-all').click(function () {
$('#jstree').jstree(true).check_all();
});
// 取消全选
$('#uncheck-all').click(function () {
$('#jstree').jstree(true).uncheck_all();
});
// 展开所有
$('#expand-all').click(function () {
$('#jstree').jstree(true).open_all();
});
// 收起所有
$('#collapse-all').click(function () {
$('#jstree').jstree(true).close_all();
});
// 提交表单
$('#form').submit(function () {
var nodes = $('#jstree').jstree(true).get_checked();
$.post('{:url("access", ["module" => $module, "uid" => $uid, "tag" => $tab])}', {nodes:nodes}).success(function (res) {
if (res.code) {
Dolphin.notify(res.msg, 'success');
setTimeout(function () {
location.href = res.url;
}, 1500);
} else {
Dolphin.notify(res.msg, 'danger');
}
}).fail(function () {
Dolphin.notify('服务器发生错误~', 'danger');
});
return false;
});
});
</script>
{/block}