From 9f2aa5cd3a7227a90f1b724bf3785aca1b0afb12 Mon Sep 17 00:00:00 2001 From: zhuangkaixing <1020526528@qq.com> Date: Wed, 19 Aug 2020 16:52:28 +0800 Subject: [PATCH] 文件、图片、权重等字段默认不加入搜索栏,字符串类型默认LIKE --- application/admin/command/Crud.php | 9 +++++++++ 1 file changed, 9 insertions(+), 0 deletions(-) diff --git a/application/admin/command/Crud.php b/application/admin/command/Crud.php index 67036e2..0264a08 100755 --- a/application/admin/command/Crud.php +++ b/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'])) { -- libgit2 0.24.0