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) {
|
||||
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 String requestType;
|
||||
private String status;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package io.metersphere.track.service;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
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.IssuesRequest;
|
||||
import io.metersphere.track.request.testcase.IssuesUpdateRequest;
|
||||
import io.metersphere.track.request.testcase.TestCaseBatchRequest;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
|
@ -557,4 +559,29 @@ public class IssuesService {
|
|||
issueRequest.setResourceId(planId);
|
||||
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"
|
||||
:show-select-all="false"
|
||||
:data="page.data"
|
||||
:fields.sync="fields"
|
||||
:operators="operators"
|
||||
:enable-selection="false"
|
||||
ref="table"
|
||||
@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
|
||||
:label="$t('test_track.issue.id')"
|
||||
prop="id" v-if="false">
|
||||
</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
|
||||
:field="item"
|
||||
:label="$t('test_track.issue.title')"
|
||||
prop="title">
|
||||
</ms-table-column>
|
||||
|
||||
<ms-table-column
|
||||
:label="$t('test_track.issue.platform_status')"
|
||||
:field="item"
|
||||
v-if="isThirdPart"
|
||||
prop="platformStatus">
|
||||
<template v-slot="scope">
|
||||
|
@ -40,6 +47,7 @@
|
|||
|
||||
<ms-table-column
|
||||
v-else
|
||||
:field="item"
|
||||
:label="$t('test_track.issue.status')"
|
||||
prop="status">
|
||||
<template v-slot="scope">
|
||||
|
@ -47,32 +55,38 @@
|
|||
</template>
|
||||
</ms-table-column>
|
||||
|
||||
<ms-table-column
|
||||
:label="$t('test_track.issue.platform')"
|
||||
prop="platform">
|
||||
</ms-table-column>
|
||||
<span v-for="field in issueTemplate.customFields" :key="field.id">
|
||||
<ms-table-column :field="item" :label="field.name" :prop="field.name" v-if="field.name === '状态'">
|
||||
<template v-slot="scope">
|
||||
<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')">
|
||||
<template v-slot:default="scope">
|
||||
<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>
|
||||
</span>
|
||||
|
||||
<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>
|
||||
|
||||
<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 {getIssuesByCaseId} from "@/network/Issue";
|
||||
import {getIssueTemplate} from "@/network/custom-field-template";
|
||||
import {getCustomFieldValue, getTableHeaderWithCustomFields} from "@/common/js/tableUtils";
|
||||
export default {
|
||||
name: "TestCaseIssueRelate",
|
||||
components: {IssueRelateList, IssueDescriptionTableItem, MsTableColumn, MsTable, TestPlanIssueEdit},
|
||||
|
@ -98,7 +113,18 @@ export default {
|
|||
data: [],
|
||||
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'],
|
||||
|
@ -110,14 +136,43 @@ export default {
|
|||
created() {
|
||||
getIssueTemplate()
|
||||
.then((template) => {
|
||||
if (template.platform === 'metersphere') {
|
||||
this.issueTemplate = template;
|
||||
if (this.issueTemplate.platform === 'metersphere') {
|
||||
this.isThirdPart = false;
|
||||
} else {
|
||||
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: {
|
||||
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() {
|
||||
let result = getIssuesByCaseId(this.caseId, this.page);
|
||||
if (result) {
|
||||
|
@ -163,4 +218,8 @@ export default {
|
|||
display: inline-block;
|
||||
margin-right: 5px;
|
||||
}
|
||||
.el-dropdown-link {
|
||||
cursor: pointer;
|
||||
color: #783887;
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue