From 04684c18007086d7038738c664b3e15f81ed0e53 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Tue, 28 Feb 2023 18:48:35 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E8=84=91=E5=9B=BE=E7=B2=98=E8=B4=B4=E6=9C=AA=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E7=9A=84=E6=A8=A1=E5=9D=97=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1022391 --user=陈建星 【测试跟踪】功能用例-脑图模式-当只展开到模块层级时复制模块到其它模块下-用例未复制过去 https://www.tapd.cn/55049933/s/1343914 --- .../track/common/minder/TestCaseMinder.vue | 3 +- .../track/common/minder/minderUtils.js | 29 +++++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/frontend/src/business/components/track/common/minder/TestCaseMinder.vue b/frontend/src/business/components/track/common/minder/TestCaseMinder.vue index e21268e963..5b4cc51b9a 100644 --- a/frontend/src/business/components/track/common/minder/TestCaseMinder.vue +++ b/frontend/src/business/components/track/common/minder/TestCaseMinder.vue @@ -45,7 +45,7 @@ import { getChildNodeId, handleAfterSave, handleExpandToLevel, - handleMinderIssueDelete, handlePasteAfter, handleSaveError, + handleMinderIssueDelete, handlePasteAfter, handlePasteTip, handleSaveError, handleTestCaseAdd, handTestCaeEdit, isCaseNodeData, @@ -225,6 +225,7 @@ name: "TestCaseMinder", } if ('paste' === even.commandName) { + handlePasteTip(window.minder.getSelectedNode()); handlePasteAfter(window.minder.getSelectedNode()); } diff --git a/frontend/src/business/components/track/common/minder/minderUtils.js b/frontend/src/business/components/track/common/minder/minderUtils.js index 3b6ad3213a..188339b563 100644 --- a/frontend/src/business/components/track/common/minder/minderUtils.js +++ b/frontend/src/business/components/track/common/minder/minderUtils.js @@ -1,6 +1,6 @@ import i18n from "@/i18n/i18n"; import {getCurrentProjectID, getCurrentWorkspaceId} from "../../../../../common/js/utils"; -import {success, warning} from "../../../../../common/js/message"; +import {success, warning, info} from "../../../../../common/js/message"; import {deleteIssueRelate} from "@/network/Issue"; import {minderPageInfoMap} from "@/network/testCase"; import {setPriorityView} from "vue-minder-editor-plus/src/script/tool/utils"; @@ -530,7 +530,6 @@ export function handleAfterSave(rootNode) { rootNode.data.originId = null; rootNode.data.changed = false; rootNode.data.contextChanged = false; - rootNode.data.isExtraNode = false; if (isModuleNode(rootNode)) { rootNode.data.type = 'node'; } else if (isCaseNodeData(rootNode.data)) { @@ -548,7 +547,6 @@ export function handleSaveError(rootNode) { rootNode.data.id = rootNode.data.originId; } rootNode.data.originId = null; - rootNode.data.isExtraNode = false; if (rootNode.children) { for (let i = 0; i < rootNode.children.length; i++) { handleSaveError(rootNode.children[i]); @@ -595,6 +593,31 @@ export function getSelectedNodeData() { return node ? node.data : {}; } +export function handlePasteTip(rootNode) { + if (hasUnloadedNode(rootNode)) { + info('粘贴的节点中有未加载用例的模块,目前不支持复制未加载的用例!'); + } +} + +/** + * 判断节点下面是否有没有加载过用例的模块节点 + * @param rootNode + * @returns {boolean} + */ +export function hasUnloadedNode(rootNode) { + if (isModuleNode(rootNode) && !rootNode.data.loaded) { + return true; + } + if (rootNode.children) { + for (let i = 0; i < rootNode.children.length; i++) { + if (hasUnloadedNode(rootNode.children[i])) { + return true; + } + } + } + return false; +} + export function addIssueHotBox(vueObj) { let hotbox = window.minder.hotbox; let main = hotbox.state('main');