fix(接口测试): 修复接口定义更多操作创建接口可以创建多个接口的缺陷
--bug=1027123 --user=王孝刚 【接口测试】接口定义-更多操作-创建接口-输入信息后-点击编辑详情多次后很久后发现创建了多个相同的接口 https://www.tapd.cn/55049933/s/1385052
This commit is contained in:
parent
b92800d6cd
commit
0b323768b3
|
@ -75,6 +75,7 @@
|
||||||
<ms-dialog-footer
|
<ms-dialog-footer
|
||||||
@cancel="visible = false"
|
@cancel="visible = false"
|
||||||
:isShow="true"
|
:isShow="true"
|
||||||
|
v-loading="loading"
|
||||||
:title="$t('commons.edit_info')"
|
:title="$t('commons.edit_info')"
|
||||||
@saveAsEdit="saveScenario(true)"
|
@saveAsEdit="saveScenario(true)"
|
||||||
@confirm="saveScenario">
|
@confirm="saveScenario">
|
||||||
|
@ -135,6 +136,7 @@ export default {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
loading: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -150,16 +152,19 @@ export default {
|
||||||
saveScenario(saveAs) {
|
saveScenario(saveAs) {
|
||||||
this.$refs['scenarioForm'].validate((valid) => {
|
this.$refs['scenarioForm'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
this.loading = true;
|
||||||
let path = '/api/automation/create';
|
let path = '/api/automation/create';
|
||||||
this.setParameter();
|
this.setParameter();
|
||||||
this.scenarioForm.status = 'Underway';
|
this.scenarioForm.status = 'Underway';
|
||||||
this.scenarioForm.level = 'P0';
|
this.scenarioForm.level = 'P0';
|
||||||
if (saveAs) {
|
if (saveAs) {
|
||||||
|
this.loading = false;
|
||||||
this.scenarioForm.request = JSON.stringify(this.scenarioForm.request);
|
this.scenarioForm.request = JSON.stringify(this.scenarioForm.request);
|
||||||
this.$emit('saveAsEdit', this.scenarioForm);
|
this.$emit('saveAsEdit', this.scenarioForm);
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
} else {
|
} else {
|
||||||
saveScenario(path, this.scenarioForm, [], this, (response) => {
|
saveScenario(path, this.scenarioForm, [], this, (response) => {
|
||||||
|
this.loading = false;
|
||||||
this.$success(this.$t('commons.save_success'));
|
this.$success(this.$t('commons.save_success'));
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
this.$emit('refresh');
|
this.$emit('refresh');
|
||||||
|
|
|
@ -68,6 +68,7 @@
|
||||||
@cancel="httpVisible = false"
|
@cancel="httpVisible = false"
|
||||||
:isShow="true"
|
:isShow="true"
|
||||||
title="编辑详情"
|
title="编辑详情"
|
||||||
|
v-loading="loading"
|
||||||
@saveAsEdit="saveApi(true)"
|
@saveAsEdit="saveApi(true)"
|
||||||
@confirm="saveApi">
|
@confirm="saveApi">
|
||||||
</ms-dialog-footer>
|
</ms-dialog-footer>
|
||||||
|
@ -142,6 +143,7 @@ export default {
|
||||||
},
|
},
|
||||||
value: REQ_METHOD[0].id,
|
value: REQ_METHOD[0].id,
|
||||||
options: REQ_METHOD,
|
options: REQ_METHOD,
|
||||||
|
loading: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -168,6 +170,7 @@ export default {
|
||||||
saveApi(saveAs) {
|
saveApi(saveAs) {
|
||||||
this.$refs['httpForm'].validate((valid) => {
|
this.$refs['httpForm'].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
this.loading = true;
|
||||||
let bodyFiles = [];
|
let bodyFiles = [];
|
||||||
this.setParameter();
|
this.setParameter();
|
||||||
this.httpForm.status = 'Underway';
|
this.httpForm.status = 'Underway';
|
||||||
|
@ -176,12 +179,13 @@ export default {
|
||||||
this.httpForm.request.clazzName = TYPE_TO_C.get(this.httpForm.request.type);
|
this.httpForm.request.clazzName = TYPE_TO_C.get(this.httpForm.request.type);
|
||||||
this.compatibleHistory(this.httpForm.request.hashTree);
|
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;
|
this.httpVisible = false;
|
||||||
if (saveAs) {
|
if (saveAs) {
|
||||||
this.httpForm.request = JSON.stringify(this.httpForm.request);
|
this.loading = false;
|
||||||
this.$emit('saveAsEdit', this.httpForm);
|
this.$emit('saveAsEdit', res.data.data);
|
||||||
} else {
|
} else {
|
||||||
|
this.loading = false;
|
||||||
this.$emit('refresh');
|
this.$emit('refresh');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue