fix(接口定义): 用例操作选项统计 #1005256

--bug=1005256 --user=赵勇 【接口定义】批量处理... https://www.tapd.cn/55049933/s/1026493
This commit is contained in:
fit2-zhao 2021-07-20 18:36:16 +08:00 committed by fit2-zhao
parent 3e525fc78d
commit 1db7049dd1
3 changed files with 26 additions and 6 deletions

View File

@ -262,13 +262,15 @@ 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);
if(config && config.databaseConfigs) {
config.databaseConfigs.forEach(item => {
databaseConfigsOptions.push(item);
});
}
}
}
if (databaseConfigsOptions.length > 0 && this.request.environmentId !== this.environment.id) {
this.request.dataSourceId = databaseConfigsOptions[0].id;
this.request.environmentId = this.environment.id;

View File

@ -8,7 +8,7 @@
<el-checkbox class="item-select" v-model="apiCase.selected"/>
</el-col>
<el-col :span="2" style="margin-top: 2px">
<show-more-btn :is-show="apiCase.selected" :buttons="buttons"/>
<show-more-btn :is-show="apiCase.selected" :buttons="buttons" :size="selectSize"/>
</el-col>
<el-col :span="20">
<div class="el-step__icon is-text ms-api-col">
@ -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);

View File

@ -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