feat: 重构全局搜索框为复合条件选择,支持按名称、俗名、规格进行精准查杂

This commit is contained in:
dxc
2026-03-11 13:37:52 +08:00
parent e224a07a47
commit b1cc280a71
12 changed files with 156 additions and 65 deletions

View File

@ -5,11 +5,20 @@
<div class="filter-container">
<el-input
v-model="queryParams.keyword"
placeholder="请输入名称、俗名或规格"
style="width: 240px; margin-right: 10px;"
placeholder="请输入搜索关键字"
style="width: 320px; margin-right: 10px;"
clearable
@input="handleInputSearch"
/>
@keyup.enter="handleQuery"
>
<template #prepend>
<el-select v-model="queryParams.searchField" style="width: 90px">
<el-option label="全部" value="all" />
<el-option label="名称" value="name" />
<el-option label="俗名" value="common_name" />
<el-option label="规格" value="spec" />
</el-select>
</template>
</el-input>
<el-select
v-model="queryParams.company"
@ -562,6 +571,7 @@ interface QueryParams {
pageNum: number;
pageSize: number;
keyword: string;
searchField: string;
category: string;
type: string;
company: string;
@ -746,6 +756,7 @@ const queryParams = reactive<QueryParams>({
pageNum: 1,
pageSize: 100,
keyword: '',
searchField: 'all',
category: '',
type: '',
company: '',
@ -966,6 +977,7 @@ const handleQuery = () => {
const resetQuery = () => {
queryParams.keyword = '';
queryParams.searchField = 'all';
queryParams.category = '';
queryParams.type = '';
queryParams.company = '';