修复表格dropdown被遮挡的BUG

优化表格
优化动态显示组件
pull/382/head
Karson 2022-01-20 15:48:36 +08:00
parent c87a7f9f3c
commit f700dbcdc7
14 changed files with 42 additions and 42 deletions

View File

@ -187,7 +187,7 @@ CREATE TABLE `fa_auth_rule` (
BEGIN; BEGIN;
INSERT INTO `fa_auth_rule` VALUES (1, 'file', 0, 'dashboard', 'Dashboard', 'fa fa-dashboard', '', '', 'Dashboard tips', 1, NULL, '', 'kzt', 'kongzhitai', 1491635035, 1491635035, 143, 'normal'); INSERT INTO `fa_auth_rule` VALUES (1, 'file', 0, 'dashboard', 'Dashboard', 'fa fa-dashboard', '', '', 'Dashboard tips', 1, NULL, '', 'kzt', 'kongzhitai', 1491635035, 1491635035, 143, 'normal');
INSERT INTO `fa_auth_rule` VALUES (2, 'file', 0, 'general', 'General', 'fa fa-cogs', '', '', '', 1, NULL, '', 'cggl', 'changguiguanli', 1491635035, 1491635035, 137, 'normal'); INSERT INTO `fa_auth_rule` VALUES (2, 'file', 0, 'general', 'General', 'fa fa-cogs', '', '', '', 1, NULL, '', 'cggl', 'changguiguanli', 1491635035, 1491635035, 137, 'normal');
INSERT INTO `fa_auth_rule` VALUES (3, 'file', 0, 'category', 'Category', 'fa fa-leaf', '', '', 'Category tips', 1, NULL, '', 'flgl', 'fenleiguanli', 1491635035, 1491635035, 119, 'normal'); INSERT INTO `fa_auth_rule` VALUES (3, 'file', 0, 'category', 'Category', 'fa fa-leaf', '', '', 'Category tips', 0, NULL, '', 'flgl', 'fenleiguanli', 1491635035, 1491635035, 119, 'normal');
INSERT INTO `fa_auth_rule` VALUES (4, 'file', 0, 'addon', 'Addon', 'fa fa-rocket', '', '', 'Addon tips', 1, NULL, '', 'cjgl', 'chajianguanli', 1491635035, 1491635035, 0, 'normal'); INSERT INTO `fa_auth_rule` VALUES (4, 'file', 0, 'addon', 'Addon', 'fa fa-rocket', '', '', 'Addon tips', 1, NULL, '', 'cjgl', 'chajianguanli', 1491635035, 1491635035, 0, 'normal');
INSERT INTO `fa_auth_rule` VALUES (5, 'file', 0, 'auth', 'Auth', 'fa fa-group', '', '', '', 1, NULL, '', 'qxgl', 'quanxianguanli', 1491635035, 1491635035, 99, 'normal'); INSERT INTO `fa_auth_rule` VALUES (5, 'file', 0, 'auth', 'Auth', 'fa fa-group', '', '', '', 1, NULL, '', 'qxgl', 'quanxianguanli', 1491635035, 1491635035, 99, 'normal');
INSERT INTO `fa_auth_rule` VALUES (6, 'file', 2, 'general/config', 'Config', 'fa fa-cog', '', '', 'Config tips', 1, NULL, '', 'xtpz', 'xitongpeizhi', 1491635035, 1491635035, 60, 'normal'); INSERT INTO `fa_auth_rule` VALUES (6, 'file', 2, 'general/config', 'Config', 'fa fa-cog', '', '', 'Config tips', 1, NULL, '', 'xtpz', 'xitongpeizhi', 1491635035, 1491635035, 60, 'normal');

View File

@ -29,7 +29,7 @@
<tbody> <tbody>
{foreach name="$addon.config" id="item"} {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']==$groupName)}
<tr data-favisible="{$item.visible|default=''|htmlentities}" data-name="{$item.name}"> <tr data-favisible="{$item.visible|default=''|htmlentities}" data-name="{$item.name}" class="{if $item.visible??''}hidden{/if}">
<td width="15%">{$item.title}</td> <td width="15%">{$item.title}</td>
<td> <td>
<div class="row"> <div class="row">

View File

@ -93,7 +93,7 @@
<a class="btn btn-primary btn-userinfo btn-mini-xs" href="javascript:;"><i class="fa fa-user"></i> {:__('Userinfo')}</a> <a class="btn btn-primary btn-userinfo btn-mini-xs" href="javascript:;"><i class="fa fa-user"></i> {:__('Userinfo')}</a>
{/if} {/if}
</div> </div>
<table id="table" class="table table-striped table-bordered table-hover" width="100%"> <table id="table" class="table table-striped table-bordered table-hover table-nowrap" width="100%">
</table> </table>

View File

@ -8,7 +8,7 @@
<div id="toolbar" class="toolbar"> <div id="toolbar" class="toolbar">
{:build_toolbar('refresh,add,delete')} {:build_toolbar('refresh,add,delete')}
</div> </div>
<table id="table" class="table table-striped table-bordered table-hover" <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('auth/admin/edit')}" data-operate-edit="{:$auth->check('auth/admin/edit')}"
data-operate-del="{:$auth->check('auth/admin/del')}" data-operate-del="{:$auth->check('auth/admin/del')}"
width="100%"> width="100%">

View File

@ -8,7 +8,7 @@
<div id="toolbar" class="toolbar"> <div id="toolbar" class="toolbar">
{:build_toolbar('refresh,delete')} {:build_toolbar('refresh,delete')}
</div> </div>
<table id="table" class="table table-striped table-bordered table-hover" <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-detail="{:$auth->check('auth/adminlog/index')}" data-operate-detail="{:$auth->check('auth/adminlog/index')}"
data-operate-del="{:$auth->check('auth/adminlog/del')}" data-operate-del="{:$auth->check('auth/adminlog/del')}"
width="100%"> width="100%">

View File

@ -8,7 +8,7 @@
<div id="toolbar" class="toolbar"> <div id="toolbar" class="toolbar">
{:build_toolbar('refresh,add,delete')} {:build_toolbar('refresh,add,delete')}
</div> </div>
<table id="table" class="table table-striped table-bordered table-hover" <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('auth/group/edit')}" data-operate-edit="{:$auth->check('auth/group/edit')}"
data-operate-del="{:$auth->check('auth/group/del')}" data-operate-del="{:$auth->check('auth/group/del')}"
width="100%"> width="100%">

View File

@ -23,7 +23,7 @@
</ul> </ul>
</div> </div>
</div> </div>
<table id="table" class="table table-striped table-bordered table-hover" <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('category/edit')}" data-operate-edit="{:$auth->check('category/edit')}"
data-operate-del="{:$auth->check('category/del')}" data-operate-del="{:$auth->check('category/del')}"
width="100%"> width="100%">

View File

@ -36,7 +36,7 @@
<a class="btn btn-danger btn-choose-multi"><i class="fa fa-check"></i> {:__('Choose')}</a> <a class="btn btn-danger btn-choose-multi"><i class="fa fa-check"></i> {:__('Choose')}</a>
{/if} {/if}
</div> </div>
<table id="table" class="table table-bordered table-hover" width="100%"> <table id="table" class="table table-bordered table-hover table-nowrap" width="100%">
</table> </table>
</div> </div>

View File

@ -67,7 +67,7 @@
</thead> </thead>
<tbody> <tbody>
{foreach $vo.list as $item} {foreach $vo.list as $item}
<tr data-favisible="{$item.visible|default=''|htmlentities}" data-name="{$item.name}"> <tr data-favisible="{$item.visible|default=''|htmlentities}" data-name="{$item.name}" class="{if $item.visible??''}hidden{/if}">
<td>{$item.title}</td> <td>{$item.title}</td>
<td> <td>
<div class="row"> <div class="row">

View File

@ -100,7 +100,7 @@
<div id="toolbar" class="toolbar"> <div id="toolbar" class="toolbar">
{:build_toolbar('refresh')} {:build_toolbar('refresh')}
</div> </div>
<table id="table" class="table table-striped table-bordered table-hover" width="100%"> <table id="table" class="table table-striped table-bordered table-hover table-nowrap" width="100%">
</table> </table>

View File

@ -15,7 +15,7 @@
</ul> </ul>
</div> </div>
</div> </div>
<table id="table" class="table table-striped table-bordered table-hover" <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('user/group/edit')}" data-operate-edit="{:$auth->check('user/group/edit')}"
data-operate-del="{:$auth->check('user/group/del')}" data-operate-del="{:$auth->check('user/group/del')}"
width="100%"> width="100%">

View File

@ -15,7 +15,7 @@
</ul> </ul>
</div> </div>
</div> </div>
<table id="table" class="table table-striped table-bordered table-hover" <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('user/rule/edit')}" data-operate-edit="{:$auth->check('user/rule/edit')}"
data-operate-del="{:$auth->check('user/rule/del')}" data-operate-del="{:$auth->check('user/rule/del')}"
width="100%"> width="100%">

View File

@ -18,6 +18,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// 初始化表格 // 初始化表格
table.bootstrapTable({ table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url, url: $.fn.bootstrapTable.defaults.extend.index_url,
fixedColumns: true,
fixedRightNumber: 1,
columns: [ columns: [
[ [
{field: 'state', checkbox: true,}, {field: 'state', checkbox: true,},
@ -28,7 +30,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'ip', title: __('IP'), events: Table.api.events.ip, formatter: Table.api.formatter.search}, {field: 'ip', title: __('IP'), events: Table.api.events.ip, formatter: Table.api.formatter.search},
{field: 'browser', title: __('Browser'), operate: false, formatter: Controller.api.formatter.browser}, {field: 'browser', title: __('Browser'), operate: false, formatter: Controller.api.formatter.browser},
{field: 'createtime', title: __('Create time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true}, {field: 'createtime', title: __('Create time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
{field: 'operate', title: __('Operate'), table: table, {
field: 'operate', title: __('Operate'), table: table,
events: Table.api.events.operate, events: Table.api.events.operate,
buttons: [{ buttons: [{
name: 'detail', name: 'detail',

View File

@ -509,16 +509,13 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
var btnGroup = $(this); var btnGroup = $(this);
var isPullRight = dropdownMenu.hasClass("pull-right") || dropdownMenu.hasClass("dropdown-menu-right"); var isPullRight = dropdownMenu.hasClass("pull-right") || dropdownMenu.hasClass("dropdown-menu-right");
var left, top, position; var left, top, position;
if (dropdownMenu.outerHeight() + btnGroup.outerHeight() > tableBody.outerHeight() - 41) { if (true || dropdownMenu.outerHeight() + btnGroup.outerHeight() > tableBody.outerHeight() - 41) {
position = 'fixed'; position = 'fixed';
top = btnGroup.offset().top - $(window).scrollTop() + btnGroup.outerHeight(); top = btnGroup.offset().top - $(window).scrollTop() + btnGroup.outerHeight();
left = isPullRight ? btnGroup.offset().left + btnGroup.outerWidth() - dropdownMenu.outerWidth() : btnGroup.offset().left; if ((top + dropdownMenu.outerHeight()) > $(window).height()) {
} else { top = btnGroup.offset().top - dropdownMenu.outerHeight() - 5;
if (btnGroup.offset().top + btnGroup.outerHeight() + dropdownMenu.outerHeight() > tableBody.offset().top + tableBody.outerHeight() - 30) {
position = 'absolute';
left = isPullRight ? -(dropdownMenu.outerWidth() - btnGroup.outerWidth()) : 0;
top = -(dropdownMenu.outerHeight() + 3);
} }
left = isPullRight ? btnGroup.offset().left + btnGroup.outerWidth() - dropdownMenu.outerWidth() : btnGroup.offset().left;
} }
if (left || top) { if (left || top) {
dropdownMenu.css({ dropdownMenu.css({
@ -878,7 +875,7 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
dropdown = j.dropdown ? j.dropdown : ''; dropdown = j.dropdown ? j.dropdown : '';
url = j.url ? j.url : ''; url = j.url ? j.url : '';
url = typeof url === 'function' ? url.call(table, row, j) : (url ? Fast.api.fixurl(Table.api.replaceurl(url, row, table)) : 'javascript:;'); url = typeof url === 'function' ? url.call(table, row, j) : (url ? Fast.api.fixurl(Table.api.replaceurl(url, row, table)) : 'javascript:;');
classname = j.classname ? j.classname : 'btn-primary btn-' + name + 'one'; classname = j.classname ? j.classname : (dropdown ? 'btn-' + name + 'one' : 'btn-primary btn-' + name + 'one');
icon = j.icon ? j.icon : ''; icon = j.icon ? j.icon : '';
text = typeof j.text === 'function' ? j.text.call(table, row, j) : j.text ? j.text : ''; text = typeof j.text === 'function' ? j.text.call(table, row, j) : j.text ? j.text : '';
title = typeof j.title === 'function' ? j.title.call(table, row, j) : j.title ? j.title : text; title = typeof j.title === 'function' ? j.title.call(table, row, j) : j.title ? j.title : text;