From f493ce3f64bda2736381f46e9b303014b62ec716 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sat, 18 Jan 2020 21:59:21 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=20bootstrap-tabl?= =?UTF-8?q?e=20=E5=B7=A5=E5=85=B7=E6=A0=8F=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #Commnet 高级查询按钮逻辑内置于启用搜索功能后 --- .../wwwroot/lib/longbow/longbow.common.js | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/admin/Bootstrap.Admin/wwwroot/lib/longbow/longbow.common.js b/src/admin/Bootstrap.Admin/wwwroot/lib/longbow/longbow.common.js index 5171cbd7..3ec4f072 100644 --- a/src/admin/Bootstrap.Admin/wwwroot/lib/longbow/longbow.common.js +++ b/src/admin/Bootstrap.Admin/wwwroot/lib/longbow/longbow.common.js @@ -516,38 +516,38 @@ title: '
输入任意字符串全局搜索
Enter 搜索 ESC 清除搜索
', html: true }); - } - // 生成高级查询按钮 - if (settings.showAdvancedSearchButton) { - // template - var $advancedSearchButtonHtml = $(''); - $advancedSearchButtonHtml.insertAfter($('.bootstrap-table .fixed-table-toolbar .search [name="clearSearch"]')).on('click', function () { - // 弹出高级查询对话框 - $(settings.advancedSearchModal).modal('show'); - }); - - // 高级搜索有值时颜色为红色 - $(settings.advancedSearchModal).on('hide.bs.modal', function () { - var $modal = $(this) - var hasValue = false; - $modal.find('[data-default-val]').each(function (index, element) { - var $ele = $(element); - var val = $ele.attr('data-default-val'); - if ($ele.prop('nodeName') === 'INPUT') { - if ($ele.hasClass('form-select-input')) { - hasValue = $ele.prev().val() !== val; - } - else { - hasValue = $ele.val() !== val; - } - } - if (hasValue) return false; + // 生成高级查询按钮 + if (settings.showAdvancedSearchButton) { + // template + var $advancedSearchButtonHtml = $(''); + $advancedSearchButtonHtml.insertAfter($('.bootstrap-table .fixed-table-toolbar .search [name="clearSearch"]')).on('click', function () { + // 弹出高级查询对话框 + $(settings.advancedSearchModal).modal('show'); }); - if (hasValue) $advancedSearchButtonHtml.removeClass('btn-secondary').addClass('btn-primary'); - else $advancedSearchButtonHtml.removeClass('btn-primary').addClass('btn-secondary'); - }); + // 高级搜索有值时颜色为红色 + $(settings.advancedSearchModal).on('hide.bs.modal', function () { + var $modal = $(this) + var hasValue = false; + $modal.find('[data-default-val]').each(function (index, element) { + var $ele = $(element); + var val = $ele.attr('data-default-val'); + if ($ele.prop('nodeName') === 'INPUT') { + if ($ele.hasClass('form-select-input')) { + hasValue = $ele.prev().val() !== val; + } + else { + hasValue = $ele.val() !== val; + } + } + if (hasValue) return false; + }); + + if (hasValue) $advancedSearchButtonHtml.removeClass('btn-secondary').addClass('btn-primary'); + else $advancedSearchButtonHtml.removeClass('btn-primary').addClass('btn-secondary'); + }); + } } // fix bug 移除 Toolbar 按钮 Title 中的 Html