From 728ea1bcfd0b28e104094eb4c3a2de215c7236ec Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Tue, 28 Feb 2023 18:23:29 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):?= =?UTF-8?q?=20=E8=84=91=E5=9B=BE=E7=B2=98=E8=B4=B4=E6=9C=AA=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E7=94=A8=E4=BE=8B=E7=9A=84=E6=A8=A1=E5=9D=97=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=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 --- .../business/common/minder/TestCaseMinder.vue | 3 ++- .../src/business/common/minder/minderUtils.js | 27 ++++++++++++++++++- test-track/frontend/src/i18n/lang/en-US.js | 1 + test-track/frontend/src/i18n/lang/zh-CN.js | 1 + test-track/frontend/src/i18n/lang/zh-TW.js | 1 + 5 files changed, 31 insertions(+), 2 deletions(-) diff --git a/test-track/frontend/src/business/common/minder/TestCaseMinder.vue b/test-track/frontend/src/business/common/minder/TestCaseMinder.vue index 1122486361..e00a430dc8 100644 --- a/test-track/frontend/src/business/common/minder/TestCaseMinder.vue +++ b/test-track/frontend/src/business/common/minder/TestCaseMinder.vue @@ -53,7 +53,7 @@ import { getChildNodeId, handleAfterSave, handleExpandToLevel, - handleMinderIssueDelete, handlePasteAfter, handleSaveError, + handleMinderIssueDelete, handlePasteAfter, handlePasteTip, handleSaveError, handleTestCaseAdd, handTestCaeEdit, isCaseNodeData, @@ -251,6 +251,7 @@ export default { } if ('paste' === even.commandName) { + handlePasteTip(window.minder.getSelectedNode()); handlePasteAfter(window.minder.getSelectedNode()); } diff --git a/test-track/frontend/src/business/common/minder/minderUtils.js b/test-track/frontend/src/business/common/minder/minderUtils.js index 11ce588866..927ffb4aaf 100644 --- a/test-track/frontend/src/business/common/minder/minderUtils.js +++ b/test-track/frontend/src/business/common/minder/minderUtils.js @@ -1,6 +1,6 @@ import i18n from "@/i18n"; import {getCurrentProjectID, getCurrentWorkspaceId} from "metersphere-frontend/src/utils/token"; -import {$success, $warning} from "metersphere-frontend/src/plugins/message"; +import {$success, $warning, $info} from "metersphere-frontend/src/plugins/message"; import {deleteIssueRelate} from "@/api/issue"; import {minderPageInfoMap} from "@/api/testCase"; import {setPriorityView} from "vue-minder-editor-plus/src/script/tool/utils"; @@ -571,6 +571,31 @@ export function handlePasteAfter(rootNode) { } } +export function handlePasteTip(rootNode) { + if (hasUnloadedNode(rootNode)) { + $info(i18n.t('case.minder_paste_tip')); + } +} + +/** + * 判断节点下面是否有没有加载过用例的模块节点 + * @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 getChildNodeId(rootNode, nodeIds) { //递归获取所有子节点ID if (rootNode.data.id) { diff --git a/test-track/frontend/src/i18n/lang/en-US.js b/test-track/frontend/src/i18n/lang/en-US.js index b3dd0f5788..9183d213c7 100644 --- a/test-track/frontend/src/i18n/lang/en-US.js +++ b/test-track/frontend/src/i18n/lang/en-US.js @@ -19,6 +19,7 @@ const message = { case_type: "Case Type", test_plan: "Test Plan", failure_times: "Failure times", + minder_paste_tip: "The pasted node has modules with unloaded use cases, copying unloaded use cases is not currently supported!" }, rate: { case_review: "Review rate", diff --git a/test-track/frontend/src/i18n/lang/zh-CN.js b/test-track/frontend/src/i18n/lang/zh-CN.js index c99cd36cc8..c320335c45 100644 --- a/test-track/frontend/src/i18n/lang/zh-CN.js +++ b/test-track/frontend/src/i18n/lang/zh-CN.js @@ -19,6 +19,7 @@ const message = { case_type: "用例类型", test_plan: "所属测试计划", failure_times: "失败次数", + minder_paste_tip: "粘贴的节点中有未加载用例的模块,目前不支持复制未加载的用例!" }, rate: { case_review: "评审率", diff --git a/test-track/frontend/src/i18n/lang/zh-TW.js b/test-track/frontend/src/i18n/lang/zh-TW.js index ca19268933..bd5bd6274e 100644 --- a/test-track/frontend/src/i18n/lang/zh-TW.js +++ b/test-track/frontend/src/i18n/lang/zh-TW.js @@ -19,6 +19,7 @@ const message = { case_type: "用例類型", test_plan: "所屬測試計劃", failure_times: "失敗次數", + minder_paste_tip: "粘貼的節點中有未加載用例的模塊,目前不支持復製未加載的用例!" }, rate: { case_review: "評審率",