feat: 统一列表模糊搜索行为

- 统一管理端和用户中心搜索参数及多字段包含匹配

- 修复聊天搜索竞态并优化部门重名路径展示

- 补充部门展开、模型空白词和聊天查询回归测试
This commit is contained in:
2026-08-13 22:29:59 +08:00
parent 765006747a
commit 64a85c6a5b
83 changed files with 1134 additions and 208 deletions

View File

@@ -1,5 +1,5 @@
<script setup>
import { computed, ref } from 'vue';
import { computed, ref, watch } from 'vue';
import { ArrowDown } from '@element-plus/icons-vue';
import {
@@ -31,6 +31,10 @@ const props = defineProps({
type: Number,
default: 3,
},
initialValue: {
type: String,
default: '',
},
// 搜索框占位符
searchPlaceholder: {
type: String,
@@ -38,10 +42,17 @@ const props = defineProps({
},
});
const emit = defineEmits(['search', 'button-click', 'buttonClick']);
const emit = defineEmits(['search', 'button-click', 'buttonClick', 'reset']);
// 搜索值
const searchValue = ref('');
const searchValue = ref(props.initialValue);
watch(
() => props.initialValue,
(value) => {
searchValue.value = value;
},
);
// 计算显示的按钮
const visibleButtons = computed(() => {
@@ -55,11 +66,19 @@ const dropdownButtons = computed(() => {
// 处理搜索
const handleSearch = () => {
searchValue.value = searchValue.value.trim();
emit('search', searchValue.value);
};
const handleClear = () => {
searchValue.value = '';
emit('search', '');
};
const handleReset = () => {
searchValue.value = '';
emit('reset');
emit('search', '');
};
// 处理按钮点击
@@ -91,10 +110,11 @@ const handleDropdownClick = (button) => {
<div>
<ElInput
v-model="searchValue"
:placeholder="$t('common.searchPlaceholder')"
:placeholder="searchPlaceholder"
class="search-input"
@keyup.enter="handleSearch"
clearable
@clear="handleClear"
@keyup.enter="handleSearch"
/>
</div>
<div>