refactor(缺陷管理): 创建缺陷
This commit is contained in:
parent
d9f911f76a
commit
ca1941c7c2
|
@ -64,19 +64,19 @@ public class IssuesController {
|
|||
issuesService.delete(id);
|
||||
}
|
||||
|
||||
@GetMapping("/tapd/user/{caseId}")
|
||||
public List<PlatformUser> getTapdUsers(@PathVariable String caseId) {
|
||||
return issuesService.getTapdProjectUsers(caseId);
|
||||
@PostMapping("/tapd/user")
|
||||
public List<PlatformUser> getTapdUsers(@RequestBody IssuesRequest request) {
|
||||
return issuesService.getTapdProjectUsers(request);
|
||||
}
|
||||
|
||||
@GetMapping("/zentao/user/{caseId}")
|
||||
public List<PlatformUser> getZentaoUsers(@PathVariable String caseId) {
|
||||
return issuesService.getZentaoUsers(caseId);
|
||||
@PostMapping("/zentao/user")
|
||||
public List<PlatformUser> getZentaoUsers(@RequestBody IssuesRequest request) {
|
||||
return issuesService.getZentaoUsers(request);
|
||||
}
|
||||
|
||||
@GetMapping("/zentao/builds/{caseId}")
|
||||
public List<ZentaoBuild> getZentaoBuilds(@PathVariable String caseId) {
|
||||
return issuesService.getZentaoBuilds(caseId);
|
||||
@PostMapping("/zentao/builds")
|
||||
public List<ZentaoBuild> getZentaoBuilds(@RequestBody IssuesRequest request) {
|
||||
return issuesService.getZentaoBuilds(request);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform {
|
|||
protected RestTemplate restTemplateIgnoreSSL;
|
||||
|
||||
protected String testCaseId;
|
||||
protected String projectId;
|
||||
protected String key;
|
||||
|
||||
public String getKey() {
|
||||
|
@ -78,6 +79,7 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform {
|
|||
this.issuesMapper = CommonBeanFactory.getBean(IssuesMapper.class);
|
||||
this.extIssuesMapper = CommonBeanFactory.getBean(ExtIssuesMapper.class);
|
||||
this.testCaseId = issuesRequest.getTestCaseId();
|
||||
this.projectId = issuesRequest.getProjectId();
|
||||
//
|
||||
this.restTemplateIgnoreSSL = restTemplate;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,12 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
|||
List<IssuesDao> list = new ArrayList<>();
|
||||
|
||||
issuesRequest.setPlatform(IssuesManagePlatform.Jira.toString());
|
||||
List<IssuesDao> issues = extIssuesMapper.getIssuesByCaseId(issuesRequest);
|
||||
List<IssuesDao> issues;
|
||||
if (StringUtils.isNotBlank(issuesRequest.getProjectId())) {
|
||||
issues = extIssuesMapper.getIssuesByProjectId(issuesRequest);
|
||||
} else {
|
||||
issues = extIssuesMapper.getIssuesByCaseId(issuesRequest);
|
||||
}
|
||||
|
||||
String config = getPlatformConfig(IssuesManagePlatform.Jira.toString());
|
||||
JSONObject object = JSON.parseObject(config);
|
||||
|
@ -176,7 +181,7 @@ public class JiraPlatform extends AbstractIssuePlatform {
|
|||
}
|
||||
String auth = EncryptUtils.base64Encoding(account + ":" + password);
|
||||
|
||||
String jiraKey = getProjectId(null);
|
||||
String jiraKey = getProjectId(issuesRequest.getProjectId());
|
||||
|
||||
|
||||
if (StringUtils.isBlank(jiraKey)) {
|
||||
|
|
|
@ -10,6 +10,7 @@ import io.metersphere.track.dto.DemandDTO;
|
|||
import io.metersphere.track.issue.domain.PlatformUser;
|
||||
import io.metersphere.track.request.testcase.IssuesRequest;
|
||||
import io.metersphere.track.request.testcase.IssuesUpdateRequest;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
@ -24,7 +25,11 @@ public class LocalPlatform extends AbstractIssuePlatform {
|
|||
|
||||
@Override
|
||||
public List<IssuesDao> getIssue(IssuesRequest issuesRequest) {
|
||||
String projectId = issuesRequest.getProjectId();
|
||||
issuesRequest.setPlatform(IssuesManagePlatform.Local.toString());
|
||||
if (StringUtils.isNotBlank(projectId)) {
|
||||
return extIssuesMapper.getIssuesByProjectId(issuesRequest);
|
||||
}
|
||||
return extIssuesMapper.getIssuesByCaseId(issuesRequest);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,13 +38,18 @@ public class TapdPlatform extends AbstractIssuePlatform {
|
|||
@Override
|
||||
public List<IssuesDao> getIssue(IssuesRequest issuesRequest) {
|
||||
List<IssuesDao> list = new ArrayList<>();
|
||||
String tapdId = getProjectId("");
|
||||
String tapdId = getProjectId(issuesRequest.getProjectId());
|
||||
|
||||
TestCaseIssuesExample example = new TestCaseIssuesExample();
|
||||
example.createCriteria().andTestCaseIdEqualTo(testCaseId);
|
||||
// TestCaseIssuesExample example = new TestCaseIssuesExample();
|
||||
// example.createCriteria().andTestCaseIdEqualTo(testCaseId);
|
||||
|
||||
issuesRequest.setPlatform(IssuesManagePlatform.Tapd.toString());
|
||||
List<IssuesDao> issues = extIssuesMapper.getIssuesByCaseId(issuesRequest);
|
||||
List<IssuesDao> issues;
|
||||
if (StringUtils.isNotBlank(issuesRequest.getProjectId())) {
|
||||
issues = extIssuesMapper.getIssuesByProjectId(issuesRequest);
|
||||
} else {
|
||||
issues = extIssuesMapper.getIssuesByCaseId(issuesRequest);
|
||||
}
|
||||
|
||||
List<String> issuesIds = issues.stream().map(Issues::getId).collect(Collectors.toList());
|
||||
issuesIds.forEach(issuesId -> {
|
||||
|
@ -52,9 +57,11 @@ public class TapdPlatform extends AbstractIssuePlatform {
|
|||
if (StringUtils.isBlank(dto.getId())) {
|
||||
// 缺陷不存在,解除用例和缺陷的关联
|
||||
TestCaseIssuesExample issuesExample = new TestCaseIssuesExample();
|
||||
issuesExample.createCriteria()
|
||||
.andTestCaseIdEqualTo(testCaseId)
|
||||
.andIssuesIdEqualTo(issuesId);
|
||||
TestCaseIssuesExample.Criteria criteria = issuesExample.createCriteria();
|
||||
if (StringUtils.isNotBlank(testCaseId)) {
|
||||
criteria.andTestCaseIdEqualTo(testCaseId);
|
||||
}
|
||||
criteria.andIssuesIdEqualTo(issuesId);
|
||||
testCaseIssuesMapper.deleteByExample(issuesExample);
|
||||
issuesMapper.deleteByPrimaryKey(issuesId);
|
||||
} else {
|
||||
|
@ -144,7 +151,7 @@ public class TapdPlatform extends AbstractIssuePlatform {
|
|||
|
||||
String url = "https://api.tapd.cn/bugs";
|
||||
String testCaseId = issuesRequest.getTestCaseId();
|
||||
String tapdId = getProjectId("");
|
||||
String tapdId = getProjectId(issuesRequest.getProjectId());
|
||||
|
||||
if (StringUtils.isBlank(tapdId)) {
|
||||
MSException.throwException("未关联Tapd 项目ID");
|
||||
|
@ -206,8 +213,8 @@ public class TapdPlatform extends AbstractIssuePlatform {
|
|||
@Override
|
||||
public List<PlatformUser> getPlatformUser() {
|
||||
List<PlatformUser> users = new ArrayList<>();
|
||||
String projectId = getProjectId("");
|
||||
String url = "https://api.tapd.cn/workspaces/users?workspace_id=" + projectId;
|
||||
String id = getProjectId(projectId);
|
||||
String url = "https://api.tapd.cn/workspaces/users?workspace_id=" + id;
|
||||
ResultHolder call = call(url);
|
||||
String listJson = JSON.toJSONString(call.getData());
|
||||
JSONArray jsonArray = JSON.parseArray(listJson);
|
||||
|
|
|
@ -65,12 +65,18 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
|
|||
public List<IssuesDao> getIssue(IssuesRequest issuesRequest) {
|
||||
List<IssuesDao> list = new ArrayList<>();
|
||||
|
||||
TestCaseIssuesExample example = new TestCaseIssuesExample();
|
||||
example.createCriteria().andTestCaseIdEqualTo(testCaseId);
|
||||
// TestCaseIssuesExample example = new TestCaseIssuesExample();
|
||||
// example.createCriteria().andTestCaseIdEqualTo(testCaseId);
|
||||
|
||||
issuesRequest.setPlatform(IssuesManagePlatform.Zentao.toString());
|
||||
|
||||
List<IssuesDao> issues = extIssuesMapper.getIssuesByCaseId(issuesRequest);
|
||||
|
||||
List<IssuesDao> issues;
|
||||
if (StringUtils.isNotBlank(issuesRequest.getProjectId())) {
|
||||
issues = extIssuesMapper.getIssuesByProjectId(issuesRequest);
|
||||
} else {
|
||||
issues = extIssuesMapper.getIssuesByCaseId(issuesRequest);
|
||||
}
|
||||
|
||||
List<String> issuesIds = issues.stream().map(Issues::getId).collect(Collectors.toList());
|
||||
issuesIds.forEach(issuesId -> {
|
||||
|
@ -78,9 +84,11 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
|
|||
if (StringUtils.isBlank(dto.getId())) {
|
||||
// 缺陷不存在,解除用例和缺陷的关联
|
||||
TestCaseIssuesExample issuesExample = new TestCaseIssuesExample();
|
||||
issuesExample.createCriteria()
|
||||
.andTestCaseIdEqualTo(testCaseId)
|
||||
.andIssuesIdEqualTo(issuesId);
|
||||
TestCaseIssuesExample.Criteria criteria = issuesExample.createCriteria();
|
||||
if (StringUtils.isNotBlank(testCaseId)) {
|
||||
criteria.andTestCaseIdEqualTo(testCaseId);
|
||||
}
|
||||
criteria.andIssuesIdEqualTo(issuesId);
|
||||
testCaseIssuesMapper.deleteByExample(issuesExample);
|
||||
issuesMapper.deleteByPrimaryKey(issuesId);
|
||||
} else {
|
||||
|
@ -193,7 +201,7 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
|
|||
issuesRequest.setPlatform(IssuesManagePlatform.Zentao.toString());
|
||||
|
||||
String session = login();
|
||||
String projectId = getProjectId(null);
|
||||
String projectId = getProjectId(issuesRequest.getProjectId());
|
||||
|
||||
if (StringUtils.isBlank(projectId)) {
|
||||
MSException.throwException("add zentao bug fail, project zentao id is null");
|
||||
|
@ -338,12 +346,12 @@ public class ZentaoPlatform extends AbstractIssuePlatform {
|
|||
|
||||
public List<ZentaoBuild> getBuilds() {
|
||||
String session = login();
|
||||
String projectId = getProjectId(null);
|
||||
String projectId1 = getProjectId(projectId);
|
||||
HttpHeaders httpHeaders = new HttpHeaders();
|
||||
HttpEntity<MultiValueMap> requestEntity = new HttpEntity<>(httpHeaders);
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
ResponseEntity<String> responseEntity = restTemplate.exchange(url + "api-getModel-build-getProductBuildPairs-productID={projectId}?zentaosid=" + session,
|
||||
HttpMethod.GET, requestEntity, String.class, projectId);
|
||||
HttpMethod.GET, requestEntity, String.class, projectId1);
|
||||
String body = responseEntity.getBody();
|
||||
JSONObject obj = JSONObject.parseObject(body);
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package io.metersphere.track.service;
|
||||
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.IssueTemplateMapper;
|
||||
import io.metersphere.base.mapper.IssuesMapper;
|
||||
import io.metersphere.base.mapper.TestCaseIssuesMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtIssuesMapper;
|
||||
import io.metersphere.commons.constants.IssuesManagePlatform;
|
||||
import io.metersphere.commons.constants.NoticeConstants;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.user.SessionUser;
|
||||
import io.metersphere.commons.utils.ServiceUtils;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
|
@ -24,16 +25,12 @@ import io.metersphere.track.request.testcase.IssuesRequest;
|
|||
import io.metersphere.track.request.testcase.IssuesUpdateRequest;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
@ -53,9 +50,7 @@ public class IssuesService {
|
|||
@Resource
|
||||
private TestCaseIssuesMapper testCaseIssuesMapper;
|
||||
@Resource
|
||||
private SqlSessionFactory sqlSessionFactory;
|
||||
@Resource
|
||||
private ExtIssuesMapper extIssuesMapper;
|
||||
private IssueTemplateMapper issueTemplateMapper;
|
||||
|
||||
public void testAuth(String platform) {
|
||||
AbstractIssuePlatform abstractPlatform = IssueFactory.createPlatform(platform, new IssuesRequest());
|
||||
|
@ -100,13 +95,15 @@ public class IssuesService {
|
|||
}
|
||||
|
||||
public List<AbstractIssuePlatform> getUpdatePlatforms(IssuesUpdateRequest updateRequest) {
|
||||
List<String> platforms = null;
|
||||
List<String> platforms = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(updateRequest.getTestCaseId())) {
|
||||
// 测试计划关联
|
||||
platforms = getPlatformsByCaseId(updateRequest.getTestCaseId());
|
||||
String p = getPlatformsByCaseId(updateRequest.getTestCaseId());
|
||||
platforms.add(p);
|
||||
} else {
|
||||
// 缺陷管理关联
|
||||
platforms = getPlatformsByProjectId(updateRequest.getProjectId());
|
||||
String t = getIssueTemplate(updateRequest.getProjectId());
|
||||
platforms.add(t);
|
||||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(platforms)) {
|
||||
|
@ -137,16 +134,24 @@ public class IssuesService {
|
|||
return list;
|
||||
}
|
||||
|
||||
public List<String> getPlatformsByProjectId(String projectId) {
|
||||
return getPlatforms(projectService.getProjectById(projectId));
|
||||
}
|
||||
|
||||
public List<String> getPlatformsByCaseId(String caseId) {
|
||||
public String getPlatformsByCaseId(String caseId) {
|
||||
TestCaseWithBLOBs testCase = testCaseService.getTestCase(caseId);
|
||||
Project project = projectService.getProjectById(testCase.getProjectId());
|
||||
List<String> platforms = getPlatforms(project);
|
||||
platforms.add("LOCAL");
|
||||
return getPlatforms(project);
|
||||
return getIssueTemplate(project.getId());
|
||||
}
|
||||
|
||||
public String getIssueTemplate(String projectId) {
|
||||
Project project = projectService.getProjectById(projectId);
|
||||
String id = project.getIssueTemplateId();
|
||||
if (StringUtils.isBlank(id)) {
|
||||
MSException.throwException("project issue template id is null.");
|
||||
}
|
||||
IssueTemplate issueTemplate = issueTemplateMapper.selectByPrimaryKey(id);
|
||||
String platform = issueTemplate.getPlatform();
|
||||
if (StringUtils.equals(platform, "metersphere")) {
|
||||
return IssuesManagePlatform.Local.name();
|
||||
}
|
||||
return platform;
|
||||
}
|
||||
|
||||
public List<String> getPlatforms(Project project) {
|
||||
|
@ -224,17 +229,13 @@ public class IssuesService {
|
|||
issuesMapper.updateByPrimaryKeySelective(issues);
|
||||
}
|
||||
|
||||
public List<PlatformUser> getTapdProjectUsers(String caseId) {
|
||||
IssuesRequest issueRequest = new IssuesRequest();
|
||||
issueRequest.setTestCaseId(caseId);
|
||||
AbstractIssuePlatform platform = IssueFactory.createPlatform(IssuesManagePlatform.Tapd.name(), issueRequest);
|
||||
public List<PlatformUser> getTapdProjectUsers(IssuesRequest request) {
|
||||
AbstractIssuePlatform platform = IssueFactory.createPlatform(IssuesManagePlatform.Tapd.name(), request);
|
||||
return platform.getPlatformUser();
|
||||
}
|
||||
|
||||
public List<PlatformUser> getZentaoUsers(String caseId) {
|
||||
IssuesRequest issueRequest = new IssuesRequest();
|
||||
issueRequest.setTestCaseId(caseId);
|
||||
AbstractIssuePlatform platform = IssueFactory.createPlatform(IssuesManagePlatform.Zentao.name(), issueRequest);
|
||||
public List<PlatformUser> getZentaoUsers(IssuesRequest request) {
|
||||
AbstractIssuePlatform platform = IssueFactory.createPlatform(IssuesManagePlatform.Zentao.name(), request);
|
||||
return platform.getPlatformUser();
|
||||
}
|
||||
|
||||
|
@ -264,23 +265,36 @@ public class IssuesService {
|
|||
return context;
|
||||
}
|
||||
|
||||
public List<ZentaoBuild> getZentaoBuilds(String caseId) {
|
||||
IssuesRequest issueRequest = new IssuesRequest();
|
||||
issueRequest.setTestCaseId(caseId);
|
||||
ZentaoPlatform platform = (ZentaoPlatform) IssueFactory.createPlatform(IssuesManagePlatform.Zentao.name(), issueRequest);
|
||||
public List<ZentaoBuild> getZentaoBuilds(IssuesRequest request) {
|
||||
ZentaoPlatform platform = (ZentaoPlatform) IssueFactory.createPlatform(IssuesManagePlatform.Zentao.name(), request);
|
||||
return platform.getBuilds();
|
||||
}
|
||||
|
||||
public List<IssuesDao> list(IssuesRequest request) {
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
List<IssuesDao> issues = extIssuesMapper.getIssuesByProjectId(request);
|
||||
Map<String, List<IssuesDao>> issueMap = getIssueMap(issues);
|
||||
Map<String, AbstractIssuePlatform> platformMap = getPlatformMap(request);
|
||||
issueMap.forEach((platformName, data) -> {
|
||||
AbstractIssuePlatform platform = platformMap.get(platformName);
|
||||
platform.filter(data);
|
||||
|
||||
|
||||
List<IssuesDao> list = new ArrayList<>();
|
||||
String projectId = request.getProjectId();
|
||||
Project project = projectService.getProjectById(projectId);
|
||||
List<String> platforms = getPlatforms(project);
|
||||
platforms.add(IssuesManagePlatform.Local.toString());
|
||||
List<AbstractIssuePlatform> platformList = IssueFactory.createPlatforms(platforms, request);
|
||||
platformList.forEach(platform -> {
|
||||
List<IssuesDao> issue = platform.getIssue(request);
|
||||
list.addAll(issue);
|
||||
});
|
||||
return issues;
|
||||
// List<IssuesDao> issues = extIssuesMapper.getIssuesByProjectId(request);
|
||||
// Map<String, List<IssuesDao>> issueMap = getIssueMap(issues);
|
||||
// Map<String, AbstractIssuePlatform> platformMap = getPlatformMap(request);
|
||||
// issueMap.forEach((platformName, data) -> {
|
||||
// AbstractIssuePlatform platform = platformMap.get(platformName);
|
||||
// if (platform != null) {
|
||||
// platform.filter(data);
|
||||
// }
|
||||
// });
|
||||
// return issues;
|
||||
return list;
|
||||
}
|
||||
|
||||
public Map<String, List<IssuesDao>> getIssueMap(List<IssuesDao> issues) {
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
</span>
|
||||
<span>
|
||||
<slot name="searchBarBefore"></slot>
|
||||
<ms-table-search-bar :condition.sync="condition" @change="search" class="search-bar" :tip="tip"/>
|
||||
<ms-table-search-bar :condition.sync="condition" @change="search" class="search-bar" :tip="tip" v-if="haveSearch"/>
|
||||
<ms-table-adv-search-bar :condition.sync="condition" @search="search" v-if="isCombine"/>
|
||||
</span>
|
||||
</el-row>
|
||||
|
@ -86,6 +86,12 @@
|
|||
default() {
|
||||
return this.$t('commons.search_by_name');
|
||||
}
|
||||
},
|
||||
haveSearch: {
|
||||
Boolean,
|
||||
default() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
<template v-slot:header>
|
||||
<ms-table-header :is-tester-permission="true" :condition.sync="condition" @search="initTableData" @create="handleCreate"
|
||||
:create-tip="'创建缺陷'" :title="'缺陷模板'"/>
|
||||
:create-tip="'创建缺陷模版'" :title="'缺陷模板'"/>
|
||||
</template>
|
||||
|
||||
<ms-table
|
||||
|
@ -103,9 +103,9 @@ export default {
|
|||
result: {},
|
||||
issuePlatformMap:{
|
||||
metersphere: 'Metersphere',
|
||||
jira: 'JIRA',
|
||||
Jira: 'JIRA',
|
||||
Tapd: 'Tapd',
|
||||
zentao: '禅道',
|
||||
Zentao: '禅道',
|
||||
},
|
||||
operators: [
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
:label="$t('test_track.issue.status')"
|
||||
prop="status">
|
||||
<template v-slot="scope">
|
||||
<span>{{ issueStatusMap[scope.row.status] }}</span>
|
||||
<span>{{ issueStatusMap[scope.row.status] ? issueStatusMap[scope.row.status] : scope.row.status }}</span>
|
||||
</template>
|
||||
</ms-table-column>
|
||||
|
||||
|
|
|
@ -7,6 +7,21 @@
|
|||
<el-input v-model="form.title" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 自定义字段 -->
|
||||
<el-form v-if="isFormAlive" :model="customFieldForm" :rules="customFieldRules" ref="customFieldForm"
|
||||
class="case-form">
|
||||
<el-row class="custom-field-row">
|
||||
<el-col :span="8" v-for="(item, index) in issueTemplate.customFields" :key="index">
|
||||
<el-form-item :label="item.system ? $t(systemNameMap[item.name]) : item.name" :prop="item.name"
|
||||
:label-width="formLabelWidth">
|
||||
<custom-filed-component @reload="reloadForm" :data="item" :form="customFieldForm" prop="defaultValue"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<form-rich-text-item :title="$t('缺陷内容')" :data="form" prop="description"/>
|
||||
|
||||
<el-row class="custom-field-row">
|
||||
<el-col :span="8" v-if="hasTapdId">
|
||||
<el-form-item :label="$t('test_track.issue.tapd_current_owner')" prop="tapdUsers">
|
||||
|
@ -37,23 +52,9 @@
|
|||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- 自定义字段 -->
|
||||
<el-form v-if="isFormAlive" :model="customFieldForm" :rules="customFieldRules" ref="customFieldForm"
|
||||
class="case-form">
|
||||
<el-row class="custom-field-row">
|
||||
<el-col :span="8" v-for="(item, index) in issueTemplate.customFields" :key="index">
|
||||
<el-form-item :label="item.system ? $t(systemNameMap[item.name]) : item.name" :prop="item.name"
|
||||
:label-width="formLabelWidth">
|
||||
<custom-filed-component @reload="reloadForm" :data="item" :form="customFieldForm" prop="defaultValue"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<form-rich-text-item :title="$t('缺陷内容')" :data="form" prop="description"/>
|
||||
|
||||
<el-form-item v-if="!isPlan">
|
||||
<test-case-issue-list :test-case-contain-ids="testCaseContainIds" :issues-id="form.id" ref="testCaseIssueList"/>
|
||||
<test-case-issue-list :test-case-contain-ids="testCaseContainIds" :issues-id="form.id"
|
||||
ref="testCaseIssueList"/>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
|
@ -108,7 +109,7 @@ export default {
|
|||
},
|
||||
testCaseContainIds: new Set(),
|
||||
url: '',
|
||||
form:{
|
||||
form: {
|
||||
title: '',
|
||||
description: ''
|
||||
},
|
||||
|
@ -145,32 +146,27 @@ export default {
|
|||
getTemplate('field/template/issue/get/relate/', this)
|
||||
.then((template) => {
|
||||
this.issueTemplate = template;
|
||||
this.getThirdPartyInfo();
|
||||
initAddFuc(data);
|
||||
});
|
||||
},
|
||||
getThirdPartyInfo() {
|
||||
let url = '/project/get/' + this.projectId;
|
||||
if (this.isPlan) {
|
||||
url = '/test/case/project/' + this.caseId;
|
||||
let platform = this.issueTemplate.platform;
|
||||
if (platform === 'Zentao') {
|
||||
this.hasZentaoId = true;
|
||||
this.result = this.$post("/issues/zentao/builds", {projectId: this.projectId}, response => {
|
||||
this.Builds = response.data;
|
||||
});
|
||||
this.result = this.$post("/issues/zentao/user", {projectId: this.projectId}, response => {
|
||||
this.zentaoUsers = response.data;
|
||||
});
|
||||
}
|
||||
if (platform === 'Tapd') {
|
||||
this.hasTapdId = true;
|
||||
this.result = this.$post("/issues/tapd/user", {projectId: this.projectId}, (response) => {
|
||||
this.tapdUsers = response.data;
|
||||
});
|
||||
}
|
||||
this.$get(url, res => {
|
||||
let project = res.data;
|
||||
if (project.tapdId) {
|
||||
this.hasTapdId = true;
|
||||
this.result = this.$get("/issues/tapd/user/" + this.caseId, (response) => {
|
||||
this.tapdUsers = response.data;
|
||||
});
|
||||
}
|
||||
if (project.zentaoId) {
|
||||
this.hasZentaoId = true;
|
||||
this.result = this.$get("/issues/zentao/builds/" + this.caseId,response => {
|
||||
this.Builds = response.data;
|
||||
});
|
||||
this.result = this.$get("/issues/zentao/user/" + this.caseId, response => {
|
||||
this.zentaoUsers = response.data;
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
initEdit(data) {
|
||||
this.testCaseContainIds = new Set();
|
||||
|
@ -243,7 +239,7 @@ export default {
|
|||
});
|
||||
},
|
||||
parseOldFields(param) {
|
||||
let customFieldsStr = param.customFields;
|
||||
let customFieldsStr = param.customFields;
|
||||
if (customFieldsStr) {
|
||||
let customFields = JSON.parse(customFieldsStr);
|
||||
if (customFields['i43sf4_issueStatus']) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<template v-slot:header>
|
||||
<ms-table-header :is-tester-permission="true" :condition.sync="condition" @search="getIssues" @create="handleCreate"
|
||||
:create-tip="'创建缺陷'" :title="'缺陷列表'" :tip="'根据标题搜索'"/>
|
||||
:create-tip="'创建缺陷'" :title="'缺陷列表'" :tip="'根据标题搜索'" :have-search="false"/>
|
||||
</template>
|
||||
|
||||
<ms-table
|
||||
|
@ -32,7 +32,7 @@
|
|||
:label="$t('test_track.issue.status')"
|
||||
prop="status">
|
||||
<template v-slot="scope">
|
||||
<span>{{ issueStatusMap[scope.row.status] }}</span>
|
||||
<span>{{ issueStatusMap[scope.row.status] ? issueStatusMap[scope.row.status] : scope.row.status }}</span>
|
||||
</template>
|
||||
</ms-table-column>
|
||||
|
||||
|
@ -87,15 +87,16 @@ export default {
|
|||
operators: [
|
||||
{
|
||||
tip: this.$t('commons.edit'), icon: "el-icon-edit",
|
||||
exec: this.handleEdit
|
||||
exec: this.handleEdit,
|
||||
isDisable: this.btnDisable
|
||||
}, {
|
||||
tip: this.$t('commons.copy'), icon: "el-icon-copy-document", type: "success",
|
||||
exec: this.handleCopy,
|
||||
isDisable: this.systemDisable
|
||||
isDisable: this.btnDisable
|
||||
}, {
|
||||
tip: this.$t('commons.delete'), icon: "el-icon-delete", type: "danger",
|
||||
exec: this.handleDelete,
|
||||
isDisable: this.systemDisable
|
||||
isDisable: this.btnDisable
|
||||
}
|
||||
],
|
||||
};
|
||||
|
@ -152,6 +153,12 @@ export default {
|
|||
this.getIssues();
|
||||
});
|
||||
},
|
||||
btnDisable(row) {
|
||||
if (row.platform === 'Local') {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -24,9 +24,9 @@ export const CASE_TYPE_OPTION = [
|
|||
|
||||
export const ISSUE_PLATFORM_OPTION = [
|
||||
{value: 'metersphere',text: 'Metersphere'},
|
||||
{value: 'jira',text: 'JIRA'},
|
||||
{value: 'Jira',text: 'JIRA'},
|
||||
{value: 'Tapd',text: 'Tapd'},
|
||||
{value: 'zentao',text: '禅道'},
|
||||
{value: 'Zentao',text: '禅道'},
|
||||
];
|
||||
|
||||
export const FIELD_TYPE_MAP = {
|
||||
|
@ -64,5 +64,6 @@ export const SYSTEM_FIELD_NAME_MAP = {
|
|||
export const ISSUE_STATUS_MAP = {
|
||||
'new': '新建',
|
||||
'closed': '已关闭',
|
||||
'resolved': '已解决'
|
||||
'resolved': '已解决',
|
||||
'active': '激活'
|
||||
}
|
||||
|
|
|
@ -1480,9 +1480,9 @@ export default {
|
|||
close_success: "Closed successfully",
|
||||
preview: "Preview",
|
||||
please_choose_current_owner: "Please choose current owner",
|
||||
tapd_current_owner: "Tapd Current Owner:",
|
||||
zentao_bug_build: "Zentao bug Impact version",
|
||||
zentao_bug_assigned: "Zentao bug handler",
|
||||
tapd_current_owner: "Tapd Current Owner",
|
||||
zentao_bug_build: "Zentao Impact version",
|
||||
zentao_bug_assigned: "Zentao handler",
|
||||
},
|
||||
report: {
|
||||
name: "Test Plan Report",
|
||||
|
|
|
@ -1498,9 +1498,9 @@ export default {
|
|||
status_resolved: '已解决',
|
||||
status_closed: '已关闭',
|
||||
please_choose_current_owner: "请选择处理人",
|
||||
tapd_current_owner: "Tapd bug 处理人:",
|
||||
zentao_bug_build: "禅道 bug 影响版本",
|
||||
zentao_bug_assigned: "禅道 bug 处理人",
|
||||
tapd_current_owner: "Tapd 处理人",
|
||||
zentao_bug_build: "禅道 影响版本",
|
||||
zentao_bug_assigned: "禅道 处理人",
|
||||
},
|
||||
report: {
|
||||
name: "测试计划报告",
|
||||
|
|
|
@ -1482,9 +1482,9 @@ export default {
|
|||
close_success: "關閉成功",
|
||||
preview: "預覽",
|
||||
please_choose_current_owner: "請選擇處理人",
|
||||
tapd_current_owner: "Tapd bug 處理人:",
|
||||
zentao_bug_build: "禪道 bug 影響版本",
|
||||
zentao_bug_assigned: "禪道 bug 處理人",
|
||||
tapd_current_owner: "Tapd 處理人",
|
||||
zentao_bug_build: "禪道 影響版本",
|
||||
zentao_bug_assigned: "禪道 處理人",
|
||||
},
|
||||
report: {
|
||||
name: "測試計畫包括",
|
||||
|
|
Loading…
Reference in New Issue