feat(脑图): 脑图批量删除
This commit is contained in:
parent
00b0df2c33
commit
122c54691a
|
@ -15,8 +15,7 @@
|
||||||
:can-show-float-menu="canShowFloatMenu"
|
:can-show-float-menu="canShowFloatMenu"
|
||||||
:can-show-delete-menu="canShowDeleteMenu"
|
:can-show-delete-menu="canShowDeleteMenu"
|
||||||
:disabled="!hasEditPermission"
|
:disabled="!hasEditPermission"
|
||||||
:can-show-batch-delete="true"
|
:can-show-batch-delete="canShowBatchDelete"
|
||||||
can-show-more-batch-menu
|
|
||||||
custom-priority
|
custom-priority
|
||||||
single-tag
|
single-tag
|
||||||
tag-enable
|
tag-enable
|
||||||
|
@ -346,8 +345,10 @@
|
||||||
canShowDeleteMenu.value = true;
|
canShowDeleteMenu.value = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
canShowFloatMenu.value = data.id === 'root';
|
nextTick(() => {
|
||||||
canShowExecuteMethodMenu.value = data.id === 'root';
|
canShowFloatMenu.value = node.data.id === 'root';
|
||||||
|
canShowExecuteMethodMenu.value = node.data.id === 'root';
|
||||||
|
});
|
||||||
showAssociateCaseMenu.value = false;
|
showAssociateCaseMenu.value = false;
|
||||||
showConfigMenu.value = false;
|
showConfigMenu.value = false;
|
||||||
extraVisible.value = false;
|
extraVisible.value = false;
|
||||||
|
@ -663,6 +664,29 @@
|
||||||
configFormUnsaved.value = false;
|
configFormUnsaved.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否可以显示批量删除
|
||||||
|
*/
|
||||||
|
const canShowBatchDelete = ref(false);
|
||||||
|
watch(
|
||||||
|
() => minderStore.event.eventId,
|
||||||
|
async () => {
|
||||||
|
if (window.minder) {
|
||||||
|
const selectedNodes: MinderJsonNode[] = window.minder.getSelectedNodes();
|
||||||
|
if (
|
||||||
|
minderStore.event.name === MinderEventName.DRAG_FINISH ||
|
||||||
|
minderStore.event.name === MinderEventName.NODE_UNSELECT ||
|
||||||
|
minderStore.event.name === MinderEventName.NODE_SELECT
|
||||||
|
) {
|
||||||
|
canShowBatchDelete.value = selectedNodes.every((node) => node.data?.level === 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
immediate: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理节点选中
|
* 处理节点选中
|
||||||
* @param node 节点
|
* @param node 节点
|
||||||
|
|
|
@ -41,8 +41,13 @@
|
||||||
</template>
|
</template>
|
||||||
</a-dropdown>
|
</a-dropdown>
|
||||||
<slot name="batchMenu"></slot>
|
<slot name="batchMenu"></slot>
|
||||||
|
<a-tooltip v-if="onlyDelete" :content="t('common.delete')">
|
||||||
|
<MsButton type="icon" class="ms-minder-node-float-menu-icon-button" @click="handleMinderMenuSelect('delete')">
|
||||||
|
<MsIcon type="icon-icon_delete-trash_outlined1" class="text-[var(--color-text-4)]" />
|
||||||
|
</MsButton>
|
||||||
|
</a-tooltip>
|
||||||
<a-dropdown
|
<a-dropdown
|
||||||
v-if="props.canShowMoreBatchMenu"
|
v-else-if="props.canShowMoreBatchMenu"
|
||||||
v-model:popup-visible="moreMenuVisible"
|
v-model:popup-visible="moreMenuVisible"
|
||||||
class="ms-minder-dropdown"
|
class="ms-minder-dropdown"
|
||||||
:popup-translate="[0, -4]"
|
:popup-translate="[0, -4]"
|
||||||
|
@ -133,7 +138,8 @@
|
||||||
const selectedNodes: MinderJsonNode[] = window.minder.getSelectedNodes();
|
const selectedNodes: MinderJsonNode[] = window.minder.getSelectedNodes();
|
||||||
if (
|
if (
|
||||||
minderStore.event.name === MinderEventName.DRAG_FINISH ||
|
minderStore.event.name === MinderEventName.DRAG_FINISH ||
|
||||||
minderStore.event.name === MinderEventName.NODE_UNSELECT
|
minderStore.event.name === MinderEventName.NODE_UNSELECT ||
|
||||||
|
minderStore.event.name === MinderEventName.NODE_SELECT
|
||||||
) {
|
) {
|
||||||
batchMenuVisible.value = selectedNodes.length > 1;
|
batchMenuVisible.value = selectedNodes.length > 1;
|
||||||
}
|
}
|
||||||
|
@ -144,6 +150,10 @@
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const onlyDelete = computed(() => {
|
||||||
|
return props.canShowBatchDelete && !props.canShowBatchCopy && !props.canShowBatchCut && !props.canShowBatchExpand;
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理快捷菜单选择
|
* 处理快捷菜单选择
|
||||||
* @param type 选择的菜单项
|
* @param type 选择的菜单项
|
||||||
|
|
|
@ -134,13 +134,8 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
delete: () => {
|
delete: () => {
|
||||||
if (
|
|
||||||
(props.canShowDeleteMenu || (props.canShowMoreMenu && props.canShowMoreMenuNodeOperation)) &&
|
|
||||||
!props.disabled
|
|
||||||
) {
|
|
||||||
const selectedNodes: MinderJsonNode[] = window.minder.getSelectedNodes();
|
const selectedNodes: MinderJsonNode[] = window.minder.getSelectedNodes();
|
||||||
minderDelete(selectedNodes);
|
minderDelete(selectedNodes);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
expand: () => {
|
expand: () => {
|
||||||
const selectedNodes: MinderJsonNode[] = window.minder.getSelectedNodes();
|
const selectedNodes: MinderJsonNode[] = window.minder.getSelectedNodes();
|
||||||
|
|
Loading…
Reference in New Issue