增加菜单选项卡

This commit is contained in:
邹景立 2021-04-12 11:54:51 +08:00
parent ee5850364a
commit 8a67ef217b
2 changed files with 74 additions and 59 deletions

View File

@ -46,7 +46,12 @@ class Menu extends Controller
public function index()
{
$this->title = '系统菜单管理';
$this->_page($this->table, false);
$query = $this->_query($this->table);
// 状态选项卡处理
$this->type = input('type', 'index');
if ($this->type === 'index') $query->where(['status' => 1]);
// 数据查询与分页
$query->page(false, true);
}
/**

View File

@ -11,63 +11,73 @@
{/block}
{block name="content"}
<div class="think-box-shadow">
{empty name='list'}
<blockquote class="layui-elem-quote">没 有 记 录 哦!</blockquote>
{else}
<table class="layui-table" lay-skin="line">
<thead>
<tr>
<th class='list-table-check-td think-checkbox'>
<label><input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
</th>
<th class='list-table-sort-td'>
<button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button>
</th>
<th class='text-center' style="width:30px"></th>
<th style="width:230px"></th>
<th class='layui-hide-xs' style="width:180px"></th>
<th colspan="2"></th>
</tr>
</thead>
<tbody>
{foreach $list as $key=>$vo}
<tr data-dbclick>
<td class='list-table-check-td think-checkbox'>
<label><input class="list-check-box" value='{$vo.ids}' type='checkbox'></label>
</td>
<td class='list-table-sort-td'>
<input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input">
</td>
<td class='text-center'><i class="{$vo.icon} font-s18"></i></td>
<td class="nowrap"><span class="color-desc">{$vo.spl|raw}</span>{$vo.title}</td>
<td class='layui-hide-xs'>{$vo.url}</td>
<td class='text-center nowrap'>{eq name='vo.status' value='0'}<span class="color-red">已禁用</span>{else}<span class="color-green">已激活</span>{/eq}</td>
<td class='text-center nowrap notselect'>
{if auth("add")}
<!--{if $vo.spt < 2}-->
<a class="layui-btn layui-btn-xs layui-btn-primary" data-title="添加子菜单" data-modal='{:url("add")}?pid={$vo.id}'>添 加</a>
<!--{else}-->
<a class="layui-btn layui-btn-xs layui-btn-disabled">添 加</a>
<!--{/if}-->
{/if}
<!--{if auth("edit")}-->
<a data-dbclick class="layui-btn layui-btn-xs" data-title="编辑菜单" data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
<!--{/if}-->
<!--{if $vo.status eq 1 and auth("state")}-->
<a class="layui-btn layui-btn-warm layui-btn-xs" data-confirm="确定要禁用菜单吗?" data-action="{:url('state')}" data-value="id#{$vo.ids};status#0" data-csrf="{:systoken('state')}">禁 用</a>
<!--{/if}-->
<!--{if $vo.status eq 0 and auth("state")}-->
<a class="layui-btn layui-btn-warm layui-btn-xs" data-action="{:url('state')}" data-value="id#{$vo.ids};status#1" data-csrf="{:systoken('state')}">激 活</a>
<!--{/if}-->
<!--{if auth("remove")}-->
<a class="layui-btn layui-btn-danger layui-btn-xs" data-confirm="确定要删除数据吗?" data-action="{:url('remove')}" data-value="id#{$vo.ids}" data-csrf="{:systoken('remove')}">删 除</a>
<!--{/if}-->
</td>
</tr>
{/foreach}
</tbody>
</table>
{/empty}
<div class="layui-tab layui-tab-card think-bg-white">
<ul class="layui-tab-title">
{foreach ['index'=>'当前菜单','recycle'=>'回 收 站'] as $k=>$v}
{if isset($type) and $type eq $k}
<li class="layui-this" data-open="{:url('index')}?type={$k}">{$v}</li>
{else}
<li data-open="{:url('index')}?type={$k}">{$v}</li>
{/if}{/foreach}
</ul>
<div class="layui-tab-content">
{empty name='list'}
<blockquote class="layui-elem-quote">没 有 记 录 哦!</blockquote>
{else}
<table class="layui-table" lay-skin="line">
<thead>
<tr>
<th class='list-table-check-td think-checkbox'>
<label><input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
</th>
<th class='list-table-sort-td'>
<button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button>
</th>
<th class='text-center' style="width:30px"></th>
<th style="width:230px"></th>
<th class='layui-hide-xs' style="width:180px"></th>
<th colspan="2"></th>
</tr>
</thead>
<tbody>
{foreach $list as $key=>$vo}
<tr data-dbclick>
<td class='list-table-check-td think-checkbox'>
<label><input class="list-check-box" value='{$vo.ids}' type='checkbox'></label>
</td>
<td class='list-table-sort-td'>
<input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input">
</td>
<td class='text-center'><i class="{$vo.icon} font-s18"></i></td>
<td class="nowrap"><span class="color-desc">{$vo.spl|raw}</span>{$vo.title}</td>
<td class='layui-hide-xs'>{$vo.url}</td>
<td class='text-center nowrap'>{eq name='vo.status' value='0'}<span class="color-red">已禁用</span>{else}<span class="color-green">已激活</span>{/eq}</td>
<td class='text-center nowrap notselect'>
{if auth("add")}
<!--{if $vo.spt < 2}-->
<a class="layui-btn layui-btn-xs layui-btn-primary" data-title="添加子菜单" data-modal='{:url("add")}?pid={$vo.id}'>添 加</a>
<!--{else}-->
<a class="layui-btn layui-btn-xs layui-btn-disabled">添 加</a>
<!--{/if}-->
{/if}
<!--{if auth("edit")}-->
<a data-dbclick class="layui-btn layui-btn-xs" data-title="编辑菜单" data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
<!--{/if}-->
<!--{if $vo.status eq 1 and auth("state")}-->
<a class="layui-btn layui-btn-warm layui-btn-xs" data-confirm="确定要禁用菜单吗?" data-action="{:url('state')}" data-value="id#{$vo.ids};status#0" data-csrf="{:systoken('state')}">禁 用</a>
<!--{/if}-->
<!--{if $vo.status eq 0 and auth("state")}-->
<a class="layui-btn layui-btn-warm layui-btn-xs" data-action="{:url('state')}" data-value="id#{$vo.ids};status#1" data-csrf="{:systoken('state')}">激 活</a>
<!--{/if}-->
<!--{if auth("remove")}-->
<a class="layui-btn layui-btn-danger layui-btn-xs" data-confirm="确定要删除数据吗?" data-action="{:url('remove')}" data-value="id#{$vo.ids}" data-csrf="{:systoken('remove')}">删 除</a>
<!--{/if}-->
</td>
</tr>
{/foreach}
</tbody>
</table>
{/empty}
</div>
</div>
{/block}