rabin 2 năm trước cách đây
mục cha
commit
c6d21f78b0
2 tập tin đã thay đổi với 46 bổ sung9 xóa
  1. 35 8
      src/Database.php
  2. 11 1
      src/Lib/Input.php

+ 35 - 8
src/Database.php

@@ -237,9 +237,11 @@ class Database
     {
         $this->param = array();
         if (!$this->param) {
-            if ($where = Dever::preInput('search_', $input)) {
-                unset($where['search_option_state']);
-                $this->param += $where;
+            if ($key != 'listParent') {
+                if ($where = Dever::preInput('search_', $input)) {
+                    unset($where['search_option_state']);
+                    $this->param += $where;
+                }
             }
 
             /*
@@ -248,14 +250,14 @@ class Database
             }
             */
 
-            /*
-            if ($where = Dever::preInput('send_', $input)) {
+            if ($where = Dever::preInput('set_', $input)) {
                 $this->param += $where;
-            }*/
+            }
 
+            /*
             if ($search_limit = Dever::input('search_limit')) {
                 $this->param['search_limit'] = $search_limit;
-            }
+            }*/
 
             if ($page_type = Dever::input('page_type')) {
                 $this->param['page_type'] = $page_type;
@@ -674,6 +676,9 @@ class Database
                 }
 
                 if (!isset($config['search'])) {
+                    if (isset($v['search_name'])) {
+                        $v['name'] = $v['search_name'];
+                    }
                     if (isset($v['search']) && is_string($v['search'])) {
 
                         if ($v['search'] == 'sday') {
@@ -1534,6 +1539,7 @@ class Database
         # 搜索
         if (isset($config['struct']) && isset($config['manage']['search']) && $config['manage']['search']) {
             $search = Dever::preInput('search_');
+            $set = Dever::preInput('set_');
 
             $node = Html::node(array(' style="margin-top:0px;"', ''));
 
@@ -1691,7 +1697,10 @@ class Database
                     $value = array();
                     $value['name'] = $prefix . 'option_' . $k;
                     $value['class'] = 'form-control';
-                    if (isset($search[$value['name']])) {
+                    if (isset($set[$value['name']])) {
+                        $value['name'] = 'set_option_' . $k;
+                        $value['value'] = $set[$value['name']];
+                    } elseif (isset($search[$value['name']])) {
                         $value['value'] = $search[$value['name']];
                     }
                     if (strpos($v, '-') !== false) {
@@ -2201,6 +2210,9 @@ class Database
                 $j = 0;
                 foreach ($data as $ki => $vi) {
                     if (is_array($vi)) {
+                        if (isset($data[$ki][$k])) {
+                            $data[$ki]['cur_value'] = $data[$ki][$k];
+                        }
                         $body[$j][$i] = '';
                         //if (isset($vi[$k])) {
                         # 处理同步
@@ -2813,6 +2825,10 @@ class Database
                 }
 
                 foreach ($config['struct'] as $ki => $vi) {
+                    if (isset($data[$k][$ki])) {
+                        $data[$k]['cur_value'] = $data[$k][$ki];
+                    }
+                    
                     # 处理同步
                     # 兼容处理,之后删除
                     if (isset($vi['sync']) && (isset($vi['sync'][0]) && strpos($ki, '-'))) {
@@ -3293,6 +3309,14 @@ class Database
         if (!$data) {
             return $value;
         }
+        if (isset($data['cur_value'])) {
+            if ($value == 'time') {
+                return $data['cur_value'] ? date('Y-m-d H:i', $data['cur_value']) : '-';
+            } elseif (!strstr($value, 'Dever::load') && (strstr($value, '/') || strstr($value, '.'))) {
+                return $data['cur_value'] ? Dever::load($value, $data['cur_value']) : '-';
+            }
+        }
+        
         if (strstr($value, '={') && !strstr($value, '"')) {
             $value = '"' . $value . '"';
         }
@@ -4955,6 +4979,9 @@ class Database
     {
         $log = $tlog = array();
         foreach ($struct as $i => $j) {
+            if (isset($data[$i])) {
+                $data['cur_value'] = $data[$i];
+            }
             /*
             if ($i == 'reorder' || $i == 'id') {
                 continue;

+ 11 - 1
src/Lib/Input.php

@@ -1547,7 +1547,7 @@ class Input
      *
      * @return string
      */
-    public static function _date($param, $type = true, $key = 'date', $parse = 'Y-m-d H:i:s')
+    public static function _date($param, $type = false, $key = 'date', $parse = 'Y-m-d H:i:s')
     {
         $time = $value = '';
         if ((isset($param['value']) && $param['value'] > 0)) {
@@ -1568,6 +1568,16 @@ class Input
         return '<input type="text" value="' . $value . '" placeholder="' . (isset($param['lang']) ? $param['lang'] : '') . '" name="' . $param['name'] . '" class="manage_'.$key.' update_value form-control ' . (isset($param['valid']) ? $param['valid'] : '') . '" autocomplete="off"/>';
     }
 
+    /**
+     * cdate方法,默认自带当前时间
+     *
+     * @return string
+     */
+    public static function _cdate($param, $type = true)
+    {
+        return self::_date($param, $type);
+    }
+
     /**
      * time已废弃,用day替换,兼容不删除
      *