fix: 另存为新用例报id重复

This commit is contained in:
chenjianxing 2021-02-04 19:24:35 +08:00
parent fe2f4e90a2
commit 3aa0d05d66
4 changed files with 72 additions and 66 deletions

View File

@ -22,8 +22,8 @@
import MsEditCompleteDubboApi from "./complete/EditCompleteDubboApi"; import MsEditCompleteDubboApi from "./complete/EditCompleteDubboApi";
import MsEditCompleteSqlApi from "./complete/EditCompleteSQLApi"; import MsEditCompleteSqlApi from "./complete/EditCompleteSQLApi";
import {ResponseFactory, Body} from "../model/ApiTestModel"; import {Body} from "../model/ApiTestModel";
import {getUUID, getCurrentProjectID} from "@/common/js/utils"; import {getUUID} from "@/common/js/utils";
import {createComponent, Request} from "./jmeter/components"; import {createComponent, Request} from "./jmeter/components";
import Sampler from "./jmeter/components/sampler/sampler"; import Sampler from "./jmeter/components/sampler/sampler";
import {WORKSPACE_ID} from '@/common/js/constants'; import {WORKSPACE_ID} from '@/common/js/constants';

View File

@ -44,7 +44,7 @@
</template> </template>
<script> <script>
import {downloadFile, getUUID} from "@/common/js/utils"; import {getUUID, uuid} from "@/common/js/utils";
import MsApiCaseList from "../case/ApiCaseList"; import MsApiCaseList from "../case/ApiCaseList";
import MsContainer from "../../../../common/components/MsContainer"; import MsContainer from "../../../../common/components/MsContainer";
import MsBottomContainer from "../BottomContainer"; import MsBottomContainer from "../BottomContainer";
@ -161,12 +161,14 @@
}, },
saveAsApi() { saveAsApi() {
let data = {}; let data = {};
this.api.request.id = uuid();
data.request = JSON.stringify(this.api.request); data.request = JSON.stringify(this.api.request);
data.method = this.api.method; data.method = this.api.method;
data.status = this.api.status; data.status = this.api.status;
data.userId = this.api.userId; data.userId = this.api.userId;
data.description = this.api.description; data.description = this.api.description;
this.$emit('saveAsApi', data); this.$emit('saveAsApi', data);
this.$emit('refresh');
}, },
updateApi() { updateApi() {
let url = "/api/definition/update"; let url = "/api/definition/update";

View File

@ -44,7 +44,7 @@
</template> </template>
<script> <script>
import {getUUID} from "@/common/js/utils"; import {getUUID, uuid} from "@/common/js/utils";
import MsApiCaseList from "../case/ApiCaseList"; import MsApiCaseList from "../case/ApiCaseList";
import MsContainer from "../../../../common/components/MsContainer"; import MsContainer from "../../../../common/components/MsContainer";
import MsBottomContainer from "../BottomContainer"; import MsBottomContainer from "../BottomContainer";
@ -160,12 +160,14 @@ export default {
}, },
saveAsApi() { saveAsApi() {
let data = {}; let data = {};
this.api.request.id = uuid();
data.request = JSON.stringify(this.api.request); data.request = JSON.stringify(this.api.request);
data.method = this.api.method; data.method = this.api.method;
data.status = this.api.status; data.status = this.api.status;
data.userId = this.api.userId; data.userId = this.api.userId;
data.description = this.api.description; data.description = this.api.description;
this.$emit('saveAsApi', data); this.$emit('saveAsApi', data);
this.$emit('refresh');
}, },
updateApi() { updateApi() {
let url = "/api/definition/update"; let url = "/api/definition/update";

View File

@ -55,7 +55,7 @@
<script> <script>
import MsApiRequestForm from "../request/http/ApiHttpRequestForm"; import MsApiRequestForm from "../request/http/ApiHttpRequestForm";
import {downloadFile, getUUID, getCurrentProjectID} from "@/common/js/utils"; import {getUUID, uuid} from "@/common/js/utils";
import MsApiCaseList from "../case/ApiCaseList"; import MsApiCaseList from "../case/ApiCaseList";
import MsContainer from "../../../../common/components/MsContainer"; import MsContainer from "../../../../common/components/MsContainer";
import MsBottomContainer from "../BottomContainer"; import MsBottomContainer from "../BottomContainer";
@ -173,12 +173,14 @@
}, },
saveAsApi() { saveAsApi() {
let data = {}; let data = {};
this.api.request.id = uuid();
data.request = JSON.stringify(this.api.request); data.request = JSON.stringify(this.api.request);
data.method = this.api.method; data.method = this.api.method;
data.status = this.api.status; data.status = this.api.status;
data.userId = this.api.userId; data.userId = this.api.userId;
data.description = this.api.description; data.description = this.api.description;
this.$emit('saveAsApi', data); this.$emit('saveAsApi', data);
this.$emit('refresh');
}, },
updateApi() { updateApi() {
let url = "/api/definition/update"; let url = "/api/definition/update";