fix (接口自动化): 修复循环执行后状态码错误问题

--bug=1006465 --user=赵勇 【github#6020】调试的... https://www.tapd.cn/55049933/s/1046076
This commit is contained in:
fit2-zhao 2021-09-13 16:40:13 +08:00 committed by fit2-zhao
parent dadfff5598
commit d8c7a3c1d8
2 changed files with 75 additions and 44 deletions

View File

@ -26,8 +26,8 @@
<i class="el-icon-loading" style="font-size: 16px"/>
{{ $t('commons.testing') }}
</span>
<span class="ms-step-debug-code" :class="request.requestResult[0].success?'ms-req-success':'ms-req-error'" v-if="!loading &&!request.testing && request.debug && request.requestResult[0] && request.requestResult[0].responseResult">
{{ request.requestResult[0].success ? 'success' : 'error' }}
<span class="ms-step-debug-code" :class="request.requestResult[0].success && reqSuccess?'ms-req-success':'ms-req-error'" v-if="!loading &&!request.testing && request.debug && request.requestResult[0] && request.requestResult[0].responseResult">
{{ request.requestResult[0].success && reqSuccess ? 'success' : 'error' }}
</span>
</template>
<template v-slot:button>
@ -187,6 +187,7 @@ export default {
environment: {},
result: {},
apiActive: false,
reqSuccess: true
}
},
created() {
@ -227,6 +228,7 @@ export default {
this.getEnvironments();
},
message() {
this.forStatus();
this.reload();
},
},
@ -300,6 +302,26 @@ export default {
},
},
methods: {
forStatus() {
if (this.request.result && this.request.result.length > 0) {
this.request.result.forEach(item => {
item.requestResult.forEach(req => {
if (!req.success) {
this.reqSuccess = req.success;
}
})
})
} else if (this.request.requestResult && this.request.requestResult.length > 1) {
this.request.requestResult.forEach(item => {
if (!item.success) {
this.reqSuccess = item.success;
if (this.node && this.node.parent && this.node.parent.data) {
this.node.parent.data.code = 'error';
}
}
})
}
},
initDataSource() {
let databaseConfigsOptions = [];
if (this.request.protocol === 'SQL' || this.request.type === 'JDBCSampler') {

View File

@ -6,7 +6,7 @@
<el-tooltip
:content="responseResult.responseCode"
placement="top">
<div class="node-title">
<div class="node-title" :class="response && response.success ?'ms-req-success':'ms-req-error'">
{{ responseResult && responseResult.responseCode ? responseResult.responseCode : '0' }}
</div>
</el-tooltip>
@ -66,4 +66,13 @@
margin-left: 10px;
float: left
}
.ms-req-error {
color: #F56C6C;
}
.ms-req-success {
color: #67C23A;
}
</style>