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: "評審率",