BomManage: 增删改刷新保留折叠状态,搜索时才重置 activeCategories
This commit is contained in:
@ -10,11 +10,11 @@
|
||||
placeholder="搜索 编号/名称/规格/子件..."
|
||||
style="width: 300px; margin-right: 10px;"
|
||||
clearable
|
||||
@clear="fetchBomList"
|
||||
@keyup.enter="fetchBomList"
|
||||
@clear="handleSearch"
|
||||
@keyup.enter="handleSearch"
|
||||
>
|
||||
<template #append>
|
||||
<el-button :icon="Search" @click="fetchBomList" />
|
||||
<el-button :icon="Search" @click="handleSearch" />
|
||||
</template>
|
||||
</el-input>
|
||||
<el-button @click="activeCategories = bomGroups.map((g: any) => g.category)" size="small" style="margin-right: 6px;">全部展开</el-button>
|
||||
@ -463,13 +463,17 @@ const rules = reactive<FormRules>({
|
||||
|
||||
const dialogTitle = ref('新建 BOM')
|
||||
|
||||
const handleSearch = () => {
|
||||
activeCategories.value = [] // 用户主动搜索时重置折叠状态
|
||||
fetchBomList()
|
||||
}
|
||||
|
||||
const fetchBomList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await getBomList({ keyword: searchKeyword.value })
|
||||
if (res.code === 200) {
|
||||
bomGroups.value = res.data
|
||||
activeCategories.value = []
|
||||
}
|
||||
} finally { loading.value = false }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user