From 0c7f19c33f4f5dfacaceec413b19b60d9920b7cc Mon Sep 17 00:00:00 2001 From: JenniferW <1627055433@qq.com> Date: Mon, 22 Dec 2025 10:26:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8B=E6=8B=89=E6=A1=86=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/order/intention/search.vue | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/views/order/intention/search.vue b/src/views/order/intention/search.vue index 58875bc..f955632 100644 --- a/src/views/order/intention/search.vue +++ b/src/views/order/intention/search.vue @@ -1458,17 +1458,27 @@ const fetchSearchHints = async (keyword) => { }; } - // 3)只有值(如直接选了某个值,没有字段) + // 3)只有值(没有字段):需要区分是从下拉框选择的还是纯手输的 + // 如果值在 allValues 中存在,说明可能是从下拉框选择的,放在 fieldValue 里 if (!condition.field && condition.value && !condition.fieldLabel) { - return { - fieldName: "", - fieldValue: condition.value, - keyword: "", - queryType: "FUZZY", - }; + const isValueFromSuggestion = allValues.value.some( + (item) => String(item.value) === String(condition.value) + ); + + if (isValueFromSuggestion) { + // 从下拉框选择的值,放在 fieldValue 里 + return { + fieldName: "", + fieldValue: condition.value, + keyword: "", + queryType: "FUZZY", + }; + } + // 否则继续走方案4,放在 keyword 里 } // 4)其它情况(例如纯手输、无法识别字段),作为关键字查询 + // 纯手输的情况:没有 fieldLabel 和 field,应该放在 keyword 里 const keyword = condition.fieldLabel ? `${condition.fieldLabel}:${condition.value}`.replace(/:$/, "") : condition.value;