Ver código fonte

修复表格dropdown被遮挡的BUG

优化表格
优化动态显示组件
Karson 3 anos atrás
pai
commit
f700dbcdc7

+ 1 - 1
application/admin/command/Install/fastadmin.sql

@@ -187,7 +187,7 @@ CREATE TABLE `fa_auth_rule` (
 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 (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 (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');

+ 1 - 1
application/admin/view/addon/config.html

@@ -29,7 +29,7 @@
                         <tbody>
                         {foreach name="$addon.config" id="item"}
                         {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>
                                 <div class="row">

+ 1 - 1
application/admin/view/addon/index.html

@@ -93,7 +93,7 @@
                         <a class="btn btn-primary btn-userinfo btn-mini-xs" href="javascript:;"><i class="fa fa-user"></i> {:__('Userinfo')}</a>
                         {/if}
                     </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>
 

+ 4 - 4
application/admin/view/auth/admin/index.html

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

+ 4 - 4
application/admin/view/auth/adminlog/index.html

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

+ 3 - 3
application/admin/view/auth/group/index.html

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

+ 3 - 3
application/admin/view/category/index.html

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

+ 1 - 1
application/admin/view/general/attachment/select.html

@@ -36,7 +36,7 @@
                         <a class="btn btn-danger btn-choose-multi"><i class="fa fa-check"></i> {:__('Choose')}</a>
                         {/if}
                     </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>
                 </div>

+ 1 - 1
application/admin/view/general/config/index.html

@@ -67,7 +67,7 @@
                             </thead>
                             <tbody>
                             {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>
                                     <div class="row">

+ 1 - 1
application/admin/view/general/profile/index.html

@@ -100,7 +100,7 @@
                             <div id="toolbar" class="toolbar">
                                 {:build_toolbar('refresh')}
                             </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>
 

+ 3 - 3
application/admin/view/user/group/index.html

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

+ 3 - 3
application/admin/view/user/rule/index.html

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

+ 11 - 8
public/assets/js/backend/auth/adminlog.js

@@ -18,9 +18,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             // 初始化表格
             table.bootstrapTable({
                 url: $.fn.bootstrapTable.defaults.extend.index_url,
+                fixedColumns: true,
+                fixedRightNumber: 1,
                 columns: [
                     [
-                        {field: 'state', checkbox: true, },
+                        {field: 'state', checkbox: true,},
                         {field: 'id', title: 'ID', operate: false},
                         {field: 'username', title: __('Username'), formatter: Table.api.formatter.search},
                         {field: 'title', title: __('Title'), operate: 'LIKE %...%', placeholder: '模糊搜索'},
@@ -28,15 +30,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {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: '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,
                             buttons: [{
-                                    name: 'detail',
-                                    text: __('Detail'),
-                                    icon: 'fa fa-list',
-                                    classname: 'btn btn-info btn-xs btn-detail btn-dialog',
-                                    url: 'auth/adminlog/detail'
-                                }],
+                                name: 'detail',
+                                text: __('Detail'),
+                                icon: 'fa fa-list',
+                                classname: 'btn btn-info btn-xs btn-detail btn-dialog',
+                                url: 'auth/adminlog/detail'
+                            }],
                             formatter: Table.api.formatter.operate
                         }
                     ]

+ 5 - 8
public/assets/js/require-table.js

@@ -509,16 +509,13 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
                         var btnGroup = $(this);
                         var isPullRight = dropdownMenu.hasClass("pull-right") || dropdownMenu.hasClass("dropdown-menu-right");
                         var left, top, position;
-                        if (dropdownMenu.outerHeight() + btnGroup.outerHeight() > tableBody.outerHeight() - 41) {
+                        if (true || dropdownMenu.outerHeight() + btnGroup.outerHeight() > tableBody.outerHeight() - 41) {
                             position = 'fixed';
                             top = btnGroup.offset().top - $(window).scrollTop() + btnGroup.outerHeight();
-                            left = isPullRight ? btnGroup.offset().left + btnGroup.outerWidth() - dropdownMenu.outerWidth() : btnGroup.offset().left;
-                        } else {
-                            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);
+                            if ((top + dropdownMenu.outerHeight()) > $(window).height()) {
+                                top = btnGroup.offset().top - dropdownMenu.outerHeight() - 5;
                             }
+                            left = isPullRight ? btnGroup.offset().left + btnGroup.outerWidth() - dropdownMenu.outerWidth() : btnGroup.offset().left;
                         }
                         if (left || top) {
                             dropdownMenu.css({
@@ -878,7 +875,7 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
                         dropdown = j.dropdown ? j.dropdown : '';
                         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:;');
-                        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 : '';
                         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;