fix(测试计划): 缺陷状态修改问题#1006338
--bug=1006338 --user=lyh 【github#5881】测试计划的测试用例里关联了缺陷,在测试计划的测试用例里关闭了缺陷,但是缺陷管理中对应的缺陷id状态还是新建 https://www.tapd.cn/55049933/s/1043941
This commit is contained in:
parent
a236d63a3c
commit
ed14cdc52a
|
@ -118,4 +118,9 @@ public class IssuesController {
|
||||||
public void getPlatformIssue(@PathVariable String projectId) {
|
public void getPlatformIssue(@PathVariable String projectId) {
|
||||||
issuesService.syncThirdPartyIssues(projectId);
|
issuesService.syncThirdPartyIssues(projectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/change/status")
|
||||||
|
public void changeStatus(@RequestBody IssuesRequest request) {
|
||||||
|
issuesService.changeStatus(request);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,4 +35,5 @@ public class IssuesRequest extends BaseQueryRequest {
|
||||||
private List<String> testCaseIds;
|
private List<String> testCaseIds;
|
||||||
|
|
||||||
private String requestType;
|
private String requestType;
|
||||||
|
private String status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package io.metersphere.track.service;
|
package io.metersphere.track.service;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import io.metersphere.base.domain.*;
|
import io.metersphere.base.domain.*;
|
||||||
|
@ -32,6 +33,7 @@ import io.metersphere.track.issue.domain.zentao.ZentaoBuild;
|
||||||
import io.metersphere.track.request.testcase.AuthUserIssueRequest;
|
import io.metersphere.track.request.testcase.AuthUserIssueRequest;
|
||||||
import io.metersphere.track.request.testcase.IssuesRequest;
|
import io.metersphere.track.request.testcase.IssuesRequest;
|
||||||
import io.metersphere.track.request.testcase.IssuesUpdateRequest;
|
import io.metersphere.track.request.testcase.IssuesUpdateRequest;
|
||||||
|
import io.metersphere.track.request.testcase.TestCaseBatchRequest;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||||
|
@ -557,4 +559,29 @@ public class IssuesService {
|
||||||
issueRequest.setResourceId(planId);
|
issueRequest.setResourceId(planId);
|
||||||
return extIssuesMapper.getIssues(issueRequest);
|
return extIssuesMapper.getIssues(issueRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void changeStatus(IssuesRequest request) {
|
||||||
|
String issuesId = request.getId();
|
||||||
|
String status = request.getStatus();
|
||||||
|
if (StringUtils.isBlank(issuesId) || StringUtils.isBlank(status)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IssuesWithBLOBs issues = issuesMapper.selectByPrimaryKey(issuesId);
|
||||||
|
String customFields = issues.getCustomFields();
|
||||||
|
if (StringUtils.isBlank(customFields)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<TestCaseBatchRequest.CustomFiledRequest> fields = JSONObject.parseArray(customFields, TestCaseBatchRequest.CustomFiledRequest.class);
|
||||||
|
for (TestCaseBatchRequest.CustomFiledRequest field : fields) {
|
||||||
|
if (StringUtils.equals("状态", field.getName())) {
|
||||||
|
field.setValue(status);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
issues.setCustomFields(JSONObject.toJSONString(fields));
|
||||||
|
issuesMapper.updateByPrimaryKeySelective(issues);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,25 +12,32 @@
|
||||||
v-loading="page.result.loading"
|
v-loading="page.result.loading"
|
||||||
:show-select-all="false"
|
:show-select-all="false"
|
||||||
:data="page.data"
|
:data="page.data"
|
||||||
|
:fields.sync="fields"
|
||||||
|
:operators="operators"
|
||||||
:enable-selection="false"
|
:enable-selection="false"
|
||||||
|
ref="table"
|
||||||
@refresh="getIssues">
|
@refresh="getIssues">
|
||||||
|
<span v-for="(item) in fields" :key="item.key">
|
||||||
|
<ms-table-column
|
||||||
|
:label="$t('test_track.issue.id')"
|
||||||
|
:field="item"
|
||||||
|
prop="id" v-if="false">
|
||||||
|
</ms-table-column>
|
||||||
|
<ms-table-column
|
||||||
|
:field="item"
|
||||||
|
:label="$t('test_track.issue.id')"
|
||||||
|
prop="num">
|
||||||
|
</ms-table-column>
|
||||||
|
|
||||||
<ms-table-column
|
<ms-table-column
|
||||||
:label="$t('test_track.issue.id')"
|
:field="item"
|
||||||
prop="id" v-if="false">
|
:label="$t('test_track.issue.title')"
|
||||||
</ms-table-column>
|
prop="title">
|
||||||
<ms-table-column
|
</ms-table-column>
|
||||||
:label="$t('test_track.issue.id')"
|
|
||||||
prop="num">
|
|
||||||
</ms-table-column>
|
|
||||||
|
|
||||||
<ms-table-column
|
|
||||||
:label="$t('test_track.issue.title')"
|
|
||||||
prop="title">
|
|
||||||
</ms-table-column>
|
|
||||||
|
|
||||||
<ms-table-column
|
<ms-table-column
|
||||||
:label="$t('test_track.issue.platform_status')"
|
:label="$t('test_track.issue.platform_status')"
|
||||||
|
:field="item"
|
||||||
v-if="isThirdPart"
|
v-if="isThirdPart"
|
||||||
prop="platformStatus">
|
prop="platformStatus">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
|
@ -40,6 +47,7 @@
|
||||||
|
|
||||||
<ms-table-column
|
<ms-table-column
|
||||||
v-else
|
v-else
|
||||||
|
:field="item"
|
||||||
:label="$t('test_track.issue.status')"
|
:label="$t('test_track.issue.status')"
|
||||||
prop="status">
|
prop="status">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
|
@ -47,32 +55,38 @@
|
||||||
</template>
|
</template>
|
||||||
</ms-table-column>
|
</ms-table-column>
|
||||||
|
|
||||||
<ms-table-column
|
<span v-for="field in issueTemplate.customFields" :key="field.id">
|
||||||
:label="$t('test_track.issue.platform')"
|
<ms-table-column :field="item" :label="field.name" :prop="field.name" v-if="field.name === '状态'">
|
||||||
prop="platform">
|
<template v-slot="scope">
|
||||||
</ms-table-column>
|
<el-dropdown class="test-case-status" @command="statusChange" v-if="isThirdPart" placement="bottom" trigger="click">
|
||||||
|
<span class="el-dropdown-link">
|
||||||
|
{{getCustomFieldValue(scope.row, field) ? getCustomFieldValue(scope.row, field) : issueStatusMap[scope.row.status]}}
|
||||||
|
</span>
|
||||||
|
<el-dropdown-menu slot="dropdown" chang>
|
||||||
|
<span v-for="(item, index) in status" :key="index">
|
||||||
|
<el-dropdown-item :command="{id: scope.row.id, status: item.value}">
|
||||||
|
{{item.system ? $t(item.text) : item.text}}
|
||||||
|
</el-dropdown-item>
|
||||||
|
</span>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</el-dropdown>
|
||||||
|
<span v-else>
|
||||||
|
{{getCustomFieldValue(scope.row, field) ? getCustomFieldValue(scope.row, field) : issueStatusMap[scope.row.status]}}
|
||||||
|
</span>
|
||||||
|
|
||||||
<issue-description-table-item/>
|
</template>
|
||||||
|
|
||||||
<el-table-column :label="$t('test_track.issue.operate')">
|
</ms-table-column>
|
||||||
<template v-slot:default="scope">
|
</span>
|
||||||
<el-tooltip :content="$t('test_track.issue.close')"
|
|
||||||
placement="top" :enterable="false">
|
|
||||||
<el-button type="danger" icon="el-icon-circle-close" size="mini"
|
|
||||||
circle :disabled="scope.row.platform !== 'Local'"
|
|
||||||
@click="closeIssue(scope.row)"
|
|
||||||
/>
|
|
||||||
</el-tooltip>
|
|
||||||
<el-tooltip :content="$t('test_track.case.unlink')"
|
|
||||||
placement="top" :enterable="false">
|
|
||||||
<el-button type="danger" icon="el-icon-unlock" size="mini"
|
|
||||||
circle :disabled="scope.row.platform !== 'Local'"
|
|
||||||
@click="deleteIssue(scope.row)"
|
|
||||||
/>
|
|
||||||
</el-tooltip>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
|
<ms-table-column
|
||||||
|
:field="item"
|
||||||
|
:label="$t('test_track.issue.platform')"
|
||||||
|
prop="platform">
|
||||||
|
</ms-table-column>
|
||||||
|
|
||||||
|
<issue-description-table-item :field="item"/>
|
||||||
|
</span>
|
||||||
</ms-table>
|
</ms-table>
|
||||||
|
|
||||||
<test-plan-issue-edit :plan-id="planId" :case-id="caseId" @refresh="getIssues" ref="issueEdit"/>
|
<test-plan-issue-edit :plan-id="planId" :case-id="caseId" @refresh="getIssues" ref="issueEdit"/>
|
||||||
|
@ -89,6 +103,7 @@ import {ISSUE_STATUS_MAP} from "@/common/js/table-constants";
|
||||||
import IssueRelateList from "@/business/components/track/case/components/IssueRelateList";
|
import IssueRelateList from "@/business/components/track/case/components/IssueRelateList";
|
||||||
import {getIssuesByCaseId} from "@/network/Issue";
|
import {getIssuesByCaseId} from "@/network/Issue";
|
||||||
import {getIssueTemplate} from "@/network/custom-field-template";
|
import {getIssueTemplate} from "@/network/custom-field-template";
|
||||||
|
import {getCustomFieldValue, getTableHeaderWithCustomFields} from "@/common/js/tableUtils";
|
||||||
export default {
|
export default {
|
||||||
name: "TestCaseIssueRelate",
|
name: "TestCaseIssueRelate",
|
||||||
components: {IssueRelateList, IssueDescriptionTableItem, MsTableColumn, MsTable, TestPlanIssueEdit},
|
components: {IssueRelateList, IssueDescriptionTableItem, MsTableColumn, MsTable, TestPlanIssueEdit},
|
||||||
|
@ -98,7 +113,18 @@ export default {
|
||||||
data: [],
|
data: [],
|
||||||
result: {},
|
result: {},
|
||||||
},
|
},
|
||||||
isThirdPart: false
|
isThirdPart: false,
|
||||||
|
issueTemplate: {},
|
||||||
|
fields: [],
|
||||||
|
operators:[
|
||||||
|
{
|
||||||
|
tip: this.$t('test_track.case.unlink'),
|
||||||
|
icon: "el-icon-unlock",
|
||||||
|
type: "danger",
|
||||||
|
exec: this.deleteIssue
|
||||||
|
}
|
||||||
|
],
|
||||||
|
status: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: ['caseId', 'readOnly','planId'],
|
props: ['caseId', 'readOnly','planId'],
|
||||||
|
@ -110,14 +136,43 @@ export default {
|
||||||
created() {
|
created() {
|
||||||
getIssueTemplate()
|
getIssueTemplate()
|
||||||
.then((template) => {
|
.then((template) => {
|
||||||
if (template.platform === 'metersphere') {
|
this.issueTemplate = template;
|
||||||
|
if (this.issueTemplate.platform === 'metersphere') {
|
||||||
this.isThirdPart = false;
|
this.isThirdPart = false;
|
||||||
} else {
|
} else {
|
||||||
this.isThirdPart = true;
|
this.isThirdPart = true;
|
||||||
}
|
}
|
||||||
|
if (template) {
|
||||||
|
let customFields = template.customFields;
|
||||||
|
for (let fields of customFields) {
|
||||||
|
if (fields.name === '状态') {
|
||||||
|
this.status = fields.options;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.fields = getTableHeaderWithCustomFields('ISSUE_LIST', this.issueTemplate.customFields);
|
||||||
|
if (!this.isThirdPart) {
|
||||||
|
for (let i = 0; i < this.fields.length; i++) {
|
||||||
|
if (this.fields[i].id === 'platformStatus') {
|
||||||
|
this.fields.splice(i, 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.$refs.table.reloadTable();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
statusChange(param) {
|
||||||
|
this.$post("/issues/change/status/", param, () => {
|
||||||
|
this.getIssues();
|
||||||
|
this.$success(this.$t('commons.modify_success'));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getCustomFieldValue(row, field) {
|
||||||
|
return getCustomFieldValue(row, field, this.members);
|
||||||
|
},
|
||||||
getIssues() {
|
getIssues() {
|
||||||
let result = getIssuesByCaseId(this.caseId, this.page);
|
let result = getIssuesByCaseId(this.caseId, this.page);
|
||||||
if (result) {
|
if (result) {
|
||||||
|
@ -163,4 +218,8 @@ export default {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
|
.el-dropdown-link {
|
||||||
|
cursor: pointer;
|
||||||
|
color: #783887;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue