dever 6 years ago
parent
commit
2a6dc18255

+ 1 - 0
assets/layadmin/html/project/database/list.html

@@ -36,6 +36,7 @@
         <span>项目名称</span>
     </div>
 </div>
+
 <div id="content_1" style="display:none;"></div>
 <div id="content_2">
   <div class="layui-fluid">

+ 4 - 0
src/Auth.php

@@ -339,6 +339,10 @@ class Auth
 
                 if (strpos($user['top'], 'all') !== false) {
                     $user['top'] = 'all';
+                } elseif ($user['top']) {
+                    # 这块暂时不用
+                    //$top = explode(',', $user['top']);
+                    //Dever::load('manage/top.update_action', $top[0]);
                 }
             }
         }

+ 26 - 10
src/Database.php

@@ -1011,7 +1011,9 @@ class Database
             if (isset($config['manage']['search']['linkage'])) {
                 foreach ($config['manage']['search']['linkage'] as $k => $v) {
                     $this->list_search_linkage($result, $search, $prefix . 'linkage_' . $k, $v['lang'], $this->option($v['option']), $v['default']);
-                    $result .= '<br />';
+                    if (!layadmin()) {
+                        $result .= '<br />';
+                    }
                 }
             }
 
@@ -1626,22 +1628,32 @@ class Database
         }
 
         $linkage = Dever::preInput('search_linkage_');
+
         if ($linkage) {
             foreach ($linkage as $k => $v) {
                 if ($v) {
                     unset($search[$k]);
                     $k = str_replace('search_linkage_', '', $k);
-                    if (is_array($v)) {
-                        $v = implode(',', $v);
-                    }
-                    
-                    if ($v != -1) {
-                        $v = Dever::defaultValue($v);
+                    if (isset($config['struct'][$k]['search_col'])) {
+                        $temp = explode(',', $config['struct'][$k]['search_col']);
+                        foreach ($temp as $k1 => $v1) {
+                            if (isset($v[$k1]) && $v[$k1] != -1) {
+                                $param['option_' . $v1] = $v[$k1];
+                            }
+                        }
+                    } else {
+                        if (is_array($v)) {
+                            $v = implode(',', $v);
+                        }
+                        
+                        if ($v != -1) {
+                            $v = Dever::defaultValue($v);
 
-                        $param['option_' . $k] = $v;
+                            $param['option_' . $k] = $v;
 
-                        # 设定检索高亮
-                        $high[$k] = $v;
+                            # 设定检索高亮
+                            $high[$k] = $v;
+                        }
                     }
                 }
             }
@@ -1806,6 +1818,10 @@ class Database
 
         $result = $return = array();
 
+        if (isset($config['top_option']) && $config['top_option']) {
+            $param['option'][$config['top_option']['col']] = array($config['top_option']['value'], 'in');
+        }
+
         if ($excel == true) {
             $method = $this->project . '/' . $this->table . '-all';
         } else {

+ 4 - 0
src/Lib/Input.php

@@ -673,6 +673,10 @@ class Input
             $w = '';
         }
 
+        if (layadmin()) {
+            $w = 'margin-top:0px;width:20%;';
+        }
+
         if (!isset($param['search_state'])) {
             $param['search_state'] = false;
         }

+ 15 - 3
src/Top.php

@@ -151,13 +151,17 @@ class Top
      *
      * @return array
      */
-    public function sync($id, $name, $param = array())
+    public function sync($id, $name, $param = array(), $info_id = false)
     {
         if ($id && isset($param['top'])) {
             $key = $param['top']['key'];
 
-            $info = Dever::db('manage/top')->key(array('where_key' => $key));
-
+            if (!$info_id) {
+                $info = Dever::db('manage/top')->key(array('where_key' => $key));
+            } else {
+                $info['id'] = $info_id;
+            }
+            
             if ($info) {
                 $update['value'] = Dever::input('where_id', $id);
 
@@ -175,6 +179,14 @@ class Top
                 $update['state'] = Dever::param('state', $param);
 
                 $this->update($update);
+            } else {
+                $update['value'] = $param['top']['value'];
+                $update['name'] = $param['top']['name'];
+                $update['key'] = $key;
+                $update['top'] = -1;
+                $update['state'] = 1;
+                $id = Dever::db('manage/top')->insert($update);
+                $this->sync($id, $name, $param, $id);
             }
         }
     }

+ 0 - 26
template/layadmin/inc/nav.php

@@ -21,31 +21,5 @@ $view
  
 //->fetch('#edit@href', 'edit')
 
-->fetch('.auth-top@style', 'display:none')
-# 项目列表
-->loop
-(
-    '.auth-top',
-    'manage/top.get',  
-    array
-    ( 
-        
-        'span|0' => '<{$v.name}>', 
-
-        'ul' => array 
-        (
-            'li|$v.child' => array
-            (   
-                'a' => array 
-                (
-                    'html' => '$v1.name',
-                    'data-id' => '$v1.id',
-                    'onclick' => 'topMenu($(this))',
-                )
-            ),
-        ),
-	)
-)
-
 # display
 ->display();

+ 27 - 0
template/layadmin/project/database/list.php

@@ -83,5 +83,32 @@ $view
 ))
 */
 
+# 项目列表
+->fetch('.auth-top@style', 'display:none')
+
+->loop
+(
+    '.auth-top',
+    'manage/top.get',  
+    array
+    ( 
+        
+        'span|0' => '<{$v.name}>', 
+
+        'ul' => array 
+        (
+            'li|$v.child' => array
+            (   
+                'a' => array 
+                (
+                    'html' => '$v1.name',
+                    'data-id' => '$v1.id',
+                    'onclick' => 'topMenu($(this))',
+                )
+            ),
+        ),
+	)
+)
+
 # 将上边fetch的都显示出来
 ->display();