fix(用例脑图): 虚拟节点下可添加模块节点

This commit is contained in:
baiqi 2024-08-14 18:30:15 +08:00 committed by 刘瑞斌
parent d3c5e73f61
commit bc0bbcdc32
2 changed files with 7 additions and 4 deletions

View File

@ -263,12 +263,15 @@ export default function useMinderBaseApi({ hasEditPermission }: { hasEditPermiss
if ( if (
Object.keys(node.data || {}).length === 0 || Object.keys(node.data || {}).length === 0 ||
node.data?.id === 'root' || node.data?.id === 'root' ||
(node.parent?.data?.resource || []).length === 0 || (node.parent?.data?.resource || []).length === 0
node.parent?.data?.id === 'NONE'
) { ) {
// 没有数据的节点、默认模块节点、父节点为文本节点、父节点为NONE虚拟根节点的节点不可替换标签 // 没有数据的节点、默认模块节点、父节点为文本节点的节点不可替换标签
return []; return [];
} }
if (node.parent?.data?.id === 'NONE') {
// 父节点为NONE虚拟根节点下只能替换为模块标签
return [moduleTag];
}
if (node.data?.resource?.some((e) => topTags.includes(e))) { if (node.data?.resource?.some((e) => topTags.includes(e))) {
// 选中节点属于顶级节点,可替换为除自身外的顶级标签 // 选中节点属于顶级节点,可替换为除自身外的顶级标签
return !node.children || node.children.length === 0 return !node.children || node.children.length === 0

View File

@ -18,7 +18,7 @@
@change="(val) => handleTagChange(val as string)" @change="(val) => handleTagChange(val as string)"
> >
<a-radio v-for="tag of currentNodeTags" :key="tag" :value="tag">{{ tag }}</a-radio> <a-radio v-for="tag of currentNodeTags" :key="tag" :value="tag">{{ tag }}</a-radio>
<a-radio v-for="tag of tags" :key="tag" :value="tag">{{ tag }}</a-radio> <a-radio v-for="tag of tags.filter((e) => e !== currentNodeTags[0])" :key="tag" :value="tag">{{ tag }}</a-radio>
</a-radio-group> </a-radio-group>
<a-dropdown <a-dropdown
v-if="props.insertSiblingMenus.length > 0" v-if="props.insertSiblingMenus.length > 0"