fix(plugins): 网站管理两个子页面工具栏对齐用户管理标准
将「导航管理」与「导航分类管理」两个表格页的操作区对齐后台通用风格
(仅改插件内文件,framework 不动):
- 把"新增"按钮从查询表单移出,改为表格 toolbar(带 authorize 权限判断),
与用户管理一致置于表头左侧
- 表格补齐 defaultToolbar:刷新 / 筛选列 / 打印 / 导出(刷新走 window.refresh 重载)
- 查询表单仅保留查询 + 重置按钮
- 新增 table.on('toolbar') 处理 add/refresh 事件,新增/刷新统一为
window.add / window.refresh
验证:本地起服务用 Playwright 真实浏览器登录 admin 渲染,确认两页均生成
.layui-table-tool(含新增按钮)与默认工具栏(4 个图标),数据与操作不受影响。
This commit is contained in:
@@ -20,9 +20,6 @@
|
||||
<button type="reset" class="layui-btn layui-btn-primary layui-btn-md">
|
||||
<i class="layui-icon layui-icon-refresh"></i> 重置
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-md" id="btn-add">
|
||||
<i class="layui-icon layui-icon-add-1"></i> 新增分类
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -35,6 +32,16 @@
|
||||
</div>
|
||||
|
||||
{% include 'system/common/footer.html' %}
|
||||
{# 表格工具栏 #}
|
||||
<script type="text/html" id="cat-toolbar">
|
||||
{% if authorize("system:nav-category:add") %}
|
||||
<button class="layui-btn layui-btn-primary layui-btn-sm" lay-event="add">
|
||||
<i class="pear-icon pear-icon-add"></i>
|
||||
新增
|
||||
</button>
|
||||
{% endif %}
|
||||
</script>
|
||||
|
||||
{% raw %}
|
||||
<script type="text/html" id="col-cat-status">
|
||||
{{# if(d.enable === 1){ }}
|
||||
@@ -70,6 +77,8 @@ layui.use(['table', 'form', 'layer'], function(){
|
||||
where: { keyword: keyword },
|
||||
page: true,
|
||||
limit: 20,
|
||||
toolbar: '#cat-toolbar', /*工具栏*/
|
||||
defaultToolbar: [{layEvent: 'refresh', icon: 'layui-icon-refresh'}, 'filter', 'print', 'exports'] /*默认工具栏*/,
|
||||
cols: [[
|
||||
{field: 'id', title: 'ID', width: 60},
|
||||
{field: 'name', title: '分类名', width: 150},
|
||||
@@ -92,14 +101,26 @@ layui.use(['table', 'form', 'layer'], function(){
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#btn-add').on('click', function(){
|
||||
table.on('toolbar(cat-table)', function (obj) {
|
||||
if (obj.event === 'add') {
|
||||
window.add();
|
||||
} else if (obj.event === 'refresh') {
|
||||
window.refresh();
|
||||
}
|
||||
});
|
||||
|
||||
window.add = function () {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '新增导航分类',
|
||||
area: ['520px', '520px'],
|
||||
content: '/system/nav-category/add'
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
window.refresh = function () {
|
||||
renderTable();
|
||||
};
|
||||
|
||||
table.on('tool(cat-table)', function(obj){
|
||||
var data = obj.data;
|
||||
|
||||
@@ -24,9 +24,6 @@
|
||||
<button type="reset" class="layui-btn layui-btn-primary layui-btn-md">
|
||||
<i class="layui-icon layui-icon-refresh"></i> 重置
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-md" id="btn-add">
|
||||
<i class="layui-icon layui-icon-add-1"></i> 新增导航
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -39,6 +36,16 @@
|
||||
</div>
|
||||
|
||||
{% include 'system/common/footer.html' %}
|
||||
{# 表格工具栏 #}
|
||||
<script type="text/html" id="nav-toolbar">
|
||||
{% if authorize("system:nav:add") %}
|
||||
<button class="layui-btn layui-btn-primary layui-btn-sm" lay-event="add">
|
||||
<i class="pear-icon pear-icon-add"></i>
|
||||
新增
|
||||
</button>
|
||||
{% endif %}
|
||||
</script>
|
||||
|
||||
{% raw %}
|
||||
<script type="text/html" id="col-status">
|
||||
{{# if(d.enable === 1){ }}
|
||||
@@ -83,6 +90,8 @@ layui.use(['table', 'form', 'layer'], function(){
|
||||
where: { keyword: keyword, category: category },
|
||||
page: true,
|
||||
limit: 20,
|
||||
toolbar: '#nav-toolbar', /*工具栏*/
|
||||
defaultToolbar: [{layEvent: 'refresh', icon: 'layui-icon-refresh'}, 'filter', 'print', 'exports'] /*默认工具栏*/,
|
||||
cols: [[
|
||||
{field: 'id', title: 'ID', width: 60},
|
||||
{field: 'category', title: '分类', width: 120},
|
||||
@@ -108,14 +117,26 @@ layui.use(['table', 'form', 'layer'], function(){
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#btn-add').on('click', function(){
|
||||
table.on('toolbar(nav-table)', function (obj) {
|
||||
if (obj.event === 'add') {
|
||||
window.add();
|
||||
} else if (obj.event === 'refresh') {
|
||||
window.refresh();
|
||||
}
|
||||
});
|
||||
|
||||
window.add = function () {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '新增导航',
|
||||
area: ['640px', '620px'],
|
||||
content: '/system/nav/add'
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
window.refresh = function () {
|
||||
renderTable();
|
||||
};
|
||||
|
||||
table.on('tool(nav-table)', function(obj){
|
||||
var data = obj.data;
|
||||
|
||||
Reference in New Issue
Block a user