From 888973e2cb14e6bd044e6a9325c5f02572b19fbd Mon Sep 17 00:00:00 2001 From: Jackxwb <34720403+Jackxwb@users.noreply.github.com> Date: Sat, 12 Oct 2024 22:33:04 +0800 Subject: [PATCH] Merge pull request #261 * Supplementary search, Resolve the issue of language not being supported --- frontend/components/Form/Autocomplete2.vue | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/frontend/components/Form/Autocomplete2.vue b/frontend/components/Form/Autocomplete2.vue index 0bda7dd6..92fef222 100644 --- a/frontend/components/Form/Autocomplete2.vue +++ b/frontend/components/Form/Autocomplete2.vue @@ -156,11 +156,26 @@ const matches = index.value.search("*" + search.value + "*"); + let resultIDs = [] for (let i = 0; i < matches.length; i++) { const match = matches[i]; const item = props.items[parseInt(match.ref)]; const display = extractDisplay(item); list.push({ id: i, display, value: item }); + resultIDs.push(item.id); + } + + /** + * Supplementary search, + * Resolve the issue of language not being supported + */ + for (let i = 0; i < props.items.length; i++) { + const item = props.items[i] + if(resultIDs.find(item_ => item_ === item.id) != undefined){continue} + if(item.treeString.indexOf(search.value) > -1){ + const display = extractDisplay(item); + list.push({ id: i, display, value: item }); + } } return list;