Browse Source

文件、图片、权重等字段默认不加入搜索栏,字符串类型默认LIKE

zhuangkaixing 5 years ago
parent
commit
9f2aa5cd3a
1 changed files with 9 additions and 0 deletions
  1. 9 0
      application/admin/command/Crud.php

+ 9 - 0
application/admin/command/Crud.php

@@ -1449,6 +1449,15 @@ EOD;
         if ($itemArr) {
         if ($itemArr) {
             $html .= ", searchList: " . $searchList;
             $html .= ", searchList: " . $searchList;
         }
         }
+
+        // 文件、图片、权重等字段默认不加入搜索栏,字符串类型默认LIKE
+        $noSearchFiles = ['file$', 'files$', 'image$', 'images$', '^weigh$'];
+        if(preg_match("/" . implode('|', $noSearchFiles) . "/i", $field)){
+            $html .= ", operate: false";
+        }else if(in_array($datatype, ['varchar'])) {
+            $html .= ", operate: 'LIKE'";
+        }
+
         if (in_array($datatype, ['date', 'datetime']) || $formatter === 'datetime') {
         if (in_array($datatype, ['date', 'datetime']) || $formatter === 'datetime') {
             $html .= ", operate:'RANGE', addclass:'datetimerange'";
             $html .= ", operate:'RANGE', addclass:'datetimerange'";
         } elseif (in_array($datatype, ['float', 'double', 'decimal'])) {
         } elseif (in_array($datatype, ['float', 'double', 'decimal'])) {