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

@ -17,29 +17,29 @@
</template>
<script>
import MsEditCompleteHttpApi from "./complete/EditCompleteHTTPApi";
import MsEditCompleteTcpApi from "./complete/EditCompleteTCPApi";
import MsEditCompleteDubboApi from "./complete/EditCompleteDubboApi";
import MsEditCompleteSqlApi from "./complete/EditCompleteSQLApi";
import MsEditCompleteHttpApi from "./complete/EditCompleteHTTPApi";
import MsEditCompleteTcpApi from "./complete/EditCompleteTCPApi";
import MsEditCompleteDubboApi from "./complete/EditCompleteDubboApi";
import MsEditCompleteSqlApi from "./complete/EditCompleteSQLApi";
import {ResponseFactory, Body} from "../model/ApiTestModel";
import {getUUID, getCurrentProjectID} from "@/common/js/utils";
import {createComponent, Request} from "./jmeter/components";
import Sampler from "./jmeter/components/sampler/sampler";
import {WORKSPACE_ID} from '@/common/js/constants';
import {handleCtrlSEvent} from "../../../../../common/js/utils";
import {Body} from "../model/ApiTestModel";
import {getUUID} from "@/common/js/utils";
import {createComponent, Request} from "./jmeter/components";
import Sampler from "./jmeter/components/sampler/sampler";
import {WORKSPACE_ID} from '@/common/js/constants';
import {handleCtrlSEvent} from "../../../../../common/js/utils";
export default {
name: "ApiConfig",
components: {MsEditCompleteHttpApi, MsEditCompleteTcpApi, MsEditCompleteDubboApi, MsEditCompleteSqlApi},
data() {
return {
reqUrl: "",
request: Sampler,
config: {},
response: {},
maintainerOptions: [],
}
export default {
name: "ApiConfig",
components: {MsEditCompleteHttpApi, MsEditCompleteTcpApi, MsEditCompleteDubboApi, MsEditCompleteSqlApi},
data() {
return {
reqUrl: "",
request: Sampler,
config: {},
response: {},
maintainerOptions: [],
}
},
props: {
currentApi: {},

View File

@ -44,29 +44,29 @@
</template>
<script>
import {downloadFile, getUUID} from "@/common/js/utils";
import MsApiCaseList from "../case/ApiCaseList";
import MsContainer from "../../../../common/components/MsContainer";
import MsBottomContainer from "../BottomContainer";
import {parseEnvironment} from "../../model/EnvironmentModel";
import ApiEnvironmentConfig from "../environment/ApiEnvironmentConfig";
import MsRequestResultTail from "../response/RequestResultTail";
import MsRun from "../Run";
import MsBasisParameters from "../request/dubbo/BasisParameters";
import {REQ_METHOD} from "../../model/JsonData";
import MsJmxStep from "../step/JmxStep";
import {getUUID, uuid} from "@/common/js/utils";
import MsApiCaseList from "../case/ApiCaseList";
import MsContainer from "../../../../common/components/MsContainer";
import MsBottomContainer from "../BottomContainer";
import {parseEnvironment} from "../../model/EnvironmentModel";
import ApiEnvironmentConfig from "../environment/ApiEnvironmentConfig";
import MsRequestResultTail from "../response/RequestResultTail";
import MsRun from "../Run";
import MsBasisParameters from "../request/dubbo/BasisParameters";
import {REQ_METHOD} from "../../model/JsonData";
import MsJmxStep from "../step/JmxStep";
export default {
name: "RunTestDubboPage",
components: {
MsApiCaseList,
MsContainer,
MsBottomContainer,
MsRequestResultTail,
ApiEnvironmentConfig,
MsRun,
MsBasisParameters,
MsJmxStep
export default {
name: "RunTestDubboPage",
components: {
MsApiCaseList,
MsContainer,
MsBottomContainer,
MsRequestResultTail,
ApiEnvironmentConfig,
MsRun,
MsBasisParameters,
MsJmxStep
},
data() {
return {
@ -161,12 +161,14 @@
},
saveAsApi() {
let data = {};
this.api.request.id = uuid();
data.request = JSON.stringify(this.api.request);
data.method = this.api.method;
data.status = this.api.status;
data.userId = this.api.userId;
data.description = this.api.description;
this.$emit('saveAsApi', data);
this.$emit('refresh');
},
updateApi() {
let url = "/api/definition/update";

View File

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

View File

@ -54,29 +54,29 @@
</template>
<script>
import MsApiRequestForm from "../request/http/ApiHttpRequestForm";
import {downloadFile, getUUID, getCurrentProjectID} from "@/common/js/utils";
import MsApiCaseList from "../case/ApiCaseList";
import MsContainer from "../../../../common/components/MsContainer";
import MsBottomContainer from "../BottomContainer";
import MsRequestResultTail from "../response/RequestResultTail";
import MsRun from "../Run";
import MsBasisParameters from "../request/tcp/TcpBasisParameters";
import {REQ_METHOD} from "../../model/JsonData";
import EnvironmentSelect from "../environment/EnvironmentSelect";
import MsJmxStep from "../step/JmxStep";
import MsApiRequestForm from "../request/http/ApiHttpRequestForm";
import {getUUID, uuid} from "@/common/js/utils";
import MsApiCaseList from "../case/ApiCaseList";
import MsContainer from "../../../../common/components/MsContainer";
import MsBottomContainer from "../BottomContainer";
import MsRequestResultTail from "../response/RequestResultTail";
import MsRun from "../Run";
import MsBasisParameters from "../request/tcp/TcpBasisParameters";
import {REQ_METHOD} from "../../model/JsonData";
import EnvironmentSelect from "../environment/EnvironmentSelect";
import MsJmxStep from "../step/JmxStep";
export default {
name: "RunTestTCPPage",
components: {
MsJmxStep,
EnvironmentSelect,
MsApiRequestForm,
MsApiCaseList,
MsContainer,
MsBottomContainer,
MsRequestResultTail,
MsRun,
export default {
name: "RunTestTCPPage",
components: {
MsJmxStep,
EnvironmentSelect,
MsApiRequestForm,
MsApiCaseList,
MsContainer,
MsBottomContainer,
MsRequestResultTail,
MsRun,
MsBasisParameters
},
data() {
@ -173,12 +173,14 @@
},
saveAsApi() {
let data = {};
this.api.request.id = uuid();
data.request = JSON.stringify(this.api.request);
data.method = this.api.method;
data.status = this.api.status;
data.userId = this.api.userId;
data.description = this.api.description;
this.$emit('saveAsApi', data);
this.$emit('refresh');
},
updateApi() {
let url = "/api/definition/update";