推送/操作日志下载改location.href;移动组关闭自动select;所在组改单选

This commit is contained in:
chenxing
2026-08-18 00:04:08 +08:00
parent 58a606764b
commit 8fd5a21fcc
7 changed files with 37 additions and 33 deletions
+8 -3
View File
@@ -36,6 +36,7 @@ const DEFAULT_CACHE_KEY = 'bsch.group-tree.selected-node'
const props = withDefaults(defineProps<{
treeApi: () => Promise<any[]>;
autoClick?: boolean;
autoSelect?: boolean;
defaultSearchVisible?: boolean;
showCloseButton?: boolean;
searchPlaceholder?: string;
@@ -43,6 +44,7 @@ const props = withDefaults(defineProps<{
checkable?: boolean;
}>(), {
autoClick: false,
autoSelect: true,
defaultSearchVisible: true,
showCloseButton: false,
searchPlaceholder: '输入组名称搜索',
@@ -155,9 +157,12 @@ async function loadTree(preferredId?: number | null) {
if (!treeData.value.length) return;
await nextTick();
const selectId = resolveInitialSelectId(treeData.value, preferredId);
if (selectId != null) {
refMyTree.value?.reloadTree(selectId);
// 默认自动选中首个可用节点(触发 on-change);移动组等场景传 autoSelect=false 关闭,避免打开即误触"不能移动到自身"
if (props.autoSelect) {
const selectId = resolveInitialSelectId(treeData.value, preferredId);
if (selectId != null) {
refMyTree.value?.reloadTree(selectId);
}
}
}