feat: 脑图缺陷支持编辑

This commit is contained in:
chenjianxing 2021-11-22 14:31:21 +08:00 committed by jianxing
parent 59f61557e3
commit 224eeb945f
10 changed files with 59 additions and 12 deletions

View File

@ -45,7 +45,7 @@
not exists (
select id
from custom_field cf_child
where cf_child.name = cf.name and cf_child.global != 1 and cf_child.workspace_id = #{request.workspaceId}
where cf_child.name = cf.name and cf_child.scene = cf.scene and cf_child.global != 1 and cf_child.workspace_id = #{request.workspaceId}
)
)
)

View File

@ -57,11 +57,16 @@ public class IssuesController {
issuesService.updateIssues(issuesRequest);
}
@GetMapping("/get/{id}")
@GetMapping("/get/case/{id}")
public List<IssuesDao> getIssues(@PathVariable String id) {
return issuesService.getIssues(id);
}
@GetMapping("/get/{id}")
public IssuesWithBLOBs getIssue(@PathVariable String id) {
return issuesService.getIssue(id);
}
@GetMapping("/plan/get/{planId}")
public List<IssuesDao> getIssuesByPlanoId(@PathVariable String planId) {
return issuesService.getIssuesByPlanoId(planId);

View File

@ -161,6 +161,7 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform {
}
protected void handleTestCaseIssues(IssuesUpdateRequest issuesRequest) {
if (!issuesRequest.isWithCaseId()) return;
String issuesId = issuesRequest.getId();
if (StringUtils.isNotBlank(issuesRequest.getTestCaseId())) {
insertTestCaseIssues(issuesId, issuesRequest.getTestCaseId());

View File

@ -12,6 +12,8 @@ public class IssuesUpdateRequest extends IssuesWithBLOBs {
private String content;
private String testCaseId;
private String workspaceId;
// 带caseId的更新, 默认更新是同时保存用例的关联关系脑图保存缺陷不带caseId
private boolean withCaseId = true;
private List<String> tapdUsers;
/**

View File

@ -176,6 +176,10 @@ public class IssuesService {
return getIssuesByProjectIdOrCaseId(issueRequest);
}
public IssuesWithBLOBs getIssue(String id) {
return issuesMapper.selectByPrimaryKey(id);
}
public List<IssuesDao> getIssuesByProjectIdOrCaseId(IssuesRequest issueRequest) {
List<IssuesDao> issues;
if (StringUtils.isNotBlank(issueRequest.getProjectId())) {

View File

@ -39,6 +39,7 @@ import {getTestCasesForMinder, getMinderExtraNode} from "@/network/testCase";
import {addIssueHotBox, getSelectedNodeData, handleIssueAdd, handleIssueBatch} from "./minderUtils";
import IssueRelateList from "@/business/components/track/case/components/IssueRelateList";
import TestPlanIssueEdit from "@/business/components/track/case/components/TestPlanIssueEdit";
import {getIssuesById} from "@/network/Issue";
export default {
name: "TestCaseMinder",
components: {TestPlanIssueEdit, IssueRelateList, MsModuleMinder},
@ -107,11 +108,17 @@ name: "TestCaseMinder",
let minder = window.minder;
let selectNodes = minder.getSelectedNodes();
let isNotDisableNode = false;
//
selectNodes.forEach(node => {
//
if (!node.data.disable) {
isNotDisableNode = true;
}
if (node.data.type === 'issue') {
getIssuesById(node.data.id, (data) => {
data.customFields = JSON.parse(data.customFields);
this.$refs.issueEdit.open(data);
});
}
});
if (isNotDisableNode) {
this.setIsChange(true);

View File

@ -23,12 +23,13 @@
import MsModuleMinder from "@/business/components/common/components/MsModuleMinder";
import {
handleExpandToLevel, listenBeforeExecCommand, listenNodeSelected, loadSelectNodes,
tagBatch, getSelectedNodeData, handleIssueAdd, handleIssueBatch
tagBatch, getSelectedNodeData, handleIssueAdd, handleIssueBatch, listenDblclick
} from "@/business/components/track/common/minder/minderUtils";
import {getPlanCasesForMinder} from "@/network/testCase";
import IssueRelateList from "@/business/components/track/case/components/IssueRelateList";
import TestPlanIssueEdit from "@/business/components/track/case/components/TestPlanIssueEdit";
import {addIssueHotBox} from "./minderUtils";
import {getIssuesById} from "@/network/Issue";
export default {
name: "TestPlanMinder",
components: {MsModuleMinder, TestPlanIssueEdit, IssueRelateList},
@ -76,9 +77,9 @@ name: "TestPlanMinder",
}
},
methods: {
handleAfterMount() {
handleAfterMount: function () {
listenNodeSelected(() => {
loadSelectNodes(this.getParam(), getPlanCasesForMinder, this.setParamCallback);
loadSelectNodes(this.getParam(), getPlanCasesForMinder, this.setParamCallback);
});
listenBeforeExecCommand((even) => {
if (even.commandName === 'expandtolevel') {
@ -87,6 +88,16 @@ name: "TestPlanMinder",
}
});
listenDblclick(() => {
let data = getSelectedNodeData();
if (data.type === 'issue') {
getIssuesById(data.id, (data) => {
data.customFields = JSON.parse(data.customFields);
this.$refs.issueEdit.open(data);
});
}
});
tagBatch([...this.tags, this.$t('test_track.plan.plan_status_prepare')]);
addIssueHotBox(this);

View File

@ -108,17 +108,25 @@ export function handleTestCaseAdd(pid, data) {
});
}
export function appendIssueChildNode(pNode, issue) {
let data = getNodeData('缺陷ID' + issue.num, null, true, 'issue');
data.id = issue.id;
appendChildNode(pNode, data);
}
export function handleIssueAdd(data) {
let pNode = getSelectedNode();
appendChildNode(pNode, getNodeData('缺陷ID' + data.num, null, true));
if (data && data.id) {
let pNode = getSelectedNode();
appendIssueChildNode(pNode, data);
expandNode(pNode);
pNode.render();
}
}
export function handleIssueBatch(issues) {
let pNode = getSelectedNode();
issues.forEach(item => {
appendChildNode(pNode, getNodeData('缺陷ID' + item.num, null, true));
appendIssueChildNode(pNode, item);
});
expandNode(pNode);
pNode.render();
@ -241,12 +249,12 @@ export function appendCase(parent, item, isDisable, setParamCallback) {
if (item.issueList && item.issueList.length > 0) {
item.issueList.forEach(issue => {
appendChildNode(caseNode, getNodeData('缺陷ID' + issue.num, null, true));
appendIssueChildNode(caseNode, issue);
});
}
}
function getNodeData(text, resource, isDisable) {
function getNodeData(text, resource, isDisable, type) {
if (text) {
let data = {
text: text,
@ -255,6 +263,9 @@ function getNodeData(text, resource, isDisable) {
if (isDisable) {
data.disable = true;
}
if (type) {
data.type = type;
}
return data;
}
}

View File

@ -275,7 +275,9 @@ export default {
buildCustomFields(this.form, param, this.issueTemplate);
if (this.isPlan) {
param.testCaseIds = [this.caseId];
param.withCaseId = false;
} else {
param.withCaseId = true;
param.testCaseIds = Array.from(this.testCaseContainIds);
}
if (this.planId) {

View File

@ -26,13 +26,17 @@ export function getIssues(page) {
export function getIssuesByCaseId(caseId, page) {
if (caseId) {
return get('issues/get/' + caseId, (response) => {
return get('issues/get/case/' + caseId, (response) => {
page.data = response.data;
buildIssues(page);
});
}
}
export function getIssuesById(id, callback) {
return id ? baseGet('/issues/get/' + id, callback) : {};
}
export function getIssuesByPlanId(planId, callback) {
return planId ? baseGet('/issues/plan/get/' + planId, callback) : {};
}