diff --git a/application/common/controller/Backend.php b/application/common/controller/Backend.php index 40d2a60..12d1783 100644 --- a/application/common/controller/Backend.php +++ b/application/common/controller/Backend.php @@ -296,6 +296,17 @@ class Backend extends Controller } $v = !is_array($v) ? trim($v) : $v; $sym = strtoupper(isset($op[$k]) ? $op[$k] : $sym); + //null和空字符串特殊处理 + if (!is_array($v)) { + if (in_array(strtoupper($v), ['NULL', 'NOT NULL'])) { + $sym = strtoupper($v); + } + if (in_array($v, ['""', "''"])) { + $v = ''; + $sym = '='; + } + } + switch ($sym) { case '=': case '<>': diff --git a/public/assets/js/bootstrap-table-commonsearch.js b/public/assets/js/bootstrap-table-commonsearch.js index a0d535b..d340f26 100644 --- a/public/assets/js/bootstrap-table-commonsearch.js +++ b/public/assets/js/bootstrap-table-commonsearch.js @@ -64,8 +64,9 @@ var query = Fast.api.query(vObjCol.field); var operate = Fast.api.query(vObjCol.field + "-operate"); - vObjCol.defaultValue = that.options.renderDefault && query ? query : (typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue); - vObjCol.operate = that.options.renderDefault && operate ? operate : (typeof vObjCol.operate === 'undefined' ? '=' : vObjCol.operate); + var renderDefault = that.options.renderDefault && (typeof vObjCol.renderDefault == 'undefined' || vObjCol.renderDefault); + vObjCol.defaultValue = renderDefault && query ? query : (typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue); + vObjCol.operate = renderDefault && operate ? operate : (typeof vObjCol.operate === 'undefined' ? '=' : vObjCol.operate); ColumnsForSearch.push(vObjCol); htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">'); @@ -333,7 +334,7 @@ } else if (obj.size() > 1) { $("form [name='" + $(this).data("field") + "'][value='" + value + "']", that.$commonsearch).prop("checked", true); } else { - obj.val(value); + obj.val(value + ""); } obj.trigger("change"); $("form", that.$commonsearch).trigger("submit"); @@ -382,8 +383,8 @@ [value, item, i], value); if (!($.inArray(key, that.header.fields) !== -1 && - (typeof value === 'string' || typeof value === 'number') && - (value + '').toLowerCase().indexOf(fval) !== -1)) { + (typeof value === 'string' || typeof value === 'number') && + (value + '').toLowerCase().indexOf(fval) !== -1)) { return false; } } diff --git a/public/assets/js/require-backend.min.js b/public/assets/js/require-backend.min.js index b58113a..9b2aaeb 100644 --- a/public/assets/js/require-backend.min.js +++ b/public/assets/js/require-backend.min.js @@ -10565,8 +10565,9 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undef var query = Fast.api.query(vObjCol.field); var operate = Fast.api.query(vObjCol.field + "-operate"); - vObjCol.defaultValue = that.options.renderDefault && query ? query : (typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue); - vObjCol.operate = that.options.renderDefault && operate ? operate : (typeof vObjCol.operate === 'undefined' ? '=' : vObjCol.operate); + var renderDefault = that.options.renderDefault && (typeof vObjCol.renderDefault == 'undefined' || vObjCol.renderDefault); + vObjCol.defaultValue = renderDefault && query ? query : (typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue); + vObjCol.operate = renderDefault && operate ? operate : (typeof vObjCol.operate === 'undefined' ? '=' : vObjCol.operate); ColumnsForSearch.push(vObjCol); htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">'); @@ -10834,7 +10835,7 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undef } else if (obj.size() > 1) { $("form [name='" + $(this).data("field") + "'][value='" + value + "']", that.$commonsearch).prop("checked", true); } else { - obj.val(value); + obj.val(value + ""); } obj.trigger("change"); $("form", that.$commonsearch).trigger("submit"); @@ -10883,8 +10884,8 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undef [value, item, i], value); if (!($.inArray(key, that.header.fields) !== -1 && - (typeof value === 'string' || typeof value === 'number') && - (value + '').toLowerCase().indexOf(fval) !== -1)) { + (typeof value === 'string' || typeof value === 'number') && + (value + '').toLowerCase().indexOf(fval) !== -1)) { return false; } }