fix(接口定义): 统一id 方便后续引用

This commit is contained in:
fit2-zhao 2020-12-02 14:31:53 +08:00
parent d571c9dc07
commit 4e12976dfd
3 changed files with 26 additions and 12 deletions

View File

@ -1,18 +1,22 @@
<template> <template>
<div> apiAutomation</div> <div>
<ms-edit-api-scenario/>
</div>
</template> </template>
<script> <script>
import MsEditApiScenario from "./scenario/EditApiScenario";
export default { export default {
name: "ApiAutomation", name: "ApiAutomation",
components: {}, components: {MsEditApiScenario},
comments: {}, comments: {},
data() { data() {
return {} return {}
}, },
watch: {}, watch: {},
methods: {} methods: {
}
} }
</script> </script>

View File

@ -73,7 +73,6 @@
this.reqUrl = "/api/definition/update"; this.reqUrl = "/api/definition/update";
} else { } else {
this.reqUrl = "/api/definition/create"; this.reqUrl = "/api/definition/create";
this.currentApi.id = getUUID().substring(0, 8);
} }
}, },
methods: { methods: {
@ -139,6 +138,9 @@
this.request.name = this.currentApi.name; this.request.name = this.currentApi.name;
data.protocol = this.currentProtocol; data.protocol = this.currentProtocol;
data.request = this.request; data.request = this.request;
data.request.name = data.name;
data.request.protocol = this.currentProtocol;
data.id = data.request.id;
data.response = this.response; data.response = this.response;
}, },
getBodyUploadFiles(data) { getBodyUploadFiles(data) {

View File

@ -111,14 +111,6 @@
}) })
}, },
setParameter() { setParameter() {
this.httpForm.bodyUploadIds = [];
this.httpForm.projectId = this.projectId;
this.httpForm.id = getUUID().substring(0, 8);
this.httpForm.protocol = this.currentProtocol;
if (this.currentModule != null) {
this.httpForm.modulePath = this.currentModule.method != undefined ? this.currentModule.method : null;
this.httpForm.moduleId = this.currentModule.id;
}
switch (this.currentProtocol) { switch (this.currentProtocol) {
case Request.TYPES.SQL: case Request.TYPES.SQL:
this.initSQL(); this.initSQL();
@ -133,6 +125,22 @@
this.initHTTP(); this.initHTTP();
break; break;
} }
this.httpForm.bodyUploadIds = [];
this.httpForm.projectId = this.projectId;
this.httpForm.id = this.httpForm.request.id;
this.httpForm.protocol = this.currentProtocol;
this.httpForm.request.name = this.httpForm.name;
this.httpForm.request.protocol = this.currentProtocol;
if (this.currentProtocol === 'HTTP') {
this.httpForm.request.method = this.httpForm.method;
this.httpForm.request.path = this.httpForm.path;
}
if (this.currentModule != null) {
this.httpForm.modulePath = this.currentModule.method != undefined ? this.currentModule.method : null;
this.httpForm.moduleId = this.currentModule.id;
}
}, },
initHTTP() { initHTTP() {
let request = createComponent("HTTPSamplerProxy"); let request = createComponent("HTTPSamplerProxy");