fix(测试跟踪): 脑图粘贴未加载用例的模块提示优化

--bug=1022391 --user=陈建星 【测试跟踪】功能用例-脑图模式-当只展开到模块层级时复制模块到其它模块下-用例未复制过去 https://www.tapd.cn/55049933/s/1343914
This commit is contained in:
chenjianxing 2023-02-28 18:48:35 +08:00 committed by jianxing
parent 2b13de1c94
commit 04684c1800
2 changed files with 28 additions and 4 deletions

View File

@ -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());
}

View File

@ -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');