差异接口调用优化
This commit is contained in:
parent
ace301a637
commit
777d2bf8b3
|
|
@ -849,6 +849,8 @@ const handleSemicolon = (e) => {
|
|||
handleInput(currentInput.value, { skipDifference: true });
|
||||
// 分号输入后触发实时查询
|
||||
triggerRealTimeSearch();
|
||||
// 条件输入完成(有分号)时调用差异查询
|
||||
fetchDifferenceRecommendations();
|
||||
}, 0);
|
||||
};
|
||||
|
||||
|
|
@ -1174,9 +1176,7 @@ const handleInput = (value, options = {}) => {
|
|||
if (currentPart) {
|
||||
scheduleSearchHint(currentPart);
|
||||
}
|
||||
if (!options.skipDifference && normalizedValue.trim()) {
|
||||
scheduleDifferenceFetch();
|
||||
}
|
||||
// 移除实时调用 differenceWords,只在条件完成(有分号)或点击查询时调用
|
||||
};
|
||||
|
||||
const fetchSearchHints = async (keyword) => {
|
||||
|
|
@ -1350,11 +1350,18 @@ const selectSuggestion = (item) => {
|
|||
// 重新拼接条件,清理多余分号
|
||||
currentInput.value = parts.join(";").replace(/;;+/g, ";").trim();
|
||||
|
||||
// 检查是否添加了分号(选择值建议时会自动添加分号)
|
||||
const hasAddedSemicolon = item.type === "value" && parts[targetIndex].trim().endsWith(";");
|
||||
|
||||
// 保持建议框显示,允许继续编辑
|
||||
setTimeout(() => {
|
||||
handleInput(currentInput.value, { skipDifference: true });
|
||||
// 选择建议项后触发实时查询
|
||||
triggerRealTimeSearch();
|
||||
// 如果选择值建议并添加了分号,调用差异查询
|
||||
if (hasAddedSemicolon) {
|
||||
fetchDifferenceRecommendations();
|
||||
}
|
||||
}, 0);
|
||||
|
||||
// 聚焦输入框并将光标定位到当前条件末尾(分号后)
|
||||
|
|
@ -1672,6 +1679,8 @@ const addPreciseCondition = (index) => {
|
|||
if (!exists) {
|
||||
preciseConditions.value.push({ ...condition, originalIndex: index });
|
||||
executeSearch({ page: 1 });
|
||||
// 添加精准查询条件后调用差异查询
|
||||
fetchDifferenceRecommendations();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1706,7 +1715,7 @@ const triggerRealTimeSearch = () => {
|
|||
// 输入实时变化时,同步精准条件索引
|
||||
syncPreciseConditionsIndex();
|
||||
scheduleSearchExecution(1);
|
||||
scheduleDifferenceFetch();
|
||||
// 移除实时调用差异查询,只在条件完成或点击查询时调用
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1730,7 +1739,7 @@ const removeCondition = (index) => {
|
|||
|
||||
// 重新查询
|
||||
executeSearch({ page: 1 });
|
||||
scheduleDifferenceFetch();
|
||||
// 移除条件后不调用差异查询,只在条件完成或点击查询时调用
|
||||
|
||||
// 重置选中的条件索引
|
||||
if (selectedConditionIndex.value === index) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue