This commit is contained in:
Yvan
2026-08-17 10:46:06 +08:00
parent a601bc1760
commit 05b49cd86a
2 changed files with 9 additions and 3 deletions
@@ -400,8 +400,10 @@
name: searchName.value.trim()
})
if (res.code === 0) {
dictionaryData.value = res.data
selectID.value = res.data[0].ID
// 搜索无结果时同步清空当前选中项。
const dictionaries = Array.isArray(res.data) ? res.data : []
dictionaryData.value = dictionaries
selectID.value = dictionaries[0]?.ID ?? 0
// 更新可选父级字典列表
updateAvailableParentDictionaries()
}
@@ -283,7 +283,11 @@
// 获取树形数据
const getTreeData = async () => {
if (!props.sysDictionaryID) return
if (!props.sysDictionaryID) {
treeData.value = []
displayTreeData.value = []
return
}
try {
const res = await getDictionaryTreeList({
sysDictionaryID: props.sysDictionaryID