修改内容区显示逻辑,改为配置驱动

This commit is contained in:
zqm
2025-12-26 17:12:36 +08:00
parent e89d3254e8
commit 09e4076635
5 changed files with 213 additions and 210 deletions

View File

@@ -225,6 +225,37 @@ const handleMainAreaResizeBarEnd = (id) => {
areaActions.handleResizeEnd(id);
};
// 处理Area合并请求
const handleAreaMergeRequest = (data) => {
const { sourceArea, targetAreaId } = data;
// 查找目标Area
const targetArea = floatingAreas.value.find(area => area.id === targetAreaId);
if (!targetArea) return;
// 直接修改目标Area的children配置
if (!targetArea.children) {
targetArea.children = [];
}
// 处理源Area的children
if (sourceArea.children) {
const childrenArray = Array.isArray(sourceArea.children) ? sourceArea.children : [sourceArea.children];
childrenArray.forEach(child => {
if (child.type === 'TabPage') {
// 添加到目标Area的children中
if (!Array.isArray(targetArea.children)) {
targetArea.children = [targetArea.children];
}
targetArea.children.push(child);
}
});
}
// 从floatingAreas中移除源Area
floatingAreas.value = floatingAreas.value.filter(area => area.id !== sourceArea.id);
};
const getMainAreaResizeBarStyle = (resizeBar) => {
return areaActions.getResizeBarStyle(resizeBar);
};
@@ -243,6 +274,7 @@ const setupEventListeners = () => {
unsubscribeFunctions.push(eventBus.on(EVENT_TYPES.AREA_POSITION_UPDATE, onUpdatePosition, { componentId: 'dock-layout' }));
unsubscribeFunctions.push(eventBus.on(EVENT_TYPES.AREA_DRAG_OVER, handleAreaDragOver, { componentId: 'dock-layout' }));
unsubscribeFunctions.push(eventBus.on(EVENT_TYPES.AREA_DRAG_LEAVE, handleAreaDragLeave, { componentId: 'dock-layout' }));
unsubscribeFunctions.push(eventBus.on(EVENT_TYPES.AREA_MERGE_REQUEST, handleAreaMergeRequest, { componentId: 'dock-layout' }));
// Tab相关事件
unsubscribeFunctions.push(eventBus.on(EVENT_TYPES.TAB_CHANGE, onTabChange, { componentId: 'dock-layout' }));