rabin 3 yıl önce
ebeveyn
işleme
4ba219ab4d
1 değiştirilmiş dosya ile 27 ekleme ve 37 silme
  1. 27 37
      src/Database.php

+ 27 - 37
src/Database.php

@@ -79,6 +79,13 @@ class Database
      */
     private $info = array();
 
+    /**
+     * state
+     *
+     * @var array
+     */
+    private $state = false;
+
     /**
      * __construct
      *
@@ -1130,7 +1137,7 @@ class Database
         }
 
         # 增加主动统计按钮
-        if (isset($config['manage']['stat'])) {
+        if ($this->state && isset($config['manage']['stat'])) {
             $name = '数据统计';
             if (is_string($config['manage']['stat'])) {
                 $name = $config['manage']['stat'];
@@ -1143,7 +1150,7 @@ class Database
         }
 
         # 增加下载报表按钮
-        if (isset($config['manage']['excel']) && $config['manage']['excel']) {
+        if ($this->state && isset($config['manage']['excel']) && $config['manage']['excel']) {
             $url = $this->url('excel');
             if (is_array($config['manage']['excel'])) {
                 foreach ($config['manage']['excel'] as $k => $v) {
@@ -1354,7 +1361,7 @@ class Database
         $result = '';
 
         # 搜索
-        if (isset($config['struct']) && isset($config['manage']['search'])) {
+        if (isset($config['struct']) && isset($config['manage']['search']) && $config['manage']['search']) {
             $search = Dever::preInput('search_');
 
             $node = Html::node(array(' style="margin-top:0px;"', ''));
@@ -1667,8 +1674,6 @@ class Database
             */
         }
 
-        //print_r($result);die;
-
         $oper = Dever::preInput('oper_');
         if ($oper) {
             foreach ($oper as $k => $v) {
@@ -1773,9 +1778,12 @@ class Database
 
         $result = array();
 
-        if (!Dever::load('manage/database.list_tbody')) {
+        /*
+        $tbody = Dever::load('manage/database.list_tbody');
+        if (!$tbody) {
             return $result;
         }
+        */
 
         if (isset($config['struct'])) {
             if (isset($config['manage']['list']) && $config['manage']['list'] == 'update') {
@@ -1921,6 +1929,7 @@ class Database
     }
 
     # layui表头
+    /*
     public function list_thead_layui()
     {
         $html = 'config.table = {};config.table.cols = [];';
@@ -1949,6 +1958,7 @@ class Database
         $html .= 'config.table.data = ' . $data;
         return $html;
     }
+    */
 
     /**
      * 导出列表
@@ -2422,30 +2432,19 @@ class Database
      */
     public function list_tbody($excel = false, $type = false)
     {
+        $this->state = false;
+
         # 新增权限
         if (Dever::load('manage/auth.oper', 1) == false) {
             Dever::alert('你没有权限');
         }
 
         if (Dever::input('page_content') == 1) {
-            return;
+            return '';
         }
 
         $config = $this->config();
 
-        if (!$excel) {
-            if ($type == 'layui') {
-                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']) && $config['manage']['list_table'] == 'js') {
-                    return '';
-                }
-            }
-        }
-        
-
         $high = array();
         
         $search = Dever::load('manage/auth.oper', 2) ? Dever::preInput('search_') : false;
@@ -2718,24 +2717,15 @@ class Database
             }
         }
 
-        $result = implode('', $result);
-        if (!$this->manage_button) {
-            $result = str_replace('<td></td>', '', $result);
-        }
-
-        /*
-        if ($result) { 
-            $thead = $this->list_thead();
-            if ($thead) {
-                $k = $k + 1;
-                $result[$k] = '<tr>';
-                foreach ($thead as $k => $v) {
-                    $result[$k] .= $v;
-                }
-                $result[$k] .= '</tr>';
+        if ($result) {
+            $this->state = true;
+            $result = implode('', $result);
+            if (!$this->manage_button) {
+                $result = str_replace('<td></td>', '', $result);
             }
+        } else {
+            $result = '';
         }
-        */
 
         if ($type) {
             return $return;
@@ -2951,7 +2941,7 @@ class Database
 
         $result = '';
 
-        if (isset($config['struct']) && isset($config['manage']['mul']) && $config['manage']['mul']) {
+        if ($this->state && isset($config['struct']) && isset($config['manage']['mul']) && $config['manage']['mul']) {
             $mul = Dever::preInput('mul_');
 
             $node = Html::node(array('class="am-u-sm-12" style="margin-top:10px;"', 'class="am-form-group am-input-group-sm"'));