新增null或空字符串筛选过滤
新增表格列表字段renderDefault控制默认数据
正在显示
3 个修改的文件
包含
23 行增加
和
10 行删除
@@ -296,6 +296,17 @@ class Backend extends Controller | @@ -296,6 +296,17 @@ class Backend extends Controller | ||
296 | } | 296 | } |
297 | $v = !is_array($v) ? trim($v) : $v; | 297 | $v = !is_array($v) ? trim($v) : $v; |
298 | $sym = strtoupper(isset($op[$k]) ? $op[$k] : $sym); | 298 | $sym = strtoupper(isset($op[$k]) ? $op[$k] : $sym); |
299 | + //null和空字符串特殊处理 | ||
300 | + if (!is_array($v)) { | ||
301 | + if (in_array(strtoupper($v), ['NULL', 'NOT NULL'])) { | ||
302 | + $sym = strtoupper($v); | ||
303 | + } | ||
304 | + if (in_array($v, ['""', "''"])) { | ||
305 | + $v = ''; | ||
306 | + $sym = '='; | ||
307 | + } | ||
308 | + } | ||
309 | + | ||
299 | switch ($sym) { | 310 | switch ($sym) { |
300 | case '=': | 311 | case '=': |
301 | case '<>': | 312 | case '<>': |
@@ -64,8 +64,9 @@ | @@ -64,8 +64,9 @@ | ||
64 | var query = Fast.api.query(vObjCol.field); | 64 | var query = Fast.api.query(vObjCol.field); |
65 | var operate = Fast.api.query(vObjCol.field + "-operate"); | 65 | var operate = Fast.api.query(vObjCol.field + "-operate"); |
66 | 66 | ||
67 | - vObjCol.defaultValue = that.options.renderDefault && query ? query : (typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue); | ||
68 | - vObjCol.operate = that.options.renderDefault && operate ? operate : (typeof vObjCol.operate === 'undefined' ? '=' : vObjCol.operate); | 67 | + var renderDefault = that.options.renderDefault && (typeof vObjCol.renderDefault == 'undefined' || vObjCol.renderDefault); |
68 | + vObjCol.defaultValue = renderDefault && query ? query : (typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue); | ||
69 | + vObjCol.operate = renderDefault && operate ? operate : (typeof vObjCol.operate === 'undefined' ? '=' : vObjCol.operate); | ||
69 | ColumnsForSearch.push(vObjCol); | 70 | ColumnsForSearch.push(vObjCol); |
70 | 71 | ||
71 | htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">'); | 72 | htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">'); |
@@ -333,7 +334,7 @@ | @@ -333,7 +334,7 @@ | ||
333 | } else if (obj.size() > 1) { | 334 | } else if (obj.size() > 1) { |
334 | $("form [name='" + $(this).data("field") + "'][value='" + value + "']", that.$commonsearch).prop("checked", true); | 335 | $("form [name='" + $(this).data("field") + "'][value='" + value + "']", that.$commonsearch).prop("checked", true); |
335 | } else { | 336 | } else { |
336 | - obj.val(value); | 337 | + obj.val(value + ""); |
337 | } | 338 | } |
338 | obj.trigger("change"); | 339 | obj.trigger("change"); |
339 | $("form", that.$commonsearch).trigger("submit"); | 340 | $("form", that.$commonsearch).trigger("submit"); |
@@ -382,8 +383,8 @@ | @@ -382,8 +383,8 @@ | ||
382 | [value, item, i], value); | 383 | [value, item, i], value); |
383 | 384 | ||
384 | if (!($.inArray(key, that.header.fields) !== -1 && | 385 | if (!($.inArray(key, that.header.fields) !== -1 && |
385 | - (typeof value === 'string' || typeof value === 'number') && | ||
386 | - (value + '').toLowerCase().indexOf(fval) !== -1)) { | 386 | + (typeof value === 'string' || typeof value === 'number') && |
387 | + (value + '').toLowerCase().indexOf(fval) !== -1)) { | ||
387 | return false; | 388 | return false; |
388 | } | 389 | } |
389 | } | 390 | } |
@@ -10565,8 +10565,9 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undef | @@ -10565,8 +10565,9 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undef | ||
10565 | var query = Fast.api.query(vObjCol.field); | 10565 | var query = Fast.api.query(vObjCol.field); |
10566 | var operate = Fast.api.query(vObjCol.field + "-operate"); | 10566 | var operate = Fast.api.query(vObjCol.field + "-operate"); |
10567 | 10567 | ||
10568 | - vObjCol.defaultValue = that.options.renderDefault && query ? query : (typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue); | ||
10569 | - vObjCol.operate = that.options.renderDefault && operate ? operate : (typeof vObjCol.operate === 'undefined' ? '=' : vObjCol.operate); | 10568 | + var renderDefault = that.options.renderDefault && (typeof vObjCol.renderDefault == 'undefined' || vObjCol.renderDefault); |
10569 | + vObjCol.defaultValue = renderDefault && query ? query : (typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue); | ||
10570 | + vObjCol.operate = renderDefault && operate ? operate : (typeof vObjCol.operate === 'undefined' ? '=' : vObjCol.operate); | ||
10570 | ColumnsForSearch.push(vObjCol); | 10571 | ColumnsForSearch.push(vObjCol); |
10571 | 10572 | ||
10572 | htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">'); | 10573 | 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 | @@ -10834,7 +10835,7 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undef | ||
10834 | } else if (obj.size() > 1) { | 10835 | } else if (obj.size() > 1) { |
10835 | $("form [name='" + $(this).data("field") + "'][value='" + value + "']", that.$commonsearch).prop("checked", true); | 10836 | $("form [name='" + $(this).data("field") + "'][value='" + value + "']", that.$commonsearch).prop("checked", true); |
10836 | } else { | 10837 | } else { |
10837 | - obj.val(value); | 10838 | + obj.val(value + ""); |
10838 | } | 10839 | } |
10839 | obj.trigger("change"); | 10840 | obj.trigger("change"); |
10840 | $("form", that.$commonsearch).trigger("submit"); | 10841 | $("form", that.$commonsearch).trigger("submit"); |
@@ -10883,8 +10884,8 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undef | @@ -10883,8 +10884,8 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undef | ||
10883 | [value, item, i], value); | 10884 | [value, item, i], value); |
10884 | 10885 | ||
10885 | if (!($.inArray(key, that.header.fields) !== -1 && | 10886 | if (!($.inArray(key, that.header.fields) !== -1 && |
10886 | - (typeof value === 'string' || typeof value === 'number') && | ||
10887 | - (value + '').toLowerCase().indexOf(fval) !== -1)) { | 10887 | + (typeof value === 'string' || typeof value === 'number') && |
10888 | + (value + '').toLowerCase().indexOf(fval) !== -1)) { | ||
10888 | return false; | 10889 | return false; |
10889 | } | 10890 | } |
10890 | } | 10891 | } |
-
请 注册 或 登录 后发表评论