rabin 2 years ago
parent
commit
aa53588cf0
3 changed files with 21 additions and 11 deletions
  1. 10 4
      assets/layadmin/html/project/database/list.html
  2. 6 2
      database/admin.php
  3. 5 5
      src/Database.php

+ 10 - 4
assets/layadmin/html/project/database/list.html

@@ -140,7 +140,7 @@
         <div id="table_2"> 
           <div id="chart" class="chart"></div>
           <table class="table layui-table layui-table-body" id="table">
-          <thead id="list-thead">
+          <thead id="list-thead" class="table-header-fixed">
               <tr>
                   <th>Company</th>
               </tr>
@@ -209,10 +209,16 @@
       });
     } else {
       $('#page').show();
+      var count = $('#list-tbody tr').length;
+      let headerTop = $('#list-thead').offset().top; //获取表格头到文档顶部的距离
+      $(window).scroll(function () {
+         if (count > 3 && (headerTop - $(window).scrollTop()) < 0) { //超过了
+             //$('#list-thead').addClass('table-header-fixed'); //添加样式,固定住表头
+         } else { //没超过
+             //$('#list-thead').removeClass('table-header-fixed'); //移除样式
+         }
+      });
     }
-    
-    
-
     init();
 
     if ($('.dever-manage').length) {

+ 6 - 2
database/admin.php

@@ -210,9 +210,13 @@ return array
 			'match' 	=> Dever::rule('email'),
 			'update'	=> 'text',
 			/*
+			* search_order:检索排序
+			* search_style:检索样式
 			* 列表页搜索选项,这里的search或者update的值为
 			* fulltext:全文检索,模糊匹配
 			* text:精确匹配
+			* day:按照日期检索
+			* date:按照具体时间检索
 			* exp:大小判断,仅能选择一项
 			* select:选择器,需要option项
 			* group:组选择器,需要option项
@@ -567,8 +571,8 @@ return array
 
 	'manage' => array
 	(
-		# 表格使用html模式,默认是js渲染模式
-        //'list_table' => 'html',
+		# 表格使用js模式,默认是html渲染模式
+        //'list_table' => 'js',
 
 		'delete' => false,
 		// 载入自定义资源

+ 5 - 5
src/Database.php

@@ -1010,7 +1010,7 @@ class Database
         }
 
         # 增加下载报表按钮
-        if (isset($config['manage']['excel'])) {
+        if (isset($config['manage']['excel']) && $config['manage']['excel']) {
             $url = $this->url('excel');
             if (is_array($config['manage']['excel'])) {
                 foreach ($config['manage']['excel'] as $k => $v) {
@@ -1566,11 +1566,11 @@ class Database
         $config = $this->config();
 
         if ($type == 'layui') {
-            if (isset($config['manage']['list_table'])) {
+            if (!isset($config['manage']['list_table']) || (isset($config['manage']['list_table']) && $config['manage']['list_table'] == 'html')) {
                 return false;
             }
         } else {
-            if (!isset($config['manage']['list_table'])) {
+            if (isset($config['manage']['list_table']) && $config['manage']['list_table'] == 'js') {
                 return '';
             }
         }
@@ -2234,11 +2234,11 @@ class Database
 
         if (!$excel) {
             if ($type == 'layui') {
-                if (isset($config['manage']['list_table'])) {
+                if (!isset($config['manage']['list_table']) || (isset($config['manage']['list_table']) && $config['manage']['list_table'] == 'html')) {
                     return array();
                 }
             } else {
-                if (!isset($config['manage']['list_table'])) {
+                if (isset($config['manage']['list_table']) && $config['manage']['list_table'] == 'js') {
                     return '';
                 }
             }