ソースを参照

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

zhuangkaixing 5 年 前
コミット
9f2aa5cd3a
1 ファイル変更9 行追加0 行削除
  1. 9 0
      application/admin/command/Crud.php

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

@@ -1449,6 +1449,15 @@ EOD;
         if ($itemArr) {
             $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') {
             $html .= ", operate:'RANGE', addclass:'datetimerange'";
         } elseif (in_array($datatype, ['float', 'double', 'decimal'])) {