优化插件配置分组

pull/382/head
Karson 2022-01-21 11:36:57 +08:00
parent 8b55020b3a
commit 2401cd3ba1
3 changed files with 16 additions and 7 deletions

View File

@ -8,12 +8,16 @@ return [
'title' => '用户名',
//类型
'type' => 'string',
//分组
'group' => '',
//动态显示
'visible' => '',
//数据字典
'content' => [
],
//值
'value' => '',
//验证规则
//验证规则
'rule' => 'required',
//错误消息
'msg' => '',

View File

@ -96,8 +96,13 @@ class Addon extends Backend
$tips = [];
$groupList = [];
foreach ($config as $index => &$item) {
//如果有设置分组
if (isset($item['group']) && $item['group']) {
if (!in_array($item['group'], $groupList)) {
$groupList["custom" . (count($groupList) + 1)] = $item['group'];
}
}
if ($item['name'] == '__tips__') {
$groupList = $item['content'] ? $item['content'] : [];
$tips = $item;
unset($config[$index]);
}

View File

@ -9,8 +9,8 @@
{/if}
<div class="panel panel-default panel-intro">
{if $groupList}
<div class="panel-heading">
{if count($groupList)>1}
<div class="panel-heading mb-3">
<ul class="nav nav-tabs nav-group">
<li class="active"><a href="#all" data-toggle="tab">全部</a></li>
{foreach name="groupList" id="tab"}
@ -20,15 +20,15 @@
</div>
{/if}
<div class="panel-body {if !$groupList}no-padding{/if}">
<div class="panel-body no-padding">
<div id="myTabContent" class="tab-content">
{foreach name="groupList" id="group" key="groupName"}
<div class="tab-pane fade active in" id="tab-{$groupName}">
<table class="table table-striped table-config">
<table class="table table-striped table-config mb-0">
<tbody>
{foreach name="$addon.config" id="item"}
{if ((!isset($item['group']) || $item['group']=='') && $groupName=='other') || (isset($item['group']) && $item['group']==$groupName)}
{if ((!isset($item['group']) || $item['group']=='') && $groupName=='other') || (isset($item['group']) && $item['group']==$group)}
<tr data-favisible="{$item.visible|default=''|htmlentities}" data-name="{$item.name}" class="{if $item.visible??''}hidden{/if}">
<td width="15%">{$item.title}</td>
<td>