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