refactor(测试跟踪): 用例脑图删除模块时添加二次确认

--bug=1025790 --user=陈建星 【测试跟踪】github#23973,脑图删除模块节点没有二次确认功能,表单模式下是有二次确认的。目前在脑图模式下,点击delete建,整个模块节点下的所有信息都直接删除了 https://www.tapd.cn/55049933/s/1369922
This commit is contained in:
chenjianxing 2023-05-08 17:11:24 +08:00 committed by jianxing
parent d06b05b152
commit 3b2f876e0f
2 changed files with 32 additions and 12 deletions

View File

@ -14,6 +14,7 @@
:priority-disable-check="priorityDisableCheck"
:distinct-tags="distinctTags"
:default-mold="defaultMode"
:del-confirm="delConfirm"
@afterMount="$emit('afterMount')"
@moldChange="handleMoldChange"
:disabled="disabled"
@ -84,6 +85,10 @@ export default {
},
getExtraNodeCount: {
type: Function
},
delConfirm: {
type: Function,
default: null
}
},
data() {

View File

@ -22,6 +22,7 @@
:priority-disable-check="priorityDisableCheck()"
:disabled="disabled"
:get-extra-node-count="getMinderTreeExtraNodeCount()"
:del-confirm="handleDeleteConfirm"
@afterMount="handleAfterMount"
@toggleMinderFullScreen="toggleMinderFullScreen"
@save="save"
@ -268,17 +269,6 @@ export default {
handlePasteAfter(window.minder.getSelectedNode());
}
if ('removenode' === even.commandName) {
let nodes = window.minder.getSelectedNodes();
if (nodes) {
nodes.forEach((node) => {
if (isModuleNodeData(node.data) && node.children && node.children.length > 0) {
this.$warning('删除模块将删除模块下的所有资源');
}
});
}
}
if ('resource' === even.commandName) {
//
setTimeout(() => setPriorityView(true, 'P'), 100);
@ -288,7 +278,7 @@ export default {
addIssueHotBox(this);
},
toggleMinderFullScreen(isFullScreen) {
this.$emit("toggleMinderFullScreen", isFullScreen)
this.$emit("toggleMinderFullScreen", isFullScreen);
},
getParam() {
return {
@ -301,6 +291,31 @@ export default {
isDisable: false
}
},
handleDeleteConfirm() {
let selectNodes = minder.getSelectedNodes();
let moduleName = '';
selectNodes.forEach(node => {
if (isModuleNode(node)) {
moduleName += node.data.text + ' ';
}
});
if (moduleName.length > 0) {
let title = this.$t('commons.confirm_delete') + ': ' + this.$t("project.project_file.file_module_type.module") + moduleName + "?";
this.$confirm(this.$t('test_track.module.delete_tip'), title, {
cancelButtonText: this.$t("commons.cancel"),
confirmButtonText: this.$t("commons.confirm"),
customClass: 'custom-confirm-delete',
callback: action => {
if (action === "confirm") {
minder.forceRemoveNode();
}
}
}
);
} else {
minder.forceRemoveNode();
}
},
setIsChange(isChanged) {
if (this.disabled) {
return;