From b152bd9411b66edd4bac5c7ff41edd813a4f59a7 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Thu, 20 Apr 2023 14:44:52 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E7=94=A8=E4=BE=8B=E6=89=80=E5=B1=9E?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1025638 --user=陈建星 重命名用例模块报错 https://www.tapd.cn/55049933/s/1364766 --- .../io/metersphere/base/domain/TestCase.java | 5 +- .../base/mapper/ext/ExtTestCaseMapper.java | 3 - .../base/mapper/ext/ExtTestCaseMapper.xml | 8 -- .../listener/TestCaseNoModelDataListener.java | 2 - .../service/TestCaseNodeService.java | 90 +++++------------- .../metersphere/service/TestCaseService.java | 91 ++----------------- .../io/metersphere/xmind/XmindCaseParser.java | 19 +--- .../business/case/components/TestCaseList.vue | 18 +++- .../controller/track/TrackController.java | 1 + .../frontend/src/api/test-case-node.js | 5 + .../src/business/component/CaseTableList.vue | 31 +++++++ 11 files changed, 88 insertions(+), 185 deletions(-) create mode 100644 workstation/frontend/src/api/test-case-node.js diff --git a/framework/sdk-parent/domain/src/main/java/io/metersphere/base/domain/TestCase.java b/framework/sdk-parent/domain/src/main/java/io/metersphere/base/domain/TestCase.java index 9bd84fd4e7..daa3870b28 100644 --- a/framework/sdk-parent/domain/src/main/java/io/metersphere/base/domain/TestCase.java +++ b/framework/sdk-parent/domain/src/main/java/io/metersphere/base/domain/TestCase.java @@ -12,18 +12,21 @@ public class TestCase implements Serializable { private String testId; + @Deprecated private String nodePath; private String projectId; private String name; + @Deprecated private String type; private String maintainer; private String priority; + @Deprecated private String method; private Long createTime; @@ -69,4 +72,4 @@ public class TestCase implements Serializable { private String lastExecuteResult; private static final long serialVersionUID = 1L; -} \ No newline at end of file +} diff --git a/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java b/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java index 23685acbe2..64b7c3fb9a 100644 --- a/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java +++ b/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java @@ -150,9 +150,6 @@ public interface ExtTestCaseMapper { int addLatestVersion(@Param("refId") String refId); - void updateVersionModule(@Param("refId") String refId, @Param("versionId") String versionId, @Param("moduleId") String moduleId, @Param("modulePath") String modulePath); - - List getMaintainerMap(@Param("request") QueryTestCaseRequest request); List getMaintainerMapForPlanRepeat(@Param("request") QueryTestCaseRequest request); diff --git a/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml b/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml index 046c91d729..d742548da1 100644 --- a/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml +++ b/test-track/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml @@ -1327,14 +1327,6 @@ WHERE ref_id = #{refId,jdbcType=VARCHAR} - - UPDATE test_case - SET node_id = #{moduleId}, - node_path = #{modulePath} - WHERE ref_id = #{refId} - AND version_id != #{versionId} - - update test_case diff --git a/test-track/backend/src/main/java/io/metersphere/excel/listener/TestCaseNoModelDataListener.java b/test-track/backend/src/main/java/io/metersphere/excel/listener/TestCaseNoModelDataListener.java index 562f3ccbf7..491587cdd1 100644 --- a/test-track/backend/src/main/java/io/metersphere/excel/listener/TestCaseNoModelDataListener.java +++ b/test-track/backend/src/main/java/io/metersphere/excel/listener/TestCaseNoModelDataListener.java @@ -299,7 +299,6 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener { public int editNode(DragNodeRequest request) { request.setUpdateTime(System.currentTimeMillis()); - if (!CollectionUtils.isEmpty(request.getNodeIds())) { - List testCases = extTestCaseMapper.getForNodeEdit(request.getNodeIds()); - testCases.forEach(testCase -> { - StringBuilder path = new StringBuilder(testCase.getNodePath()); - List pathLists = Arrays.asList(path.toString().split("/")); - pathLists.set(request.getLevel(), request.getName()); - path.delete(0, path.length()); - for (int i = 1; i < pathLists.size(); i++) { - path = path.append("/").append(pathLists.get(i)); - } - testCase.setNodePath(path.toString()); - }); - batchUpdateTestCase(testCases); - } return testCaseNodeMapper.updateByPrimaryKeySelective(request); } - /** - * 修改用例的 nodePath - * - * @param editNodeIds - * @param projectId - */ - public void editCasePathForMinder(List editNodeIds, String projectId) { - if (!CollectionUtils.isEmpty(editNodeIds)) { - List nodeTrees = getNodeTrees(extTestCaseNodeMapper.getNodeTreeByProjectId(projectId)); - List testCases = extTestCaseMapper.getForNodeEdit(editNodeIds); - nodeTrees.forEach(nodeTree -> buildUpdateTestCase(nodeTree, testCases, null, "/", "0", 1)); - batchUpdateTestCase(testCases); - } - } - public int deleteNode(List nodeIds) { if (CollectionUtils.isEmpty(nodeIds)) { return 1; @@ -399,6 +370,24 @@ public class TestCaseNodeService extends NodeTreeService { return this.createNodes(nodePaths, projectId); } + public Map getNodePathMap(String projectId) { + List nodeTrees = getNodeTrees(getNodeTreeByProjectId(projectId)); + Map pathMap = new HashMap<>(); + buildPathMap(nodeTrees, pathMap, ""); + return pathMap; + } + + private void buildPathMap(List nodeTrees, Map pathMap, String rootPath) { + for (TestCaseNodeDTO nodeTree : nodeTrees) { + String currentPath = rootPath + "/" + nodeTree.getName(); + pathMap.put(nodeTree.getId(), currentPath); + List children = nodeTree.getChildren(); + if (!CollectionUtils.isEmpty(children)) { + buildPathMap(children, pathMap, currentPath); + } + } + } + public Map createNodes(List nodePaths, String projectId) { List nodeTrees = getNodeTreeByProjectId(projectId); Map pathMap = new HashMap<>(); @@ -457,8 +446,6 @@ public class TestCaseNodeService extends NodeTreeService { List nodeIds = request.getNodeIds(); - List testCases = QueryTestCaseByNodeIds(nodeIds); - TestCaseNodeDTO nodeTree = request.getNodeTree(); if (nodeTree == null) { @@ -467,15 +454,13 @@ public class TestCaseNodeService extends NodeTreeService { List updateNodes = new ArrayList<>(); - buildUpdateTestCase(nodeTree, testCases, updateNodes, "/", "0", 1); + buildUpdateTestCase(nodeTree, updateNodes, "0", 1); updateNodes = updateNodes.stream() .filter(item -> nodeIds.contains(item.getId())) .collect(Collectors.toList()); batchUpdateTestCaseNode(updateNodes); - - batchUpdateTestCase(testCases); } private void batchUpdateTestCaseNode(List updateNodes) { @@ -490,31 +475,8 @@ public class TestCaseNodeService extends NodeTreeService { } } - private void batchUpdateTestCase(List testCases) { - SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH); - TestCaseMapper testCaseMapper = sqlSession.getMapper(TestCaseMapper.class); - testCases.forEach((value) -> { - testCaseMapper.updateByPrimaryKeySelective(value); - }); - sqlSession.flushStatements(); - if (sqlSession != null && sqlSessionFactory != null) { - SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory); - } - } - - private List QueryTestCaseByNodeIds(List nodeIds) { - QueryTestCaseRequest testCaseRequest = new QueryTestCaseRequest(); - testCaseRequest.setNodeIds(nodeIds); - if (testCaseRequest.getFilters() != null && !testCaseRequest.getFilters().containsKey("status")) { - testCaseRequest.getFilters().put("status", new ArrayList<>(0)); - } - return extTestCaseMapper.list(testCaseRequest); - } - - private void buildUpdateTestCase(TestCaseNodeDTO rootNode, List testCases, - List updateNodes, String rootPath, String pId, int level) { - - rootPath = rootPath + rootNode.getName(); + private void buildUpdateTestCase(TestCaseNodeDTO rootNode, + List updateNodes, String pId, int level) { if (level > 8) { MSException.throwException(Translator.get("node_deep_limit")); @@ -528,16 +490,10 @@ public class TestCaseNodeService extends NodeTreeService { updateNodes.add(testCaseNode); } - for (TestCaseDTO item : testCases) { - if (StringUtils.equals(item.getNodeId(), rootNode.getId())) { - item.setNodePath(rootPath); - } - } - List children = rootNode.getChildren(); if (children != null && children.size() > 0) { for (int i = 0; i < children.size(); i++) { - buildUpdateTestCase(children.get(i), testCases, updateNodes, rootPath + '/', rootNode.getId(), level + 1); + buildUpdateTestCase(children.get(i), updateNodes, rootNode.getId(), level + 1); } } } @@ -715,8 +671,6 @@ public class TestCaseNodeService extends NodeTreeService { addNode(testCaseNode); } } - - editCasePathForMinder(editNodeIds, request.getProjectId()); } } diff --git a/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java b/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java index f20603fa39..421f65f4ab 100644 --- a/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java +++ b/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java @@ -113,10 +113,6 @@ public class TestCaseService { @Resource TestCaseNodeService testCaseNodeService; - - // @Resource - // ApiTestCaseMapper apiTestCaseMapper; - @Resource TestCaseIssueService testCaseIssueService; @Resource @@ -133,10 +129,6 @@ public class TestCaseService { AttachmentModuleRelationMapper attachmentModuleRelationMapper; @Resource ExtAttachmentModuleRelationMapper extAttachmentModuleRelationMapper; - // @Resource - // private LoadTestMapper loadTestMapper; - // @Resource - // private ApiScenarioMapper apiScenarioMapper; @Resource private TestCaseIssuesMapper testCaseIssuesMapper; @Resource @@ -149,15 +141,6 @@ public class TestCaseService { private RelevanceLoadCaseService relevanceLoadCaseService; @Resource private RelevanceUiCaseService relevanceUiCaseService; - // @Resource - // @Lazy - // private ApiTestCaseService apiTestCaseService; - // @Resource - // @Lazy - // private ApiAutomationService apiAutomationService; - // @Resource - // @Lazy - // private PerformanceTestService performanceTestService; @Resource private TestCaseFollowMapper testCaseFollowMapper; @Resource @@ -218,7 +201,6 @@ public class TestCaseService { List nodes = testCaseNodeMapper.selectByExample(example); if (CollectionUtils.isNotEmpty(nodes)) { testCase.setNodeId(nodes.get(0).getId()); - testCase.setNodePath("/" + nodes.get(0).getName()); } } } @@ -523,14 +505,6 @@ public class TestCaseService { if (StringUtils.equalsIgnoreCase(testCase.getVersionId(), defaultVersion)) { checkAndSetLatestVersion(testCase.getRefId()); } - if (StringUtils.isNotBlank(testCase.getNodePath())) { - //同步修改所有版本的模块路径 - updateOtherVersionModule(testCase); - } - } - - private void updateOtherVersionModule(EditTestCaseRequest testCase) { - extTestCaseMapper.updateVersionModule(testCase.getRefId(), testCase.getVersionId(), testCase.getNodeId(), testCase.getNodePath()); } /** @@ -604,28 +578,12 @@ public class TestCaseService { // 全部字段值相同才判断为用例存在 if (testCase != null) { - - /* - 例如对于“/模块5”,用户的输入可能为“模块5”或者“/模块5/”或者“模块5/”。 - 不这样处理的话,下面进行判断时就会用用户输入的错误格式进行判断,而模块名为“/模块5”、 - “模块5”、“/模块5/”、“模块5/”时,它们应该被认为是同一个模块。 - 数据库存储的node_path都是“/模块5”这种格式的 - */ - String nodePath = testCase.getNodePath(); - if (!nodePath.startsWith("/")) { - nodePath = "/" + nodePath; - } - if (nodePath.endsWith("/")) { - nodePath = nodePath.substring(0, nodePath.length() - 1); - } - TestCaseExample example = new TestCaseExample(); TestCaseExample.Criteria criteria = example.createCriteria(); criteria.andNameEqualTo(testCase.getName()) .andProjectIdEqualTo(testCase.getProjectId()) - .andNodePathEqualTo(nodePath) - .andTypeEqualTo(testCase.getType()) - .andStatusNotEqualTo("Trash"); + .andNodePathEqualTo(testCase.getNodeId()) + .andStatusNotEqualTo(CommonConstants.TrashStatus); if (StringUtils.isNotBlank(testCase.getPriority())) { criteria.andPriorityEqualTo(testCase.getPriority()); } @@ -1403,7 +1361,6 @@ public class TestCaseService { testCase.setCustomNum(dbCase.getCustomNum()); testCase.setNum(dbCase.getNum()); testCase.setLatest(false); - testCase.setType(dbCase.getType()); if (StringUtils.isBlank(testCase.getStatus())) { testCase.setStatus(TestCaseReviewStatus.Prepare.name()); } @@ -1575,6 +1532,9 @@ public class TestCaseService { TestCaseBatchRequest batchRequest = setTestCaseExportParamIds(initParam); // 1000条截取一次, 生成EXCEL AtomicInteger i = new AtomicInteger(0); + + Map nodePathMap = testCaseNodeService.getNodePathMap(request.getProjectId()); + SubListUtil.dealForSubList(batchRequest.getIds(), EXPORT_CASE_MAX_COUNT, (subIds) -> { i.getAndIncrement(); batchRequest.setIds(subIds); @@ -1583,9 +1543,12 @@ public class TestCaseService { FunctionCaseMergeWriteHandler writeHandler = new FunctionCaseMergeWriteHandler(rowMergeInfo, headList); Map> caseLevelAndStatusValueMap = trackTestCaseTemplateService.getCaseLevelAndStatusMapByProjectId(request.getProjectId()); FunctionCaseTemplateWriteHandler handler = new FunctionCaseTemplateWriteHandler(true, headList, caseLevelAndStatusValueMap); + List exportData = getExportData(batchRequest); + exportData.forEach(item -> item.setNodePath(nodePathMap.get(item.getNodeId()))); List excelData = parseCaseData2ExcelData(exportData, rowMergeInfo, isUseCustomId, request.getOtherHeaders()); List> data = parseExcelData2List(headList, excelData); + File createFile = new File(tmpZipPath + File.separatorChar + "caseExport_" + i.get() + ".xlsx"); if (!createFile.exists()) { try { @@ -2056,22 +2019,6 @@ public class TestCaseService { BeanUtils.copyBean(batchEdit, request); batchEdit.setUpdateTime(System.currentTimeMillis()); bathUpdateByCondition(request, batchEdit); - //批量修改选中数据其他版本的模块路径 - if (request != null && (request.getIds() != null || !request.getIds().isEmpty())) { - request.getIds().forEach(testCaseId -> { - TestCaseWithBLOBs testCaseWithBLOBs = testCaseMapper.selectByPrimaryKey(testCaseId); - if (testCaseWithBLOBs == null) { - return; - } - if (StringUtils.isNotEmpty(request.getNodeId()) && StringUtils.isNotEmpty(request.getNodePath())) { - testCaseWithBLOBs.setNodeId(request.getNodeId()); - testCaseWithBLOBs.setNodePath(request.getNodePath()); - EditTestCaseRequest editTestCaseRequest = new EditTestCaseRequest(); - BeanUtils.copyBean(editTestCaseRequest, testCaseWithBLOBs); - updateOtherVersionModule(editTestCaseRequest); - } - }); - } } } @@ -2184,7 +2131,7 @@ public class TestCaseService { batchCopy.setMaintainer(SessionUtils.getUserId()); batchCopy.setReviewStatus(TestCaseReviewStatus.Prepare.name()); batchCopy.setStatus(TestCaseReviewStatus.Prepare.name()); - batchCopy.setNodePath(request.getNodePath()); + batchCopy.setNodePath(StringUtils.EMPTY); batchCopy.setNodeId(request.getNodeId()); batchCopy.setCasePublic(false); batchCopy.setRefId(id); @@ -2753,24 +2700,6 @@ public class TestCaseService { return null; } - // public List getTestCaseApiCaseRelateList(ApiTestCaseRequest request) { - // List apiTestCaseDTOS = testCaseTestMapper.relevanceApiList(request); - // ServiceUtils.buildVersionInfo(apiTestCaseDTOS); - // return apiTestCaseDTOS; - // } - // - // public List getTestCaseScenarioCaseRelateList(ApiScenarioRequest request) { - // List apiScenarioDTOS = testCaseTestMapper.relevanceScenarioList(request); - // ServiceUtils.buildVersionInfo(apiScenarioDTOS); - // return apiScenarioDTOS; - // } - // - // public List getTestCaseLoadCaseRelateList(LoadCaseRequest request) { - // List loadTestDTOS = testCaseTestMapper.relevanceLoadList(request); - // ServiceUtils.buildVersionInfo(loadTestDTOS); - // return loadTestDTOS; - // } - public void relateTest(String type, String caseId, List apiIds) { apiIds.forEach(testId -> { TestCaseTest testCaseTest = new TestCaseTest(); @@ -3147,7 +3076,7 @@ public class TestCaseService { testCase.setName(testCase.getName().substring(0, 250) + testCase.getName().substring(testCase.getName().length() - 5)); } testCase.setNodeId(request.getNodeId()); - testCase.setNodePath(request.getNodePath()); + testCase.setNodePath(StringUtils.EMPTY); testCase.setOrder(nextOrder += ServiceUtils.ORDER_STEP); testCase.setCustomNum(String.valueOf(nextNum)); testCase.setNum(nextNum++); diff --git a/test-track/backend/src/main/java/io/metersphere/xmind/XmindCaseParser.java b/test-track/backend/src/main/java/io/metersphere/xmind/XmindCaseParser.java index f00ff8b676..61ccb5a195 100644 --- a/test-track/backend/src/main/java/io/metersphere/xmind/XmindCaseParser.java +++ b/test-track/backend/src/main/java/io/metersphere/xmind/XmindCaseParser.java @@ -1,6 +1,5 @@ package io.metersphere.xmind; -import com.google.common.collect.ImmutableMap; import io.metersphere.base.domain.TestCaseWithBLOBs; import io.metersphere.commons.constants.TestCaseConstants; import io.metersphere.commons.utils.BeanUtils; @@ -106,7 +105,6 @@ public class XmindCaseParser { return this.nodePaths; } - private final Map caseTypeMap = ImmutableMap.of("功能测试", "functional", "性能测试", "performance", "接口测试", "api"); private final List priorityList = Arrays.asList("P0", "P1", "P2", "P3"); /** @@ -188,20 +186,11 @@ public class XmindCaseParser { } } - if (StringUtils.equals(data.getType(), TestCaseConstants.Type.Functional.getValue()) && StringUtils.equals(data.getMethod(), TestCaseConstants.Method.Auto.getValue())) { - validatePass = false; - process.add(Translator.get("functional_method_tip"), nodePath + data.getName()); - } - // 用例等级和用例性质处理 if (!priorityList.contains(data.getPriority())) { validatePass = false; process.add(Translator.get("test_case_priority") + Translator.get("incorrect_format"), nodePath + data.getName()); } - if (data.getType() == null) { - validatePass = false; - process.add(Translator.get("test_case_type") + Translator.get("incorrect_format"), nodePath + data.getName()); - } // 重复用例校验 TestCaseExcelData dataItem = new TestCaseExcelData(); @@ -274,8 +263,8 @@ public class XmindCaseParser { /** * 递归处理案例数据 */ - private void recursion(Attached parent, int level, List attacheds) { - for (Attached item : attacheds) { + private void recursion(Attached parent, int level, List attachedList) { + for (Attached item : attachedList) { if (isAvailable(item.getTitle(), TC_REGEX)) { item.setParent(parent); // 格式化一个用例 @@ -354,8 +343,6 @@ public class XmindCaseParser { testCase.setProjectId(request.getProjectId()); testCase.setMaintainer(request.getUserId()); testCase.setPriority(priorityList.get(0)); - testCase.setMethod("manual"); - testCase.setType("functional"); String tc = title.replace(":", ":"); String[] tcArrs = tc.split(":"); @@ -375,8 +362,6 @@ public class XmindCaseParser { continue; } else if (item.toUpperCase().startsWith("P")) { testCase.setPriority(item.toUpperCase()); - } else { - testCase.setType(caseTypeMap.get(item)); } } } diff --git a/test-track/frontend/src/business/case/components/TestCaseList.vue b/test-track/frontend/src/business/case/components/TestCaseList.vue index bdf92b1c35..45ee8410c2 100644 --- a/test-track/frontend/src/business/case/components/TestCaseList.vue +++ b/test-track/frontend/src/business/case/components/TestCaseList.vue @@ -187,6 +187,9 @@ :fields-width="fieldsWidth" :label="$t('test_track.case.module')" min-width="150px"> + { + map.set(item.id, item.path); + }); + } + return map; + } }, created: function () { this.checkCurrentProject(); @@ -824,13 +836,9 @@ export default { parseCustomFilesForList(this.page.data); parseTag(this.page.data); this.page.data.forEach(item => { - let nodePath = item.nodePath; if (item.customFields) { item.customFields = JSON.parse(item.customFields); } - if (nodePath.startsWith("/未规划用例", "0")) { - item.nodePath = nodePath.replaceAll("/未规划用例", "/" + this.$t('api_test.unplanned_case')); - } }); this.updateTestCaseNodeCount(); }); diff --git a/workstation/backend/src/main/java/io/metersphere/workstation/controller/track/TrackController.java b/workstation/backend/src/main/java/io/metersphere/workstation/controller/track/TrackController.java index 1da3c34227..5b56eb17be 100644 --- a/workstation/backend/src/main/java/io/metersphere/workstation/controller/track/TrackController.java +++ b/workstation/backend/src/main/java/io/metersphere/workstation/controller/track/TrackController.java @@ -9,6 +9,7 @@ import jakarta.annotation.Resource; @RestController @RequestMapping(path = { "issues", + "case/node", "/test/case", "/test/plan" }) diff --git a/workstation/frontend/src/api/test-case-node.js b/workstation/frontend/src/api/test-case-node.js new file mode 100644 index 0000000000..d5f2388ca0 --- /dev/null +++ b/workstation/frontend/src/api/test-case-node.js @@ -0,0 +1,5 @@ +import {post,get} from "metersphere-frontend/src/plugins/request"; + +export function getTestCaseNodes(projectId) { + return get('/case/node/list/' + projectId); +} diff --git a/workstation/frontend/src/business/component/CaseTableList.vue b/workstation/frontend/src/business/component/CaseTableList.vue index 0ac865e6bc..a68d4de14f 100644 --- a/workstation/frontend/src/business/component/CaseTableList.vue +++ b/workstation/frontend/src/business/component/CaseTableList.vue @@ -76,6 +76,9 @@ :label="$t('test_track.case.module')" min-width="150px" > + { this.userFilter = data; }); + this.getNodePathMap(); if (this.isFocus) { if (this.condition.filters) { delete this.condition.filters["user_id"]; @@ -556,6 +563,30 @@ export default { }); }); }, + getNodePathMap() { + if (!this.projectId) { + return; + } + getTestCaseNodes(this.projectId) + .then((r) => { + let treeNodes = r.data; + treeNodes.forEach(node => { + node.name = node.name === '未规划用例' ? this.$t('api_test.unplanned_case') : node.name + buildTree(node, {path: ''}); + }); + let moduleOptions = []; + treeNodes.forEach(node => { + buildNodePath(node, {path: ''}, moduleOptions); + }); + let map = new Map(); + if (moduleOptions) { + moduleOptions.forEach((item) => { + map.set(item.id, item.path); + }); + } + this.nodePathMap = map; + }); + }, setTestCaseDefaultValue(template) { let testCaseDefaultValue = {}; template.customFields.forEach((item) => {