From f883cad61317953d67aaddc4b9d78636e074ce3d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=BF=98=E4=BF=97=E4=BA=8C=E5=B8=88=E5=85=84?=
<505097558@qq.com>
Date: Sat, 25 Apr 2026 19:58:45 +0000
Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8DsearchList=E4=BD=BF?=
=?UTF-8?q?=E7=94=A8$.getJSON=E7=AD=89=E5=BC=82=E6=AD=A5=E8=8E=B7=E5=8F=96?=
=?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BC=82=E5=B8=B8=20=E4=BF=AE=E5=A4=8Dsearch?=
=?UTF-8?q?List=E4=BD=BF=E7=94=A8$.getJSON=E7=AD=89=E5=BC=82=E6=AD=A5?=
=?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=95=B0=E6=8D=AE=E5=BC=82=E5=B8=B8=EF=BC=8C?=
=?UTF-8?q?=E5=90=8C=E6=97=B6=E8=BF=98=E5=A2=9E=E5=8A=A0=E4=BA=86=E5=8F=AF?=
=?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=20name=E4=B8=8B=E6=A0=87=E7=9A=84na?=
=?UTF-8?q?meKey?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: 还俗二师兄 <505097558@qq.com>
---
public/assets/js/bootstrap-table-commonsearch.js | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/public/assets/js/bootstrap-table-commonsearch.js b/public/assets/js/bootstrap-table-commonsearch.js
index 428f707fe..56874e0e7 100644
--- a/public/assets/js/bootstrap-table-commonsearch.js
+++ b/public/assets/js/bootstrap-table-commonsearch.js
@@ -134,7 +134,7 @@
var createOptionList = function (searchList, vObjCol, that) {
var optionList = [];
optionList.push(sprintf('', that.options.formatCommonChoose()));
- searchList = $.fn.bootstrapTable.utils.combineSearchList(searchList);
+ searchList = $.fn.bootstrapTable.utils.combineSearchList(searchList, vObjCol, that);
$.each(searchList, function (key, value) {
optionList.push(sprintf("", key == vObjCol.defaultValue ? 'selected' : ''));
});
@@ -286,7 +286,7 @@
_initSearch = BootstrapTable.prototype.initSearch;
// 定义通用searchList处理方法
- $.fn.bootstrapTable.utils.combineSearchList = function (list) {
+ $.fn.bootstrapTable.utils.combineSearchList = function (list, vObjCol, that) {
var searchList = {};
if (typeof list !== 'undefined') {
@@ -302,7 +302,19 @@
} else {
list = ret;
}
+ let optionList = [];
+ $.each(list, function (key, val) {
+ if (typeof val !== 'undefined' && val.constructor === Object) {
+ key = val.id;
+ val = val[vObjCol.nameKey || 'name'];
+ } else {
+ key = isArray ? val : key;
+ }
+ optionList.push(sprintf("", key == vObjCol.defaultValue && vObjCol.defaultValue !='' ? 'selected' : ''));
+ });
+ $("form.form-commonsearch select[name='" + vObjCol.field + "']", that.$container).append(optionList.join('')).trigger("change");
});
+ list = '';
}
// 兼容旧版本searchList返回字符串直接渲染自定义搜索栏
if (typeof list === 'string') {
--
Gitee
From 23919a8754b316b9112b8a1082faf86e0d68d5b6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=BF=98=E4=BF=97=E4=BA=8C=E5=B8=88=E5=85=84?=
<505097558@qq.com>
Date: Sun, 26 Apr 2026 02:53:22 +0000
Subject: [PATCH 2/3] =?UTF-8?q?=E9=80=82=E9=85=8DnameKey=20=E9=80=82?=
=?UTF-8?q?=E9=85=8DnameKey?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: 还俗二师兄 <505097558@qq.com>
---
public/assets/js/bootstrap-table-commonsearch.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/assets/js/bootstrap-table-commonsearch.js b/public/assets/js/bootstrap-table-commonsearch.js
index 56874e0e7..094906dbf 100644
--- a/public/assets/js/bootstrap-table-commonsearch.js
+++ b/public/assets/js/bootstrap-table-commonsearch.js
@@ -325,7 +325,7 @@
$.each(list, function (key, val) {
if (typeof val !== 'undefined' && val.constructor === Object) {
key = val.id;
- val = val.name;
+ val = val[vObjCol.nameKey || 'name'];
} else {
key = isArray ? val : key;
}
--
Gitee
From eb74366381a842c8f7992cbeebe69f83e0b8d0e1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=BF=98=E4=BF=97=E4=BA=8C=E5=B8=88=E5=85=84?=
<505097558@qq.com>
Date: Tue, 26 May 2026 01:58:53 +0000
Subject: [PATCH 3/3] =?UTF-8?q?update=20public/assets/js/bootstrap-table-c?=
=?UTF-8?q?ommonsearch.js.=20=E6=96=B0=E5=A2=9E=E5=AD=97=E6=AE=B5=E9=85=8D?=
=?UTF-8?q?=E7=BD=AE=E4=BB=A5=E5=8F=8A=E9=BB=98=E8=AE=A4=E9=A6=96=E6=AC=A1?=
=?UTF-8?q?=E6=B8=B2=E6=9F=93=E5=BC=82=E5=B8=B8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: 还俗二师兄 <505097558@qq.com>
---
public/assets/js/bootstrap-table-commonsearch.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/public/assets/js/bootstrap-table-commonsearch.js b/public/assets/js/bootstrap-table-commonsearch.js
index 094906dbf..7a7d02d98 100644
--- a/public/assets/js/bootstrap-table-commonsearch.js
+++ b/public/assets/js/bootstrap-table-commonsearch.js
@@ -294,7 +294,7 @@
var isAjax = typeof list === 'object' && typeof list.then === 'function';
if (isFunction) {
list = list();
- } else if (isAjax) {
+ } else if (isAjax && vObjCol) {
$.when(list).done(function (ret) {
// 兼容旧版本在data中返回searchlist
if (typeof ret.data.searchlist !== 'undefined') {
@@ -306,10 +306,12 @@
$.each(list, function (key, val) {
if (typeof val !== 'undefined' && val.constructor === Object) {
key = val.id;
- val = val[vObjCol.nameKey || 'name'];
+ vObjCol.nameKey = typeof vObjCol.nameKey === 'undefined' ? 'name' : vObjCol.nameKey
+ val = val[vObjCol.nameKey];
} else {
key = isArray ? val : key;
}
+ vObjCol.defaultValue = typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue
optionList.push(sprintf("", key == vObjCol.defaultValue && vObjCol.defaultValue !='' ? 'selected' : ''));
});
$("form.form-commonsearch select[name='" + vObjCol.field + "']", that.$container).append(optionList.join('')).trigger("change");
--
Gitee