From 249d9fcefe910b10710a6dae29076bfe9a7e1c3d Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Wed, 2 Jun 2021 12:02:45 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=83=A8=E5=88=86=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E8=A1=A8=E5=A4=B4=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E4=BF=9D=E5=AD=98=E5=88=97=E5=AE=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/ApiAutomationService.java | 14 +- .../api/automation/ApiAutomation.vue | 4 +- .../automation/scenario/ApiScenarioList.vue | 449 ++++++++---------- .../scenario/api/RelevanceApiList.vue | 194 +++----- .../api/definition/ApiDefinition.vue | 7 - .../components/list/ApiCaseSimpleList.vue | 148 +++--- .../definition/components/list/ApiList.vue | 262 +++++----- .../components/table/Ms-table-column.vue | 13 +- .../components/table/MsCustomTableHeader.vue | 102 ++++ .../common/components/table/MsTable.vue | 66 ++- .../table/MsTableHeaderSelectPopover.vue | 4 +- .../components/common/model/JsonData.js | 25 - .../workspace/template/CustomFieldList.vue | 40 +- .../workspace/template/IssuesTemplateList.vue | 1 + .../template/TestCaseTemplateList.vue | 1 + frontend/src/common/css/main.css | 2 +- .../src/common/js/default-table-header.js | 56 +++ frontend/src/common/js/tableUtils.js | 72 +++ 18 files changed, 782 insertions(+), 678 deletions(-) create mode 100644 frontend/src/business/components/common/components/table/MsCustomTableHeader.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 747552b019..df3ac9ba69 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -527,7 +527,9 @@ public class ApiAutomationService { objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); JSONObject element = JSON.parseObject(definition); try { - return objectMapper.readValue(element.getString("hashTree"), new TypeReference>() {}); + if (element != null) { + return objectMapper.readValue(element.getString("hashTree"), new TypeReference>() {}); + } } catch (JsonProcessingException e) { LogUtil.error(e.getMessage(), e); } @@ -1703,10 +1705,12 @@ public class ApiAutomationService { ApiScenarioWithBLOBs scenario = apiScenarioMapper.selectByPrimaryKey(id); String definition = scenario.getScenarioDefinition(); JSONObject object = JSON.parseObject(definition); - object.put("environmentMap", newEnvMap); - String newDefinition = JSON.toJSONString(object); - scenario.setScenarioDefinition(newDefinition); - apiScenarioMapper.updateByPrimaryKeySelective(scenario); + if (object != null) { + object.put("environmentMap", newEnvMap); + String newDefinition = JSON.toJSONString(object); + scenario.setScenarioDefinition(newDefinition); + apiScenarioMapper.updateByPrimaryKeySelective(scenario); + } } }); } diff --git a/frontend/src/business/components/api/automation/ApiAutomation.vue b/frontend/src/business/components/api/automation/ApiAutomation.vue index 6b3097575c..40941ffba6 100644 --- a/frontend/src/business/components/api/automation/ApiAutomation.vue +++ b/frontend/src/business/components/api/automation/ApiAutomation.vue @@ -174,11 +174,11 @@ export default { let data = response.data; if (data != null) { //如果树未加载 - if (JSON.stringify(this.moduleOptions) === '{}') { + if (this.moduleOptions && JSON.stringify(this.moduleOptions) === '{}') { this.$refs.nodeTree.list(); } let row = data.listObject[0]; - if (row.tags.length > 0) { + if (row.tags && row.tags.length > 0) { row.tags = JSON.parse(row.tags); } diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue index 7d35baa0c2..ab318fd359 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue @@ -4,116 +4,130 @@ - + - + - - - - - -