fix(测试计划): 脑图删除未保存节点问题修复

This commit is contained in:
baiqi 2024-08-21 10:23:43 +08:00 committed by 刘瑞斌
parent f45bf56307
commit 756fbddcd6
1 changed files with 24 additions and 0 deletions

View File

@ -22,6 +22,7 @@
sequence-enable
@node-select="(node) => handleNodeSelect(node as PlanMinderNode)"
@before-exec-command="handleBeforeExecCommand"
@action="handleAction"
@save="handleMinderSave"
>
<template #extractMenu>
@ -254,6 +255,7 @@
import { useI18n } from '@/hooks/useI18n';
import useAppStore from '@/store/modules/app';
import useMinderStore from '@/store/modules/components/minder-editor';
import { MinderCustomEvent } from '@/store/modules/components/minder-editor/types';
import { filterTree, getGenerateId, mapTree } from '@/utils';
import { hasAnyPermission } from '@/utils/permission';
@ -807,6 +809,28 @@
}
}
/**
* 处理脑图节点操作
* @param event 脑图事件对象
*/
function handleAction(event: MinderCustomEvent) {
const { nodes, name } = event;
if (nodes && nodes.length > 0) {
switch (name) {
case MinderEventName.DELETE_NODE:
case MinderEventName.CUT_NODE:
nodes.forEach((node) => {
if (node.data?.id === activePlanSet.value?.data.id) {
handleConfigCancel();
}
});
break;
default:
break;
}
}
}
function handleExtendChange(val: string | number | boolean) {
if (val && configForm.value) {
const node: PlanMinderNode = window.minder.getNodeById(configForm.value.id);