update public/assets/js/bootstrap-table-commonsearch.js.

新增字段配置以及默认首次渲染异常

Signed-off-by: 还俗二师兄 <505097558@qq.com>
pull/527/head
还俗二师兄 2026-05-26 01:58:53 +00:00 committed by Gitee
parent 23919a8754
commit eb74366381
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 4 additions and 2 deletions

View File

@ -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("<option value='" + Fast.api.escape(key) + "' %s>" + Fast.api.escape(val) + "</option>", key == vObjCol.defaultValue && vObjCol.defaultValue !='' ? 'selected' : ''));
});
$("form.form-commonsearch select[name='" + vObjCol.field + "']", that.$container).append(optionList.join('')).trigger("change");