批量查询领域

This commit is contained in:
2026-04-17 10:56:44 +08:00
parent 8fbcf39a25
commit 7458beb8b2

View File

@@ -191,13 +191,26 @@ export default {
}
},
sortedFilteredFields() {
const kw = (this.fieldSearchText || '').trim().toLowerCase();
const list = (this.availableFields || []).filter((item) => {
if (!kw) return true;
return String(item.label || '').toLowerCase().includes(kw);
});
return list.slice().sort((a, b) => String(a.label || '').localeCompare(String(b.label || '')));
},
const kwRaw = String(this.fieldSearchText || '');
const normalize = (s) =>
String(s || '')
.trim()
.replace(/\s+/g, ' ')
.toLowerCase();
const tokens = kwRaw
? kwRaw
.split(/[\r\n,;]+/g)
.map((s) => normalize(s))
.filter(Boolean)
: [];
const list = (this.availableFields || []).filter((item) => {
if (!tokens.length) return true;
const label = normalize(item.label || '');
// 严格匹配:必须与字段名完全一致(忽略大小写与空白差异)
return tokens.some((t) => t === label);
});
return list.slice().sort((a, b) => String(a.label || '').localeCompare(String(b.label || '')));
},
selectedFieldLabels() {
const map = {};
(this.availableFields || []).forEach((i) => { map[String(i.id)] = i.label; });