dever 5 роки тому
батько
коміт
a21d2c4222
2 змінених файлів з 61 додано та 8 видалено
  1. 47 4
      src/Database.php
  2. 14 4
      src/Lib/Input.php

+ 47 - 4
src/Database.php

@@ -508,6 +508,10 @@ class Database
                         $config['manage']['search']['exp'][$k] = $v['name'];
                     }
 
+                    if (strpos($v['search'], 'in') !== false) {
+                        $config['manage']['search']['in'][$k] = $v['name'];
+                    }
+
                     if (strpos($v['search'], 'fulltext') !== false) {
                         $config['manage']['search']['fulltext'][$k] = $v['name'];
 
@@ -1134,6 +1138,24 @@ class Database
                 }
             }
 
+            if (isset($config['manage']['search']['in'])) {
+                $this->list_search_br($result);
+                foreach ($config['manage']['search']['in'] as $k => $v) {
+                    $value = array();
+                    $value['name'] = $prefix . 'option_' . $k;
+                    $value['class'] = 'form-control';
+                    if (isset($search[$value['name']])) {
+                        $value['value'] = $search[$value['name']];
+                    }
+                    if (strpos($v, '-') !== false) {
+                        $t = explode('-', $v);
+                        $v = $t[0];
+                    }
+                    $value['placeholder'] = $v;
+                    $result .= Html::text($value, false);
+                }
+            }
+
             if (isset($config['manage']['search']['fulltext'])) {
                 $this->list_search_br($result);
                 foreach ($config['manage']['search']['fulltext'] as $k => $v) {
@@ -1159,10 +1181,10 @@ class Database
 
                 $this->list_search_select($result, $search, $prefix . 'exp_type', '', array
                 (
-                3 => '大于',
-                4 => '大于等于',
-                5 => '小于',
-                6 => '小于等于',
+                    3 => '大于',
+                    4 => '大于等于',
+                    5 => '小于',
+                    6 => '小于等于',
                 ), 1);
 
                 $value = array();
@@ -1665,6 +1687,27 @@ class Database
                 }
             }
         }
+
+        # 检索in
+        $in = Dever::preInput('search_in_');
+        if ($in) {
+            $in_state = false;
+            foreach ($in as $k => $v) {
+                if ($v) {
+                    unset($search[$k]);
+                    $k = str_replace('search_in_', '', $k);
+                    $param['option'][$k] = array('yes', 'in');
+                    $param['option_' . $k] = $v;
+
+                    # 设定检索高亮
+                    $high[$k] = $v;
+
+                    $in_state = true;
+                }
+            }
+            $this->search = true;
+        }
+
         $fulltext = Dever::preInput('search_fulltext_');
         if ($fulltext) {
             $fulltext_state = false;

+ 14 - 4
src/Lib/Input.php

@@ -259,6 +259,16 @@ class Input
             }
         }
 
+        $param['upload_search_show'] = $param['upload_search'];
+        if (strstr($param['upload_search'], '#')) {
+            $temp = explode('#', $param['upload_search']);
+            $param['upload_search_show'] = $temp[0];
+            if ($temp[1] > 0) {
+                $param['upload_search_show'] .= '_<script>document.write($("#upload_'.$temp[1].'_value").val());</script>';
+            }
+            
+        }
+
         if (isset($param['place']) && $param['place']) {
             //$pic = 'src="http://placehold.it/' . $param['place'] . '"';
             //$param['placeimg'] = '<img src="http://temp.im/' . $param['place'] . '" class="place" width="150" />';
@@ -325,7 +335,7 @@ class Input
         $button = $upload[2][0] . '<input type="'.$upload[1].'" style="'.$class.$upload[3].'" class="form-control image_upload" '.$upload[0].' v="' . $param['name'] . '_' . $param['index'] . '" i="' . $param['name'] . '_info_value' . '" id="file_' . $param['name'] . '_' . $param['index'] . '" key="' . $param['key'] . '" upload_search_value="'.$param['upload_search_value'].'" place="'.$param['place'].'" value="本地上传"/>' . $upload[2][1];
         return $button .'
 
-        <input type="button" style="'.$class.'" class="form-control upload_show" v="' . $param['name'] . '_' . $param['index'] . '" i="' . $param['name'] . '_info_value' . '" id="file_show_' . $param['name'] . '_' . $param['index'] . '" key="' . $param['key'] . '" upload_search="'.$param['upload_search'].'" value="图库"/><span style="margin-left:10px;font-size:8px;">标识:'.$param['upload_search'].'</span>
+        <input type="button" style="'.$class.'" class="form-control upload_show" v="' . $param['name'] . '_' . $param['index'] . '" i="' . $param['name'] . '_info_value' . '" id="file_show_' . $param['name'] . '_' . $param['index'] . '" key="' . $param['key'] . '" upload_search="'.$param['upload_search'].'" value="图库"/><span style="margin-left:10px;font-size:8px;">标识:'.$param['upload_search_show'].'</span>
         <div style="margin-top:10px;display:none;" class="layui-progress layui-progress-big" id="file_' . $param['name'] . '_' . $param['index'] . '_progress" lay-filter="file_' . $param['name'] . '_' . $param['index'] . '_progress" lay-showPercent="true">
           <div class="layui-progress-bar" lay-percent="0%"></div>
         </div>
@@ -369,7 +379,7 @@ class Input
         $button = $upload[2][0] . '<input type="'.$upload[1].'" style="'.$class.$upload[3].'" class="form-control image_upload" '.$upload[0].' mul="yes" v="' . $param['name'] . '_' . $param['index'] . '"  i="' . $param['name'] . '_info_value' . '" id="file_' . $param['name'] . '_' . $param['index'] . '" key="' . $param['key'] . '" upload_search_value="'.$param['upload_search_value'].'" place="'.$param['place'].'" value="本地上传"/>' . $upload[2][1];
         return $button . '
 
-        <input type="button" style="'.$class.'" class="form-control upload_show" mul="yes" v="' . $param['name'] . '_' . $param['index'] . '"  i="' . $param['name'] . '_info_value' . '" id="file_show_' . $param['name'] . '_' . $param['index'] . '" key="' . $param['key'] . '" upload_search="'.$param['upload_search'].'" value="图库"/><span style="margin-left:10px;font-size:8px;">标识:'.$param['upload_search'].'</span>
+        <input type="button" style="'.$class.'" class="form-control upload_show" mul="yes" v="' . $param['name'] . '_' . $param['index'] . '"  i="' . $param['name'] . '_info_value' . '" id="file_show_' . $param['name'] . '_' . $param['index'] . '" key="' . $param['key'] . '" upload_search="'.$param['upload_search'].'" value="图库"/><span style="margin-left:10px;font-size:8px;">标识:'.$param['upload_search_show'].'</span>
 
         <div style="margin-top:10px;display:none;" class="layui-progress layui-progress-big" id="file_' . $param['name'] . '_' . $param['index'] . '_progress" lay-filter="file_' . $param['name'] . '_' . $param['index'] . '_progress" lay-showPercent="true">
           <div class="layui-progress-bar" lay-percent="0%"></div>
@@ -400,7 +410,7 @@ class Input
         $button = $upload[2][0] . '<input type="'.$upload[1].'" style="'.$class.$upload[3].'" class="form-control image_upload" '.$upload[0].' t="file" v="' . $param['name'] . '_' . $param['index'] . '"  i="' . $param['name'] . '_info_value' . '" id="file_' . $param['name'] . '_' . $param['index'] . '" key="' . $param['key'] . '" upload_search_value="'.$param['upload_search_value'].'" value="本地上传"/>' . $upload[2][1];
         return $button .'
 
-        <input type="button" style="'.$class.'" class="form-control upload_show" t="file" v="' . $param['name'] . '_' . $param['index'] . '" i="' . $param['name'] . '_info_value' . '" id="file_show_' . $param['name'] . '_' . $param['index'] . '" key="' . $param['key'] . '" upload_search="'.$param['upload_search'].'" value="文件库"/><span style="margin-left:10px;font-size:8px;">标识:'.$param['upload_search'].'</span>
+        <input type="button" style="'.$class.'" class="form-control upload_show" t="file" v="' . $param['name'] . '_' . $param['index'] . '" i="' . $param['name'] . '_info_value' . '" id="file_show_' . $param['name'] . '_' . $param['index'] . '" key="' . $param['key'] . '" upload_search="'.$param['upload_search'].'" value="文件库"/><span style="margin-left:10px;font-size:8px;">标识:'.$param['upload_search_show'].'</span>
 
         <div style="margin-top:10px;display:none;" class="layui-progress layui-progress-big" id="file_' . $param['name'] . '_' . $param['index'] . '_progress" lay-filter="file_' . $param['name'] . '_' . $param['index'] . '_progress" lay-showPercent="true">
           <div class="layui-progress-bar" lay-percent="0%"></div>
@@ -439,7 +449,7 @@ class Input
         $button = $upload[2][0] . '<input type="'.$upload[1].'" style="'.$class.$upload[3].'" class="form-control image_upload" '.$upload[0].' t="file" mul="yes" v="' . $param['name'] . '_' . $param['index'] . '" i="' . $param['name'] . '_info_value' . '" id="file_' . $param['name'] . '_' . $param['index'] . '" key="' . $param['key'] . '" upload_search_value="'.$param['upload_search_value'].'" value="本地上传"/>' . $upload[2][1];
         return $button .'
 
-        <input type="button" style="'.$class.'" class="form-control upload_show" t="file" mul="yes" v="' . $param['name'] . '_' . $param['index'] . '" i="' . $param['name'] . '_info_value' . '" id="file_' . $param['name'] . '_' . $param['index'] . '" key="' . $param['key'] . '" upload_search="'.$param['upload_search'].'" value="文件库"/><span style="margin-left:10px;font-size:8px;">标识:'.$param['upload_search'].'</span>
+        <input type="button" style="'.$class.'" class="form-control upload_show" t="file" mul="yes" v="' . $param['name'] . '_' . $param['index'] . '" i="' . $param['name'] . '_info_value' . '" id="file_' . $param['name'] . '_' . $param['index'] . '" key="' . $param['key'] . '" upload_search="'.$param['upload_search'].'" value="文件库"/><span style="margin-left:10px;font-size:8px;">标识:'.$param['upload_search_show'].'</span>
 
         <div style="margin-top:10px;display:none;" class="layui-progress layui-progress-big" id="file_' . $param['name'] . '_' . $param['index'] . '_progress" lay-filter="file_' . $param['name'] . '_' . $param['index'] . '_progress" lay-showPercent="true">
           <div class="layui-progress-bar" lay-percent="0%"></div>