From 860a80d579bd56f5b7270da0f0c41294d2dfdf56 Mon Sep 17 00:00:00 2001 From: PPPSCN <35696959@qq.com> Date: Tue, 9 May 2017 01:59:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=99=AE=E9=80=9A=E6=90=9C=E7=B4=A2=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E5=85=81=E8=AE=B8=E8=87=AA=E5=AE=9A=E4=B9=89=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E5=A4=84=E7=90=86=E6=8F=90=E4=BA=A4=E7=9A=84=E7=AD=9B?= =?UTF-8?q?=E9=80=89=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/js/backend/page.js | 6 +- .../assets/js/bootstrap-table-commonsearch.js | 81 +++++++++++++++---- 2 files changed, 70 insertions(+), 17 deletions(-) diff --git a/public/assets/js/backend/page.js b/public/assets/js/backend/page.js index ebee2b6b6..d186cb689 100644 --- a/public/assets/js/backend/page.js +++ b/public/assets/js/backend/page.js @@ -25,7 +25,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin {field: 'state', checkbox: true}, {field: 'id', title: __('Id'), operate: false}, {field: 'category_id', title: __('Category_id'), operate: '='}, - {field: 'title', title: __('Title'), operate: 'LIKE %...%', placeholder: '标题,模糊搜索', style: 'width:200px'}, + {field: 'title', title: __('Title'), operate: 'LIKE %...%', placeholder: '标题,模糊搜索,*表示任意字符', style: 'width:200px', + process: function (value, arg) { + return value.replace(/\*/g, '%'); //仅演示用法 + } + }, {field: 'keywords', title: __('Keywords'), operate: 'LIKE %...%', placeholder: '关键字,模糊搜索'}, {field: 'flag', title: __('Flag'), formatter: Table.api.formatter.flag, operate: false}, {field: 'image', title: __('Image'), formatter: Table.api.formatter.image, operate: false}, diff --git a/public/assets/js/bootstrap-table-commonsearch.js b/public/assets/js/bootstrap-table-commonsearch.js index faba56415..c9c36b7eb 100644 --- a/public/assets/js/bootstrap-table-commonsearch.js +++ b/public/assets/js/bootstrap-table-commonsearch.js @@ -8,7 +8,7 @@ !function ($) { 'use strict'; - var firstLoad = false; + var firstLoad = false, ColumnsForSearch = []; var sprintf = $.fn.bootstrapTable.utils.sprintf; @@ -81,8 +81,9 @@ htmlForm.push(sprintf("", that.options.titleForm)); for (var i in pColumns) { var vObjCol = pColumns[i]; - if (!vObjCol.checkbox && vObjCol.field !== 'operate' && vObjCol.visible && vObjCol.searchable && vObjCol.operate !== false) { - htmlForm.push('