diff --git a/packages/dnd-design/src/panel-items/dnd-design/dnd-design.controller.ts b/packages/dnd-design/src/panel-items/dnd-design/dnd-design.controller.ts index 995b6ca1d2ab4da26fe7fd95cca5f43f07de01e7..3fee6bdd08efb737c2f79f893ad53a8cc14052f4 100644 --- a/packages/dnd-design/src/panel-items/dnd-design/dnd-design.controller.ts +++ b/packages/dnd-design/src/panel-items/dnd-design/dnd-design.controller.ts @@ -753,6 +753,9 @@ export class DndDesignPanelItemController * @return {*} {number} */ getModelState(entity: IDataEntity): number { + if (this.view.context.srfrunmode === 'DESIGN') { + return 0; + } let modelState = 0; let current = entity; while (current) { @@ -791,6 +794,9 @@ export class DndDesignPanelItemController ]; isShowMask(entity: IDataEntity): boolean { + if (this.view.context.srfrunmode === 'DESIGN') { + return false; + } if (!entity) { return false; } diff --git a/packages/dnd-design/src/panel-items/dnd-structure/dnd-structure.tsx b/packages/dnd-design/src/panel-items/dnd-structure/dnd-structure.tsx index cf89578dddee88dad6533f6ec22e913003d7c821..fbe6adcfc80c979ffed70bd35d7803758a7806b3 100644 --- a/packages/dnd-design/src/panel-items/dnd-structure/dnd-structure.tsx +++ b/packages/dnd-design/src/panel-items/dnd-structure/dnd-structure.tsx @@ -13,8 +13,12 @@ import { ElTree } from 'element-plus'; import Node from 'element-plus/es/components/tree/src/model/node'; import { AllowDropType } from 'element-plus/es/components/tree/src/tree.type'; import { DndStructurePanelItemController } from './dnd-structure.controller'; -import { IDndStructureNodeData } from '../../interface'; +import { + IDndDesignPanelItemController, + IDndStructureNodeData, +} from '../../interface'; import { resource } from '../../global'; +import { modelStateUtil } from '../../utils'; import './dnd-structure.scss'; export default defineComponent({ @@ -86,6 +90,14 @@ export default defineComponent({ const allowDrag = (node: Node) => { const nodeData = node.data as IDndStructureNodeData; + const dndDesignController = props.controller.view.layoutPanel?.panelItems + .dnd_design_panel_item as IDndDesignPanelItemController; + const modelState = dndDesignController + ? dndDesignController.getModelState(nodeData.entity) + : 0; + if (!modelStateUtil.isEnableDrag(modelState)) { + return false; + } if (node.level === 0 || nodeData.type === 'FORMPAGE') { return false; } @@ -106,6 +118,19 @@ export default defineComponent({ ) => { const draggingNodeData = draggingNode.data as IDndStructureNodeData; const dropNodeData = dropNode.data as IDndStructureNodeData; + if (draggingNodeData.id !== dropNodeData.id) { + const parent = type === 'inner' ? dropNodeData : dropNodeData.parent; + if (parent && draggingNodeData.parent?.id !== parent.id) { + const dndDesignController = props.controller.view.layoutPanel + ?.panelItems.dnd_design_panel_item as IDndDesignPanelItemController; + const modelState = dndDesignController + ? dndDesignController.getModelState(parent.entity) + : 0; + if (!modelStateUtil.isEnableDrop(modelState)) { + return false; + } + } + } if (type === 'inner') { const containerType = ['GROUPPANEL', 'FORMPAGE']; if (containerType.includes(dropNodeData.type)) {