From 46613a9f3cccc8d6e750628a015947555da316c6 Mon Sep 17 00:00:00 2001 From: JenniferW <1627055433@qq.com> Date: Wed, 3 Sep 2025 17:03:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AE=9E=E6=97=B6=E6=90=9C?= =?UTF-8?q?=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/order/intention/search.vue | 70 +++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 2 deletions(-) diff --git a/src/views/order/intention/search.vue b/src/views/order/intention/search.vue index c59ed74..bd05261 100644 --- a/src/views/order/intention/search.vue +++ b/src/views/order/intention/search.vue @@ -26,7 +26,17 @@ @keydown="handleKeydown" @click="handleInputClick" @mouseup="handleInputMouseUp" - /> + > + + + @@ -357,6 +367,23 @@ + + + +
+ 正式环境中提供语音输入检索功能,demo中仅做示意。 +
+ +
@@ -373,7 +400,7 @@ import { fieldValueMap, } from "@/data/step2MockData"; import { ElMessage, ElEmpty, ElDialog } from "element-plus"; -import { Search, Edit, RefreshLeft } from "@element-plus/icons-vue"; +import { Search, Edit, RefreshLeft, Microphone } from "@element-plus/icons-vue"; // 接收props和定义emit const props = defineProps({ @@ -408,6 +435,9 @@ const activeSuggestionIndex = ref(-1); const possibleFields = ref([]); const activePossibleFieldIndex = ref(-1); +// 语音输入弹窗控制 +const showVoicePopup = ref(false); + // 解析后的条件和查询结果 const parsedConditions = ref([]); // 精准查询条件 @@ -619,6 +649,8 @@ const handleSemicolon = (e) => { setTimeout(() => { // 触发输入事件以更新建议 handleInput(currentInput.value); + // 分号输入后触发实时查询 + triggerRealTimeSearch(); }, 0); }; @@ -948,6 +980,8 @@ const selectPossibleField = (field) => { // 保持建议框显示,允许继续编辑 setTimeout(() => { handleInput(currentInput.value); + // 选择字段后触发实时查询 + triggerRealTimeSearch(); }, 0); // 聚焦输入框并将光标定位到字段后的适当位置 @@ -1042,6 +1076,8 @@ const selectSuggestion = (item) => { // 保持建议框显示,允许继续编辑 setTimeout(() => { handleInput(currentInput.value); + // 选择建议项后触发实时查询 + triggerRealTimeSearch(); }, 0); // 聚焦输入框并将光标定位到当前条件末尾(分号后) @@ -1199,6 +1235,16 @@ const handleSearch = () => { possibleFields.value = []; }; +// 触发实时查询 +const triggerRealTimeSearch = () => { + // 只有当有有效条件时才触发实时查询 + if (currentInput.value.trim()) { + parsedConditions.value = parseConditions(currentInput.value); + applyPreciseFilter(); + showResults.value = true; + } +}; + // 应用精准过滤 const applyPreciseFilter = () => { // 先应用原始过滤 @@ -1943,6 +1989,18 @@ function handleConfirm() { font-size: 16px; } +// 语音图标样式 +:deep(.voice-icon) { + cursor: pointer; + color: #666; + margin-right: 8px; + transition: color 0.2s; + + &:hover { + color: #2156f3; + } +} + .search-button { white-space: nowrap; } @@ -2180,6 +2238,14 @@ function handleConfirm() { padding-right: 10px; } +/* 语音弹窗内容样式 */ +.voice-popup-content { + font-size: 16px; + text-align: center; + padding: 30px 0; + line-height: 1.6; +} + .new-tag-img { width: 35px; height: 35px;