feat: 脑图缺陷支持取消关联

This commit is contained in:
chenjianxing 2021-11-22 17:54:55 +08:00 committed by 刘瑞斌
parent b8067ff078
commit dc13c1c698
6 changed files with 54 additions and 10 deletions

View File

@ -54,7 +54,7 @@
"vue-float-action-button": "^0.6.6",
"vue-i18n": "^8.15.3",
"vue-jsonpath-picker": "^1.1.5",
"vue-minder-editor-plus": "1.0.36",
"vue-minder-editor-plus": "1.0.38",
"vue-papa-parse": "^2.0.0",
"vue-pdf": "^4.2.0",
"vue-router": "^3.1.3",

View File

@ -97,7 +97,7 @@ import MsTableColumn from "@/business/components/common/components/table/MsTable
import IssueDescriptionTableItem from "@/business/components/track/issue/IssueDescriptionTableItem";
import {ISSUE_STATUS_MAP} from "@/common/js/table-constants";
import IssueRelateList from "@/business/components/track/case/components/IssueRelateList";
import {getIssuesByCaseId} from "@/network/Issue";
import {deleteIssueRelate, getIssuesByCaseId} from "@/network/Issue";
import {getIssueTemplate} from "@/network/custom-field-template";
import {getCustomFieldValue, getTableHeaderWithCustomFields} from "@/common/js/tableUtils";
export default {
@ -201,10 +201,10 @@ export default {
}
},
deleteIssue(row) {
this.page.result = this.$post("/issues/delete/relate", {id: row.id, caseId: this.caseId}, () => {
this.page.result = deleteIssueRelate({id: row.id, caseId: this.caseId}, () => {
this.getIssues();
this.$success(this.$t('commons.delete_success'));
})
});
},
}
}

View File

@ -27,7 +27,7 @@ import MsModuleMinder from "@/business/components/common/components/MsModuleMind
import {
getChildNodeId,
handleAfterSave,
handleExpandToLevel, handleTestCaseAdd, handTestCaeEdit, isModuleNode, isModuleNodeData,
handleExpandToLevel, handleMinderIssueDelete, handleTestCaseAdd, handTestCaeEdit, isModuleNode, isModuleNodeData,
listenBeforeExecCommand, listenDblclick,
listenNodeSelected,
loadSelectNodes,
@ -130,7 +130,10 @@ name: "TestCaseMinder",
let level = Number.parseInt(even.commandArgs);
handleExpandToLevel(level, even.minder.getRoot(), this.getParam(), getTestCasesForMinder);
}
if (['priority', 'resource', 'removenode', 'appendchildnode', 'appendparentnode', 'appendsiblingnode'].indexOf(even.commandName) > 0) {
if (handleMinderIssueDelete(even.commandName)) return; //
if (['priority', 'resource', 'removenode', 'appendchildnode', 'appendparentnode', 'appendsiblingnode'].indexOf(even.commandName) > -1) {
//
this.setIsChange(true);
}

View File

@ -23,7 +23,7 @@
import MsModuleMinder from "@/business/components/common/components/MsModuleMinder";
import {
handleExpandToLevel, listenBeforeExecCommand, listenNodeSelected, loadSelectNodes,
tagBatch, getSelectedNodeData, handleIssueAdd, handleIssueBatch, listenDblclick
tagBatch, getSelectedNodeData, handleIssueAdd, handleIssueBatch, listenDblclick, handleMinderIssueDelete
} from "@/business/components/track/common/minder/minderUtils";
import {getPlanCasesForMinder} from "@/network/testCase";
import IssueRelateList from "@/business/components/track/case/components/IssueRelateList";
@ -86,6 +86,9 @@ name: "TestPlanMinder",
let level = Number.parseInt(even.commandArgs);
handleExpandToLevel(level, even.minder.getRoot(), this.getParam(), getPlanCasesForMinder, this.setParamCallback);
}
if (handleMinderIssueDelete(even.commandName, true)) return; //
});
listenDblclick(() => {
@ -173,6 +176,7 @@ name: "TestPlanMinder",
},
refreshRelateIssue(issues) {
handleIssueBatch(issues);
this.$success('关联成功');
}
}
}

View File

@ -1,6 +1,7 @@
import i18n from "@/i18n/i18n";
import {getCurrentProjectID} from "../../../../../common/js/utils";
import {warning} from "../../../../../common/js/message";
import {success, warning} from "../../../../../common/js/message";
import {deleteIssueRelate} from "@/network/Issue";
export function listenNodeSelected(callback) {
let minder = window.minder;
@ -38,6 +39,10 @@ export function listenBeforeExecCommand(callback) {
});
}
export function getSelectedNodes() {
return window.minder.getSelectedNodes();
}
/**
* 加载模块下的用例
* @param projectId
@ -111,6 +116,7 @@ export function handleTestCaseAdd(pid, data) {
export function appendIssueChildNode(pNode, issue) {
let data = getNodeData('缺陷ID' + issue.num, null, true, 'issue');
data.id = issue.id;
data.allowDelete = true;
appendChildNode(pNode, data);
}
@ -517,3 +523,32 @@ export function addIssueHotBox(vueObj) {
}
});
}
export function handleMinderIssueDelete(commandName, isPlan) {
if (commandName.toLocaleLowerCase() === 'removenode') {
let nodes = getSelectedNodes();
if (nodes && nodes.length > 0) {
let isAllIssue = true;
let promises = [];
nodes.forEach(node => {
let data = node.data;
if (data.type === 'issue') {
let caseId = isPlan ? node.parent.data.caseId : node.parent.data.id
let p = new Promise((resolve) => {
deleteIssueRelate({id: data.id, caseId: caseId}, () => {
resolve();
});
});
promises.push(p);
} else {
isAllIssue = false;
}
});
Promise.all(promises).then(() => {
success('取消缺陷关联成功');
});
return isAllIssue;
}
}
return false;
}

View File

@ -1,7 +1,7 @@
import {post, get} from "@/common/js/ajax";
import {getPageDate} from "@/common/js/tableUtils";
import {getCurrentProjectID, hasLicense} from "@/common/js/utils";
import {baseGet} from "@/network/base-network";
import {baseGet, basePost} from "@/network/base-network";
export function buildIssues(page) {
let data = page.data;
@ -89,4 +89,6 @@ export function syncIssues(success) {
});
}
export function deleteIssueRelate(param, callback) {
return basePost('/issues/delete/relate', param, callback);
}