From 325d552625e8056054f6953eee0948e85f89c314 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Tue, 10 Aug 2021 15:52:58 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=B5=8B=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E4=BE=8B=E5=85=B3=E8=81=94=E6=B5=8B=E8=AF=95=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/ApiAutomationService.java | 9 + .../api/service/ApiTestCaseService.java | 8 + .../base/mapper/TestCaseTestMapper.java | 15 +- .../base/mapper/TestCaseTestMapper.xml | 89 ++++++++- .../io/metersphere/dto/TestCaseTestDao.java | 12 ++ .../service/PerformanceTestService.java | 9 + .../track/controller/TestCaseController.java | 45 ++++- .../track/issue/client/ZentaoClient.java | 6 +- .../track/service/TestCaseService.java | 109 +++++++++++ .../case/components/TestCaseApiRelate.vue | 100 +++++++++++ .../track/case/components/TestCaseEdit.vue | 144 +-------------- .../case/components/TestCaseEditOtherInfo.vue | 30 +--- .../case/components/TestCaseLoadRelate.vue | 80 +++++++++ .../case/components/TestCaseRelateApiList.vue | 167 +++++++++++++++++ .../components/TestCaseRelateLoadList.vue | 132 ++++++++++++++ .../components/TestCaseRelateScenarioList.vue | 169 ++++++++++++++++++ .../components/TestCaseScenarioRelate.vue | 100 +++++++++++ .../case/components/TestCaseTestRelate.vue | 125 +++++++++++++ .../view/comonents/base/RelevanceDialog.vue | 4 +- .../comonents/base/TestCaseRelevanceBase.vue | 5 +- frontend/src/network/testCase.js | 27 ++- 21 files changed, 1204 insertions(+), 181 deletions(-) create mode 100644 backend/src/main/java/io/metersphere/dto/TestCaseTestDao.java create mode 100644 frontend/src/business/components/track/case/components/TestCaseApiRelate.vue create mode 100644 frontend/src/business/components/track/case/components/TestCaseLoadRelate.vue create mode 100644 frontend/src/business/components/track/case/components/TestCaseRelateApiList.vue create mode 100644 frontend/src/business/components/track/case/components/TestCaseRelateLoadList.vue create mode 100644 frontend/src/business/components/track/case/components/TestCaseRelateScenarioList.vue create mode 100644 frontend/src/business/components/track/case/components/TestCaseScenarioRelate.vue create mode 100644 frontend/src/business/components/track/case/components/TestCaseTestRelate.vue diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index 935af61649..dd0fd36ad2 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -2462,4 +2462,13 @@ public class ApiAutomationService { result.setCheckMsg(checkMsgList); return result; } + + public List getScenarioCaseByIds(List ids) { + if (CollectionUtils.isNotEmpty(ids)) { + ApiScenarioExample example = new ApiScenarioExample(); + example.createCriteria().andIdIn(ids); + return apiScenarioMapper.selectByExample(example); + } + return new ArrayList<>(); + } } diff --git a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java index 88bd497479..b82e452995 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java @@ -987,4 +987,12 @@ public class ApiTestCaseService { return jmxInfoDTO; } + public List getApiCaseByIds(List apiCaseIds) { + if (CollectionUtils.isNotEmpty(apiCaseIds)) { + ApiTestCaseExample example = new ApiTestCaseExample(); + example.createCriteria().andIdIn(apiCaseIds); + return apiTestCaseMapper.selectByExample(example); + } + return new ArrayList<>(); + } } diff --git a/backend/src/main/java/io/metersphere/base/mapper/TestCaseTestMapper.java b/backend/src/main/java/io/metersphere/base/mapper/TestCaseTestMapper.java index f8fcb8eee6..ed49b191ce 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/TestCaseTestMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/TestCaseTestMapper.java @@ -1,8 +1,15 @@ package io.metersphere.base.mapper; +import io.metersphere.api.dto.automation.ApiScenarioDTO; +import io.metersphere.api.dto.automation.ApiScenarioRequest; +import io.metersphere.api.dto.definition.ApiTestCaseDTO; +import io.metersphere.api.dto.definition.ApiTestCaseRequest; import io.metersphere.base.domain.TestCaseTest; import io.metersphere.base.domain.TestCaseTestExample; import java.util.List; + +import io.metersphere.dto.LoadTestDTO; +import io.metersphere.track.request.testplan.LoadCaseRequest; import org.apache.ibatis.annotations.Param; public interface TestCaseTestMapper { @@ -19,4 +26,10 @@ public interface TestCaseTestMapper { int updateByExampleSelective(@Param("record") TestCaseTest record, @Param("example") TestCaseTestExample example); int updateByExample(@Param("record") TestCaseTest record, @Param("example") TestCaseTestExample example); -} \ No newline at end of file + + List relevanceApiList(@Param("request") ApiTestCaseRequest request); + + List relevanceScenarioList(@Param("request") ApiScenarioRequest request); + + List relevanceLoadList(@Param("request") LoadCaseRequest request); +} diff --git a/backend/src/main/java/io/metersphere/base/mapper/TestCaseTestMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/TestCaseTestMapper.xml index 45bf667ec5..2b93b96e87 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/TestCaseTestMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/TestCaseTestMapper.xml @@ -90,9 +90,9 @@ - insert into test_case_test (test_case_id, test_id, test_type, + insert into test_case_test (test_case_id, test_id, test_type, create_time, update_time) - values (#{testCaseId,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR}, #{testType,jdbcType=VARCHAR}, + values (#{testCaseId,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR}, #{testType,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}) @@ -138,6 +138,89 @@ + + + update test_case_test @@ -172,4 +255,4 @@ - \ No newline at end of file + diff --git a/backend/src/main/java/io/metersphere/dto/TestCaseTestDao.java b/backend/src/main/java/io/metersphere/dto/TestCaseTestDao.java new file mode 100644 index 0000000000..2a86c8a97d --- /dev/null +++ b/backend/src/main/java/io/metersphere/dto/TestCaseTestDao.java @@ -0,0 +1,12 @@ +package io.metersphere.dto; + +import io.metersphere.base.domain.TestCaseTest; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class TestCaseTestDao extends TestCaseTest { + private String name; + private String num; +} diff --git a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java index b5f6f265f4..c2399a7a26 100644 --- a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java +++ b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java @@ -827,4 +827,13 @@ public class PerformanceTestService { } return granularity; } + + public List getLoadCaseByIds(List ids) { + if (org.apache.commons.collections.CollectionUtils.isNotEmpty(ids)) { + LoadTestExample example = new LoadTestExample(); + example.createCriteria().andIdIn(ids); + return loadTestMapper.selectByExample(example); + } + return new ArrayList<>(); + } } diff --git a/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java b/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java index 1f9a40e967..d43d4fd007 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestCaseController.java @@ -2,15 +2,18 @@ package io.metersphere.track.controller; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; -import io.metersphere.base.domain.FileMetadata; -import io.metersphere.base.domain.Project; -import io.metersphere.base.domain.TestCase; -import io.metersphere.base.domain.TestCaseWithBLOBs; +import io.metersphere.api.dto.automation.ApiScenarioDTO; +import io.metersphere.api.dto.automation.ApiScenarioRequest; +import io.metersphere.api.dto.definition.ApiTestCaseDTO; +import io.metersphere.api.dto.definition.ApiTestCaseRequest; +import io.metersphere.base.domain.*; import io.metersphere.commons.constants.OperLogConstants; import io.metersphere.commons.constants.PermissionConstants; import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.Pager; import io.metersphere.commons.utils.SessionUtils; +import io.metersphere.dto.LoadTestDTO; +import io.metersphere.dto.TestCaseTestDao; import io.metersphere.excel.domain.ExcelResponse; import io.metersphere.log.annotation.MsAuditLog; import io.metersphere.service.CheckPermissionService; @@ -21,6 +24,7 @@ import io.metersphere.track.request.testcase.QueryTestCaseRequest; import io.metersphere.track.request.testcase.TestCaseBatchRequest; import io.metersphere.track.request.testcase.TestCaseMinderEditRequest; import io.metersphere.track.request.testplan.FileOperationRequest; +import io.metersphere.track.request.testplan.LoadCaseRequest; import io.metersphere.track.service.TestCaseService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.http.HttpHeaders; @@ -110,6 +114,39 @@ public class TestCaseController { return PageUtils.setPageInfo(page, testCaseService.getTestCaseIssueRelateList(request)); } + @PostMapping("/relevance/api/list/{goPage}/{pageSize}") + public Pager> getTestCaseApiCaseRelateList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiTestCaseRequest request) { + Page page = PageHelper.startPage(goPage, pageSize, true); + return PageUtils.setPageInfo(page, testCaseService.getTestCaseApiCaseRelateList(request)); + } + + @PostMapping("/relevance/scenario/list/{goPage}/{pageSize}") + public Pager> getTestCaseScenarioCaseRelateList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiScenarioRequest request) { + Page page = PageHelper.startPage(goPage, pageSize, true); + return PageUtils.setPageInfo(page, testCaseService.getTestCaseScenarioCaseRelateList(request)); + } + + @PostMapping("/relevance/load/list/{goPage}/{pageSize}") + public Pager> getTestCaseLoadCaseRelateList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody LoadCaseRequest request) { + Page page = PageHelper.startPage(goPage, pageSize, true); + return PageUtils.setPageInfo(page, testCaseService.getTestCaseLoadCaseRelateList(request)); + } + + @GetMapping("/relate/test/list/{caseId}") + public List getRelateTest(@PathVariable String caseId) { + return testCaseService.getRelateTest(caseId); + } + + @PostMapping("/relate/test/{type}/{caseId}") + public void relateTest(@PathVariable String type, @PathVariable String caseId, @RequestBody List apiIds) { + testCaseService.relateTest(type, caseId, apiIds); + } + + @GetMapping("/relate/delete/{caseId}/{testId}") + public void relateDelete(@PathVariable String caseId, @PathVariable String testId) { + testCaseService.relateDelete(caseId, testId); + } + @PostMapping("/reviews/case/{goPage}/{pageSize}") public Pager> getReviewCase(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestCaseRequest request) { Page page = PageHelper.startPage(goPage, pageSize, true); diff --git a/backend/src/main/java/io/metersphere/track/issue/client/ZentaoClient.java b/backend/src/main/java/io/metersphere/track/issue/client/ZentaoClient.java index 8759cf6d85..15eefe68e8 100644 --- a/backend/src/main/java/io/metersphere/track/issue/client/ZentaoClient.java +++ b/backend/src/main/java/io/metersphere/track/issue/client/ZentaoClient.java @@ -42,17 +42,17 @@ public abstract class ZentaoClient extends BaseClient { getUserResponse = (GetUserResponse) getResultForObject(GetUserResponse.class, response); } catch (Exception e) { LogUtil.error("get result for object error," + e.getMessage()); - MSException.throwException("zentao login fail"); + MSException.throwException(e.getMessage()); } GetUserResponse.User user = getUserResponse.getUser(); if (user == null) { LogUtil.error(JSONObject.toJSON(getUserResponse)); // 登录失败,获取的session无效,置空session - MSException.throwException("zentao login fail"); + MSException.throwException("zentao login fail, user null"); } if (!StringUtils.equals(user.getAccount(), USER_NAME)) { LogUtil.error("login fail,inconsistent users"); - MSException.throwException("zentao login fail"); + MSException.throwException("zentao login fail, inconsistent user"); } return sessionId; } diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index 590e7c4079..257e45d539 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -6,6 +6,12 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageHelper; +import io.metersphere.api.dto.automation.ApiScenarioDTO; +import io.metersphere.api.dto.automation.ApiScenarioRequest; +import io.metersphere.api.dto.definition.ApiTestCaseDTO; +import io.metersphere.api.dto.definition.ApiTestCaseRequest; +import io.metersphere.api.service.ApiAutomationService; +import io.metersphere.api.service.ApiTestCaseService; import io.metersphere.base.domain.*; import io.metersphere.base.mapper.*; import io.metersphere.base.mapper.ext.ExtTestCaseMapper; @@ -18,7 +24,9 @@ import io.metersphere.commons.utils.*; import io.metersphere.controller.request.OrderRequest; import io.metersphere.controller.request.member.QueryMemberRequest; import io.metersphere.dto.CustomFieldDao; +import io.metersphere.dto.LoadTestDTO; import io.metersphere.dto.TestCaseTemplateDao; +import io.metersphere.dto.TestCaseTestDao; import io.metersphere.excel.domain.*; import io.metersphere.excel.handler.FunctionCaseTemplateWriteHandler; import io.metersphere.excel.listener.TestCaseNoModelDataListener; @@ -29,6 +37,7 @@ import io.metersphere.log.utils.ReflexObjectUtil; import io.metersphere.log.vo.DetailColumn; import io.metersphere.log.vo.OperatingLogDetails; import io.metersphere.log.vo.track.TestCaseReference; +import io.metersphere.performance.service.PerformanceTestService; import io.metersphere.service.*; import io.metersphere.track.dto.TestCaseCommentDTO; import io.metersphere.track.dto.TestCaseDTO; @@ -36,6 +45,7 @@ import io.metersphere.track.request.testcase.EditTestCaseRequest; import io.metersphere.track.request.testcase.QueryTestCaseRequest; import io.metersphere.track.request.testcase.TestCaseBatchRequest; import io.metersphere.track.request.testcase.TestCaseMinderEditRequest; +import io.metersphere.track.request.testplan.LoadCaseRequest; import io.metersphere.xmind.XmindCaseParser; import io.metersphere.xmind.pojo.TestCaseXmindData; import io.metersphere.xmind.utils.XmindExportUtil; @@ -120,6 +130,15 @@ public class TestCaseService { private IssuesMapper issuesMapper; @Resource private CustomFieldService customFieldService; + @Resource + @Lazy + private ApiTestCaseService apiTestCaseService; + @Resource + @Lazy + private ApiAutomationService apiAutomationService; + @Resource + @Lazy + private PerformanceTestService performanceTestService; private void setNode(TestCaseWithBLOBs testCase) { if (StringUtils.isEmpty(testCase.getNodeId()) || "default-module".equals(testCase.getNodeId())) { @@ -306,6 +325,7 @@ public class TestCaseService { TestCaseTestExample examples = new TestCaseTestExample(); examples.createCriteria().andTestCaseIdEqualTo(testCaseId); testCaseTestMapper.deleteByExample(examples); + relateDelete(testCaseId); return testCaseMapper.deleteByPrimaryKey(testCaseId); } @@ -1770,4 +1790,93 @@ public class TestCaseService { } return null; } + + public List getTestCaseApiCaseRelateList(ApiTestCaseRequest request) { + return testCaseTestMapper.relevanceApiList(request); + } + + public void relateTest(String type, String caseId, List apiIds) { + apiIds.forEach(testId -> { + TestCaseTest testCaseTest = new TestCaseTest(); + testCaseTest.setTestType(type); + testCaseTest.setTestCaseId(caseId); + testCaseTest.setTestId(testId); + testCaseTest.setCreateTime(System.currentTimeMillis()); + testCaseTest.setUpdateTime(System.currentTimeMillis()); + testCaseTestMapper.insert(testCaseTest); + }); + } + + public void relateDelete(String caseId, String testId) { + TestCaseTestExample example = new TestCaseTestExample(); + example.createCriteria() + .andTestCaseIdEqualTo(caseId) + .andTestIdEqualTo(testId); + testCaseTestMapper.deleteByExample(example); + } + + public void relateDelete(String caseId) { + TestCaseTestExample example = new TestCaseTestExample(); + example.createCriteria() + .andTestCaseIdEqualTo(caseId); + testCaseTestMapper.deleteByExample(example); + } + + public List getRelateTest(String caseId) { + TestCaseTestExample example = new TestCaseTestExample(); + example.createCriteria() + .andTestCaseIdEqualTo(caseId); + List testCaseTests = testCaseTestMapper.selectByExample(example); + Map testCaseTestsMap = testCaseTests.stream() + .collect(Collectors.toMap(TestCaseTest::getTestId, i -> i)); + List apiCases = apiTestCaseService.getApiCaseByIds( + getTestIds(testCaseTests, "testcase") + ); + List apiScenarios = apiAutomationService.getScenarioCaseByIds( + getTestIds(testCaseTests, "automation") + ); + List apiLoadTests = performanceTestService.getLoadCaseByIds( + getTestIds(testCaseTests, "performance") + ); + List testCaseTestList = new ArrayList<>(); + apiCases.forEach(item -> { + getTestCaseTestDaoList("testcase", item.getNum(), item.getName(), item.getId(), + testCaseTestList, testCaseTestsMap); + }); + apiScenarios.forEach(item -> { + getTestCaseTestDaoList("automation", item.getNum(), item.getName(), item.getId(), + testCaseTestList, testCaseTestsMap); + }); + apiLoadTests.forEach(item -> { + getTestCaseTestDaoList("performance", item.getNum(), item.getName(), item.getId(), + testCaseTestList, testCaseTestsMap); + }); + return testCaseTestList; + } + + public void getTestCaseTestDaoList(String type, Object num, String name, String testId, + List testCaseTestList, Map testCaseTestsMap) { + TestCaseTestDao testCaseTestDao = new TestCaseTestDao(); + BeanUtils.copyBean(testCaseTestDao, testCaseTestsMap.get(testId)); + testCaseTestDao.setNum(num.toString()); + testCaseTestDao.setName(name); + testCaseTestDao.setTestType(type); + testCaseTestList.add(testCaseTestDao); + } + + public List getTestIds(List testCaseTests, String type) { + List caseIds = testCaseTests.stream() + .filter(item -> item.getTestType().equals(type)) + .map(TestCaseTest::getTestId) + .collect(Collectors.toList()); + return caseIds; + } + + public List getTestCaseScenarioCaseRelateList(ApiScenarioRequest request) { + return testCaseTestMapper.relevanceScenarioList(request); + } + + public List getTestCaseLoadCaseRelateList(LoadCaseRequest request) { + return testCaseTestMapper.relevanceLoadList(request); + } } diff --git a/frontend/src/business/components/track/case/components/TestCaseApiRelate.vue b/frontend/src/business/components/track/case/components/TestCaseApiRelate.vue new file mode 100644 index 0000000000..461927558a --- /dev/null +++ b/frontend/src/business/components/track/case/components/TestCaseApiRelate.vue @@ -0,0 +1,100 @@ + + + + + diff --git a/frontend/src/business/components/track/case/components/TestCaseEdit.vue b/frontend/src/business/components/track/case/components/TestCaseEdit.vue index b5bb4c7b64..cbfc8a1f92 100644 --- a/frontend/src/business/components/track/case/components/TestCaseEdit.vue +++ b/frontend/src/business/components/track/case/components/TestCaseEdit.vue @@ -81,7 +81,7 @@ - @@ -176,7 +176,7 @@ }, data() { return { - sysList: [],//一级选择框的数据 + // sysList: [],//一级选择框的数据 path: "/test/case/add", testCaseTemplate: {}, options: REVIEW_STATUS, @@ -215,7 +215,7 @@ customNum: '' }, maintainerOptions: [], - testOptions: [], + // testOptions: [], workspaceId: '', rules: { name: [ @@ -337,146 +337,8 @@ this.form.module = this.treeNodes[0].id; this.form.nodePath = this.treeNodes[0].path; } - this.loadOptions(); }, methods: { - async loadOptions(sysLib) { - if (this.form.list) { - return; - } - sysLib = TEST - .filter(item => { - return enableModules([item.module]); - })// 模块启用禁用过滤 - .map(item => ({ - value: item.id, - label: item.name, - })); - let array = []; - for (let i = 0; i < sysLib.length; i++) { - if (sysLib.length > 0) { - let res = await this.getTestOptions(sysLib[i].value); - sysLib[i].children = res; - } - array.push(sysLib[i]); - } - this.sysList = array; - }, - getTestOptions(val) { - this.result.loading = true; - this.form.type = val; - this.testOptions = []; - let url = ''; - if (this.form.type === 'performance') { - url = '/' + this.form.type + '/list/' + this.projectId; - if (!url) { - return; - } - this.result.loading = true; - return new Promise((resolve, reject) => { - this.$get(url).then(res => { - const data = res.data.data.map(item => ({ - value: item.id, - label: item.name, - leaf: true - })); - this.result.loading = false; - resolve(data); - }).catch((err) => { - reject(err); - }); - }); - } else if (this.form.type === 'automation') { - url = '/api/automation/module/list/' + this.projectId; - if (!url) { - return; - } - this.result.loading = true; - return new Promise((resolve, reject) => { - this.$get("/api/automation/module/list/" + this.projectId, response => { - if (response.data != undefined && response.data != null) { - this.buildTreeValue(response.data); - } - this.result.loading = false; - resolve(response.data); - }); - }); - } else if (this.form.type === 'testcase') { - - this.result.loading = true; - return new Promise((resolve, reject) => { - TEST_CASE.forEach(test => { - let url = "/api/module/list/" + this.projectId + "/" + test.value; - this.$get(url, response => { - if (response.data != undefined && response.data != null) { - this.buildTreeValueApiCase(response.data); - test.children = response.data; - } - }); - }); - this.result.loading = false; - resolve(TEST_CASE); - }); - } - }, - buildTreeValueApiCase(list) { - list.forEach(item => { - item.value = item.id, - item.label = item.name, - item.leaf = true; - if (item.children) { - this.buildTreeValueApiCase(item.children); - } else { - let url = "/api/testcase/list/"; - let param = {}; - param.moduleId = item.id; - param.projectId = this.projectId; - this.$post(url, param, response => { - if (response.data != undefined && response.data != null) { - item.children = response.data; - this.buildTreeValueApiCase(item.children); - } - }); - } - }); - }, - buildTreeValue(list) { - let url = '/api/automation/list'; - list.forEach(item => { - item.value = item.id, - item.label = item.name, - item.leaf = true; - if (item.children) { - this.buildTreeValue(item.children); - } else { - let param = {}; - param.moduleId = item.id; - param.projectId = this.projectId; - this.$post(url, param, response => { - if (response.data != undefined && response.data != null) { - item.children = response.data; - this.buildTreeValue(item.children); - } - - }); - } - }); - }, - buildValue(url) { - return new Promise((resolve, reject) => { - this.$get(url).then(res => { - const data = res.data.data.map(item => ({ - value: item.id, - label: item.name, - leaf: true - })); - this.result.loading = false; - resolve(data); - }).catch((err) => { - reject(err); - }); - }); - }, openHis() { this.$refs.changeHistory.open(this.form.id); }, diff --git a/frontend/src/business/components/track/case/components/TestCaseEditOtherInfo.vue b/frontend/src/business/components/track/case/components/TestCaseEditOtherInfo.vue index 6c487e9fe7..84cf0f5963 100644 --- a/frontend/src/business/components/track/case/components/TestCaseEditOtherInfo.vue +++ b/frontend/src/business/components/track/case/components/TestCaseEditOtherInfo.vue @@ -6,23 +6,7 @@ - - {{ $t('test_track.case.relate_test') }}: - - {{ - item.testName - }} - - - - - - - + @@ -90,16 +74,17 @@ import {Message} from "element-ui"; import TestCaseRichText from "@/business/components/track/case/components/MsRichText"; import MsRichText from "@/business/components/track/case/components/MsRichText"; -import {TEST} from "@/business/components/api/definition/model/JsonData"; import TestCaseAttachment from "@/business/components/track/case/components/TestCaseAttachment"; import TestCaseIssueRelate from "@/business/components/track/case/components/TestCaseIssueRelate"; -import {enableModules} from "@/common/js/utils"; import FormRichTextItem from "@/business/components/track/case/components/FormRichTextItem"; +import TestCaseTestRelate from "@/business/components/track/case/components/TestCaseTestRelate"; export default { name: "TestCaseEditOtherInfo", - components: {FormRichTextItem, TestCaseIssueRelate, TestCaseAttachment, MsRichText, TestCaseRichText}, - props: ['form', 'labelWidth', 'caseId', 'readOnly', 'projectId', 'isTestPlan', 'planId', 'sysList'], + components: { + TestCaseTestRelate, + FormRichTextItem, TestCaseIssueRelate, TestCaseAttachment, MsRichText, TestCaseRichText}, + props: ['form', 'labelWidth', 'caseId', 'readOnly', 'projectId', 'isTestPlan', 'planId'], data() { return { result: {}, @@ -143,9 +128,6 @@ export default { /// todo: 是否需要对文件内容和大小做限制 return file.size > 0; }, - openTest(data) { - this.$emit('openTest', data); - }, beforeUpload(file) { if (!this.fileValidator(file)) { /// todo: 显示错误信息 diff --git a/frontend/src/business/components/track/case/components/TestCaseLoadRelate.vue b/frontend/src/business/components/track/case/components/TestCaseLoadRelate.vue new file mode 100644 index 0000000000..a92f9fd109 --- /dev/null +++ b/frontend/src/business/components/track/case/components/TestCaseLoadRelate.vue @@ -0,0 +1,80 @@ + + + + + diff --git a/frontend/src/business/components/track/case/components/TestCaseRelateApiList.vue b/frontend/src/business/components/track/case/components/TestCaseRelateApiList.vue new file mode 100644 index 0000000000..20b8fad761 --- /dev/null +++ b/frontend/src/business/components/track/case/components/TestCaseRelateApiList.vue @@ -0,0 +1,167 @@ + + + + + diff --git a/frontend/src/business/components/track/case/components/TestCaseRelateLoadList.vue b/frontend/src/business/components/track/case/components/TestCaseRelateLoadList.vue new file mode 100644 index 0000000000..5fa81bb337 --- /dev/null +++ b/frontend/src/business/components/track/case/components/TestCaseRelateLoadList.vue @@ -0,0 +1,132 @@ + + + + + diff --git a/frontend/src/business/components/track/case/components/TestCaseRelateScenarioList.vue b/frontend/src/business/components/track/case/components/TestCaseRelateScenarioList.vue new file mode 100644 index 0000000000..e305f210dc --- /dev/null +++ b/frontend/src/business/components/track/case/components/TestCaseRelateScenarioList.vue @@ -0,0 +1,169 @@ + + + + + diff --git a/frontend/src/business/components/track/case/components/TestCaseScenarioRelate.vue b/frontend/src/business/components/track/case/components/TestCaseScenarioRelate.vue new file mode 100644 index 0000000000..e01169da3c --- /dev/null +++ b/frontend/src/business/components/track/case/components/TestCaseScenarioRelate.vue @@ -0,0 +1,100 @@ + + + + + diff --git a/frontend/src/business/components/track/case/components/TestCaseTestRelate.vue b/frontend/src/business/components/track/case/components/TestCaseTestRelate.vue new file mode 100644 index 0000000000..5276e6a7ef --- /dev/null +++ b/frontend/src/business/components/track/case/components/TestCaseTestRelate.vue @@ -0,0 +1,125 @@ + + + + + diff --git a/frontend/src/business/components/track/plan/view/comonents/base/RelevanceDialog.vue b/frontend/src/business/components/track/plan/view/comonents/base/RelevanceDialog.vue index 3f3a19d34f..a9dd0238aa 100644 --- a/frontend/src/business/components/track/plan/view/comonents/base/RelevanceDialog.vue +++ b/frontend/src/business/components/track/plan/view/comonents/base/RelevanceDialog.vue @@ -2,7 +2,7 @@ @@ -44,7 +44,7 @@ dialogVisible: false, }; }, - props: ['title'], + props: ['title', 'width'], methods: { open() { this.dialogVisible = true; diff --git a/frontend/src/business/components/track/plan/view/comonents/base/TestCaseRelevanceBase.vue b/frontend/src/business/components/track/plan/view/comonents/base/TestCaseRelevanceBase.vue index 303b82817b..e46b031193 100644 --- a/frontend/src/business/components/track/plan/view/comonents/base/TestCaseRelevanceBase.vue +++ b/frontend/src/business/components/track/plan/view/comonents/base/TestCaseRelevanceBase.vue @@ -1,5 +1,5 @@