fix(接口测试): 修复接口定义更多操作创建接口可以创建多个接口的缺陷

--bug=1027123 --user=王孝刚
【接口测试】接口定义-更多操作-创建接口-输入信息后-点击编辑详情多次后很久后发现创建了多个相同的接口
https://www.tapd.cn/55049933/s/1385052
This commit is contained in:
wxg0103 2023-06-21 17:48:06 +08:00 committed by f2c-ci-robot[bot]
parent b92800d6cd
commit 0b323768b3
2 changed files with 12 additions and 3 deletions

View File

@ -75,6 +75,7 @@
<ms-dialog-footer
@cancel="visible = false"
:isShow="true"
v-loading="loading"
:title="$t('commons.edit_info')"
@saveAsEdit="saveScenario(true)"
@confirm="saveScenario">
@ -135,6 +136,7 @@ export default {
},
],
},
loading: false,
};
},
computed: {
@ -150,16 +152,19 @@ export default {
saveScenario(saveAs) {
this.$refs['scenarioForm'].validate((valid) => {
if (valid) {
this.loading = true;
let path = '/api/automation/create';
this.setParameter();
this.scenarioForm.status = 'Underway';
this.scenarioForm.level = 'P0';
if (saveAs) {
this.loading = false;
this.scenarioForm.request = JSON.stringify(this.scenarioForm.request);
this.$emit('saveAsEdit', this.scenarioForm);
this.visible = false;
} else {
saveScenario(path, this.scenarioForm, [], this, (response) => {
this.loading = false;
this.$success(this.$t('commons.save_success'));
this.visible = false;
this.$emit('refresh');

View File

@ -68,6 +68,7 @@
@cancel="httpVisible = false"
:isShow="true"
title="编辑详情"
v-loading="loading"
@saveAsEdit="saveApi(true)"
@confirm="saveApi">
</ms-dialog-footer>
@ -142,6 +143,7 @@ export default {
},
value: REQ_METHOD[0].id,
options: REQ_METHOD,
loading: false,
};
},
computed: {
@ -168,6 +170,7 @@ export default {
saveApi(saveAs) {
this.$refs['httpForm'].validate((valid) => {
if (valid) {
this.loading = true;
let bodyFiles = [];
this.setParameter();
this.httpForm.status = 'Underway';
@ -176,12 +179,13 @@ export default {
this.httpForm.request.clazzName = TYPE_TO_C.get(this.httpForm.request.type);
this.compatibleHistory(this.httpForm.request.hashTree);
}
this.result = createDefinition(null, bodyFiles, this.httpForm).then(() => {
this.result = createDefinition(null, bodyFiles, this.httpForm).then((res) => {
this.httpVisible = false;
if (saveAs) {
this.httpForm.request = JSON.stringify(this.httpForm.request);
this.$emit('saveAsEdit', this.httpForm);
this.loading = false;
this.$emit('saveAsEdit', res.data.data);
} else {
this.loading = false;
this.$emit('refresh');
}
});