diff --git a/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue b/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue index 721c6f6029..6934a02347 100644 --- a/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue +++ b/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue @@ -262,11 +262,13 @@ export default { initDataSource() { let databaseConfigsOptions = []; if (this.request.protocol === 'SQL' || this.request.type === 'JDBCSampler') { - if (this.environment.config) { + if (this.environment && this.environment.config) { let config = JSON.parse(this.environment.config); - config.databaseConfigs.forEach(item => { - databaseConfigsOptions.push(item); - }); + if(config && config.databaseConfigs) { + config.databaseConfigs.forEach(item => { + databaseConfigsOptions.push(item); + }); + } } } if (databaseConfigsOptions.length > 0 && this.request.environmentId !== this.environment.id) { diff --git a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue index 4b2ba6d11e..c02ec70ff5 100644 --- a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue +++ b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue @@ -8,7 +8,7 @@ - +
@@ -193,6 +193,7 @@ }, props: { runResult:{}, + selectSize: Number, apiCase: { type: Object, default() { @@ -220,7 +221,11 @@ this.showXpackCompnent = true; } }, - watch: {}, + watch: { + 'apiCase.selected'(){ + this.$emit('apiCaseSelected'); + } + }, methods: { openHis(row) { this.$refs.changeHistory.open(row.id); diff --git a/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue b/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue index 067a32a5a7..90205c2850 100644 --- a/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue +++ b/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue @@ -30,7 +30,9 @@ @showExecResult="showExecResult" @batchEditCase="batchEditCase" @batchRun="batchRun" + @apiCaseSelected="apiCaseSelected" :environment="environment" + :select-size="selectSize" :is-case-edit="isCaseEdit" :api="api" :runResult="runResult" @@ -82,6 +84,7 @@ export default { environment: "", isReadOnly: false, selectedEvent: Object, + selectSize: 0, priorities: CASE_ORDER, apiCaseList: [], batchLoadingIds: [], @@ -141,6 +144,16 @@ export default { }, }, methods: { + apiCaseSelected(){ + this.selectSize = 0; + if (this.apiCaseList.length > 0) { + this.apiCaseList.forEach(item => { + if (item.selected && item.id) { + this.selectSize ++; + } + }); + } + }, open(api, testCaseId) { this.api = api; // testCaseId 不为空则为用例编辑页面