From de8ea27542fd9c7317af634de1d72acbbeb0d336 Mon Sep 17 00:00:00 2001
From: Karson <karsonzhang@163.com>
Date: Sat, 26 May 2018 22:27:15 +0800
Subject: [PATCH] 新增按钮visible配置 修复commonsearch中兼容配置 修复安装数据库在启用严格模式下无法导入的BUG

---
 application/admin/command/Install/fastadmin.sql  | 24 ++++++++++++------------
 application/admin/view/index/login.html          |  1 +
 application/index/view/index/index.html          |  3 ++-
 application/index/view/layout/common.html        |  3 ++-
 application/index/view/layout/default.html       |  3 ++-
 public/assets/js/bootstrap-table-commonsearch.js |  4 ++--
 public/assets/js/require-backend.min.js          | 14 ++++++++------
 public/assets/js/require-table.js                |  6 +++++-
 8 files changed, 34 insertions(+), 24 deletions(-)

diff --git a/application/admin/command/Install/fastadmin.sql b/application/admin/command/Install/fastadmin.sql
index e2b048e..91bce68 100755
--- a/application/admin/command/Install/fastadmin.sql
+++ b/application/admin/command/Install/fastadmin.sql
@@ -4,7 +4,7 @@
  官网: https://www.fastadmin.net
  演示: https://demo.fastadmin.net
 
- Date: 2018年03月07日
+ Date: 2018年05月26日
 */
 
 SET FOREIGN_KEY_CHECKS = 0;
@@ -58,7 +58,7 @@ CREATE TABLE `fa_admin_log` (
   `createtime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '操作时间',
   PRIMARY KEY (`id`),
   KEY `name` (`username`)
-) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='管理员日志表';
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='管理员日志表';
 
 -- ----------------------------
 -- Table structure for fa_attachment
@@ -82,7 +82,7 @@ CREATE TABLE `fa_attachment` (
   `storage` varchar(100) NOT NULL DEFAULT 'local' COMMENT '存储位置',
   `sha1` varchar(40) NOT NULL DEFAULT '' COMMENT '文件 sha1编码',
   PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='附件表';
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='附件表';
 
 -- ----------------------------
 -- Records of fa_attachment
@@ -104,7 +104,7 @@ CREATE TABLE `fa_auth_group` (
   `updatetime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
   `status` varchar(30) NOT NULL DEFAULT '' COMMENT '状态',
   PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='分组表';
+) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='分组表';
 
 -- ----------------------------
 -- Records of fa_auth_group
@@ -127,7 +127,7 @@ CREATE TABLE `fa_auth_group_access` (
   UNIQUE KEY `uid_group_id` (`uid`,`group_id`),
   KEY `uid` (`uid`),
   KEY `group_id` (`group_id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='权限分组表';
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='权限分组表';
 
 -- ----------------------------
 -- Records of fa_auth_group_access
@@ -276,7 +276,7 @@ CREATE TABLE `fa_category` (
   PRIMARY KEY (`id`),
   KEY `weigh` (`weigh`,`id`),
   KEY `pid` (`pid`)
-) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='分类表';
+) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='分类表';
 
 -- ----------------------------
 -- Records of fa_category
@@ -314,7 +314,7 @@ CREATE TABLE `fa_config` (
   `extend` varchar(255) NOT NULL DEFAULT '' COMMENT '扩展属性',
   PRIMARY KEY (`id`),
   UNIQUE KEY `name` (`name`)
-) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8 COMMENT='系统配置';
+) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统配置';
 
 -- ----------------------------
 -- Records of fa_config
@@ -470,7 +470,7 @@ CREATE TABLE `fa_user_group` (
   `updatetime` int(10) DEFAULT NULL COMMENT '更新时间',
   `status` enum('normal','hidden') DEFAULT NULL COMMENT '状态',
   PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='会员组表';
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='会员组表';
 
 -- ----------------------------
 -- Records of fa_user_group
@@ -495,7 +495,7 @@ CREATE TABLE `fa_user_rule` (
   `weigh` int(10) DEFAULT '0' COMMENT '权重',
   `status` enum('normal','hidden') DEFAULT NULL COMMENT '状态',
   PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COMMENT='会员规则表';
+) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='会员规则表';
 
 -- ----------------------------
 -- Records of fa_user_rule
@@ -528,7 +528,7 @@ CREATE TABLE `fa_user_score_log` (
   `memo` varchar(255) NOT NULL DEFAULT '' COMMENT '备注',
   `createtime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
   PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='会员积分变动表';
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='会员积分变动表';
 
 -- ----------------------------
 -- Table structure for fa_user_token
@@ -540,7 +540,7 @@ CREATE TABLE `fa_user_token` (
   `createtime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
   `expiretime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '过期时间',
   PRIMARY KEY (`token`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='会员Token表';
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='会员Token表';
 
 -- ----------------------------
 -- Table structure for fa_version
@@ -559,7 +559,7 @@ CREATE TABLE `fa_version`  (
   `weigh` int(10) NOT NULL DEFAULT 0 COMMENT '权重',
   `status` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '状态',
   PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '版本表' ROW_FORMAT = Compact;
+) ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT = '版本表';
 
 -- ----------------------------
 -- Table structure for fa_version
diff --git a/application/admin/view/index/login.html b/application/admin/view/index/login.html
index 439dec8..1421375 100644
--- a/application/admin/view/index/login.html
+++ b/application/admin/view/index/login.html
@@ -97,6 +97,7 @@
                             </form>
                         </div>
                     </div>
+                    <!-- FastAdmin是开源程序,建议在您的网站底部保留一个FastAdmin的链接 -->
                     <p class="copyright"><a href="https://www.fastadmin.net">Powered By FastAdmin</a></p>
                 </div>
             </div>
diff --git a/application/index/view/index/index.html b/application/index/view/index/index.html
index 0ff5b96..e7dd931 100755
--- a/application/index/view/index/index.html
+++ b/application/index/view/index/index.html
@@ -145,7 +145,8 @@
 
         <footer>
             <div class="container">
-                <p>&copy; 2017 FastAdmin. All Rights Reserved.</p>
+                <!-- FastAdmin是开源程序,建议在您的网站底部保留一个FastAdmin的链接 -->
+                <p>&copy; 2017-2018 <a href="https://www.fastadmin.net" target="_blank">FastAdmin</a>. All Rights Reserved.</p>
                 <ul class="list-inline">
                     <li>
                         <a href="https://gitee.com/karson/fastadmin">{:__('Gitee')}</a>
diff --git a/application/index/view/layout/common.html b/application/index/view/layout/common.html
index 7c17705..f9f5171 100644
--- a/application/index/view/layout/common.html
+++ b/application/index/view/layout/common.html
@@ -71,7 +71,8 @@
 
         <footer>
             <div class="container">
-                <p>&copy; 2017 FastAdmin. All Rights Reserved.</p>
+                <!-- FastAdmin是开源程序,建议在您的网站底部保留一个FastAdmin的链接 -->
+                <p>&copy; 2017-2018 <a href="https://www.fastadmin.net" target="_blank">FastAdmin</a>. All Rights Reserved.</p>
                 <ul class="list-inline">
                     <li>
                         <a href="https://gitee.com/karson/fastadmin">{:__('Gitee')}</a>
diff --git a/application/index/view/layout/default.html b/application/index/view/layout/default.html
index 01c2205..92baa8a 100644
--- a/application/index/view/layout/default.html
+++ b/application/index/view/layout/default.html
@@ -59,7 +59,8 @@
         </main>
 
         <footer class="footer" style="clear:both">
-            <p class="copyright">Copyright&nbsp;©&nbsp;2017-2018 fastadmin.net All Rights Reserved {$site.name} {:__('Copyrights')} <a href="https://www.miibeian.gov.cn" target="_blank">{$site.beian}</a></p>
+            <!-- FastAdmin是开源程序,建议在您的网站底部保留一个FastAdmin的链接 -->
+            <p class="copyright">Copyright&nbsp;©&nbsp;2017-2018 Powered by <a href="https://www.fastadmin.net" target="_blank">FastAdmin</a> All Rights Reserved {$site.name} {:__('Copyrights')} <a href="https://www.miibeian.gov.cn" target="_blank">{$site.beian}</a></p>
         </footer>
 
         {include file="common/script" /}
diff --git a/public/assets/js/bootstrap-table-commonsearch.js b/public/assets/js/bootstrap-table-commonsearch.js
index 09699ff..66365a3 100644
--- a/public/assets/js/bootstrap-table-commonsearch.js
+++ b/public/assets/js/bootstrap-table-commonsearch.js
@@ -59,8 +59,8 @@
         for (var i in pColumns) {
             var vObjCol = pColumns[i];
             if (!vObjCol.checkbox && vObjCol.field !== 'operate' && vObjCol.searchable && vObjCol.operate !== false) {
-                var query = Backend.api.query(vObjCol.field);
-                var operate = Backend.api.query(vObjCol.field + "-operate");
+                var query = Fast.api.query(vObjCol.field);
+                var operate = Fast.api.query(vObjCol.field + "-operate");
 
                 vObjCol.defaultValue = that.options.renderDefault && query ? query : (typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue);
                 vObjCol.operate = that.options.renderDefault && operate ? operate : (typeof vObjCol.operate === 'undefined' ? '=' : vObjCol.operate);
diff --git a/public/assets/js/require-backend.min.js b/public/assets/js/require-backend.min.js
index 1565031..d25364a 100644
--- a/public/assets/js/require-backend.min.js
+++ b/public/assets/js/require-backend.min.js
@@ -8925,8 +8925,8 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undef
         for (var i in pColumns) {
             var vObjCol = pColumns[i];
             if (!vObjCol.checkbox && vObjCol.field !== 'operate' && vObjCol.searchable && vObjCol.operate !== false) {
-                var query = Backend.api.query(vObjCol.field);
-                var operate = Backend.api.query(vObjCol.field + "-operate");
+                var query = Fast.api.query(vObjCol.field);
+                var operate = Fast.api.query(vObjCol.field + "-operate");
 
                 vObjCol.defaultValue = that.options.renderDefault && query ? query : (typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue);
                 vObjCol.operate = that.options.renderDefault && operate ? operate : (typeof vObjCol.operate === 'undefined' ? '=' : vObjCol.operate);
@@ -9849,7 +9849,7 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
                 type = typeof type === 'undefined' ? 'buttons' : type;
                 var options = table ? table.bootstrapTable('getOptions') : {};
                 var html = [];
-                var hidden, url, classname, icon, text, title, refresh, confirm, extend;
+                var hidden, visible, url, classname, icon, text, title, refresh, confirm, extend;
                 var fieldIndex = column.fieldIndex;
 
                 $.each(buttons, function (i, j) {
@@ -9867,6 +9867,10 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
                         if (hidden) {
                             return true;
                         }
+                        visible = typeof j.visible === 'function' ? j.visible.call(table, row, j) : (j.visible ? j.visible : true);
+                        if (!visible) {
+                            return true;
+                        }
                         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';
@@ -10573,9 +10577,7 @@ define("drop", function(){});
         }
 
     };
-})(jQuery);
-
-
+})(jQuery);
 define("addtabs", function(){});
 
 /**
diff --git a/public/assets/js/require-table.js b/public/assets/js/require-table.js
index 5504265..9fcb096 100644
--- a/public/assets/js/require-table.js
+++ b/public/assets/js/require-table.js
@@ -507,7 +507,7 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
                 type = typeof type === 'undefined' ? 'buttons' : type;
                 var options = table ? table.bootstrapTable('getOptions') : {};
                 var html = [];
-                var hidden, url, classname, icon, text, title, refresh, confirm, extend;
+                var hidden, visible, url, classname, icon, text, title, refresh, confirm, extend;
                 var fieldIndex = column.fieldIndex;
 
                 $.each(buttons, function (i, j) {
@@ -525,6 +525,10 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
                         if (hidden) {
                             return true;
                         }
+                        visible = typeof j.visible === 'function' ? j.visible.call(table, row, j) : (j.visible ? j.visible : true);
+                        if (!visible) {
+                            return true;
+                        }
                         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';
--
libgit2 0.24.0