mirror of https://gitee.com/karson/fastadmin.git
parent
592a42fcc5
commit
8e88e1c9dc
|
|
@ -831,8 +831,11 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
|
||||||
},
|
},
|
||||||
search: function (value, row, index) {
|
search: function (value, row, index) {
|
||||||
var field = this.field;
|
var field = this.field;
|
||||||
if (typeof this.customField !== 'undefined' && typeof row[this.customField] !== 'undefined') {
|
if (typeof this.customField !== 'undefined') {
|
||||||
value = row[this.customField];
|
var customValue = this.customField.split('.').reduce(function (obj, key) {
|
||||||
|
return obj === null || obj === undefined ? '' : obj[key];
|
||||||
|
}, row);
|
||||||
|
value = Fast.api.escape(customValue);
|
||||||
field = this.customField;
|
field = this.customField;
|
||||||
}
|
}
|
||||||
return '<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', value) + '" data-field="' + field + '" data-value="' + value + '">' + value + '</a>';
|
return '<a href="javascript:;" class="searchit" data-toggle="tooltip" title="' + __('Click to search %s', value) + '" data-field="' + field + '" data-value="' + value + '">' + value + '</a>';
|
||||||
|
|
@ -856,8 +859,11 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
|
||||||
colorArr = $.extend(colorArr, this.custom);
|
colorArr = $.extend(colorArr, this.custom);
|
||||||
}
|
}
|
||||||
var field = this.field;
|
var field = this.field;
|
||||||
if (typeof this.customField !== 'undefined' && typeof row[this.customField] !== 'undefined') {
|
if (typeof this.customField !== 'undefined') {
|
||||||
value = row[this.customField];
|
var customValue = this.customField.split('.').reduce(function (obj, key) {
|
||||||
|
return obj === null || obj === undefined ? '' : obj[key];
|
||||||
|
}, row);
|
||||||
|
value = Fast.api.escape(customValue);
|
||||||
field = this.customField;
|
field = this.customField;
|
||||||
}
|
}
|
||||||
if (typeof that.searchList === 'object' && typeof that.custom === 'undefined') {
|
if (typeof that.searchList === 'object' && typeof that.custom === 'undefined') {
|
||||||
|
|
@ -1007,17 +1013,11 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
|
||||||
url + (url.match(/(\?|&)+/) ? "&ids=" : "/ids/") + '{ids}' : url;
|
url + (url.match(/(\?|&)+/) ? "&ids=" : "/ids/") + '{ids}' : url;
|
||||||
url = url.replace(/\{(.*?)\}/gi, function (matched) {
|
url = url.replace(/\{(.*?)\}/gi, function (matched) {
|
||||||
matched = matched.substring(1, matched.length - 1);
|
matched = matched.substring(1, matched.length - 1);
|
||||||
if (matched.indexOf(".") !== -1) {
|
var temp = matched.split('.').reduce(function (obj, key) {
|
||||||
var temp = row;
|
return obj === null || obj === undefined ? '' : obj[key];
|
||||||
var arr = matched.split(/\./);
|
}, row);
|
||||||
for (var i = 0; i < arr.length; i++) {
|
temp = Fast.api.escape(temp);
|
||||||
if (typeof temp[arr[i]] !== 'undefined') {
|
return temp;
|
||||||
temp = temp[arr[i]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return typeof temp === 'object' ? '' : temp;
|
|
||||||
}
|
|
||||||
return row[matched];
|
|
||||||
});
|
});
|
||||||
return url;
|
return url;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue