fix(接口自动化): 修复场景调试时会触发表单重复提交的问题

修复场景调试时会触发表单重复提交的问题
This commit is contained in:
song-tianyang 2021-07-02 13:29:50 +08:00 committed by 刘瑞斌
parent c6d314dc30
commit 7cd44b8371
2 changed files with 11 additions and 1 deletions

View File

@ -47,6 +47,7 @@ import {saveScenario} from "@/business/components/api/automation/api-automation"
saveScenario('/api/automation/run/debug', reqObj, this.runData.hashTree, (response) => { saveScenario('/api/automation/run/debug', reqObj, this.runData.hashTree, (response) => {
this.runId = response.data; this.runId = response.data;
this.$emit('runRefresh', {}); this.$emit('runRefresh', {});
this.$emit("changeDebugButton");
}); });
}, },
} }

View File

@ -146,7 +146,7 @@
<el-col :span="4"> <el-col :span="4">
<el-tooltip content="Ctrl + R"> <el-tooltip content="Ctrl + R">
<el-button :disabled="scenarioDefinition.length < 1" size="mini" type="primary" v-prevent-re-click <el-button :disabled="scenarioDefinition.length < 1" size="mini" type="primary" v-prevent-re-click
@click="runDebug">{{ $t('api_test.request.debug') }} @click="runDebug" :loading="buttonIsLoading">{{ $t('api_test.request.debug') }}
</el-button> </el-button>
</el-tooltip> </el-tooltip>
<el-tooltip class="item" effect="dark" :content="$t('commons.refresh')" placement="right-start"> <el-tooltip class="item" effect="dark" :content="$t('commons.refresh')" placement="right-start">
@ -231,6 +231,7 @@
<!--执行组件--> <!--执行组件-->
<ms-run :debug="true" v-if="type!=='detail'" :environment="projectEnvMap" :reportId="reportId" <ms-run :debug="true" v-if="type!=='detail'" :environment="projectEnvMap" :reportId="reportId"
:run-data="debugData" :run-data="debugData"
@changeDebugButton="changeDebugButton"
@runRefresh="runRefresh" ref="runTest"/> @runRefresh="runRefresh" ref="runTest"/>
<!-- 调试结果 --> <!-- 调试结果 -->
<el-drawer v-if="type!=='detail'" :visible.sync="debugVisible" :destroy-on-close="true" direction="ltr" <el-drawer v-if="type!=='detail'" :visible.sync="debugVisible" :destroy-on-close="true" direction="ltr"
@ -386,6 +387,7 @@ export default {
path: "/api/automation/create", path: "/api/automation/create",
debugData: {}, debugData: {},
reportId: "", reportId: "",
buttonIsLoading:false,
enableCookieShare: false, enableCookieShare: false,
globalOptions: { globalOptions: {
@ -891,6 +893,7 @@ export default {
runDebug() { runDebug() {
/*触发执行操作*/ /*触发执行操作*/
this.$refs.currentScenario.validate((valid) => { this.$refs.currentScenario.validate((valid) => {
this.buttonIsLoading = true;
if (valid) { if (valid) {
let definition = JSON.parse(JSON.stringify(this.currentScenario)); let definition = JSON.parse(JSON.stringify(this.currentScenario));
definition.hashTree = this.scenarioDefinition; definition.hashTree = this.scenarioDefinition;
@ -915,15 +918,21 @@ export default {
onSampleError: this.onSampleError, onSampleError: this.onSampleError,
}; };
this.reportId = getUUID().substring(0, 8); this.reportId = getUUID().substring(0, 8);
// this.editScenario().then(() => { // this.editScenario().then(() => {
// //
// }) // })
}) })
}) })
}else {
this.buttonIsLoading = false;
} }
}) })
}, },
changeDebugButton(){
this.buttonIsLoading = false;
},
getEnvironments() { getEnvironments() {
if (this.projectId) { if (this.projectId) {
this.$get('/api/environment/list/' + this.projectId, response => { this.$get('/api/environment/list/' + this.projectId, response => {