fix(接口测试): 修复接口复制问题
--bug=1007334 --user=赵勇 【github#6815 】 复制的接口在未保存的情况下编辑原接口,跳转的是另一个复制接口 https://www.tapd.cn/55049933/s/1060079
This commit is contained in:
parent
681ea5a33e
commit
bb8c95a962
|
@ -371,7 +371,7 @@ export default {
|
|||
},
|
||||
watch: {
|
||||
currentProtocol() {
|
||||
if(this.activeDom === 'right'){
|
||||
if (this.activeDom === 'right') {
|
||||
this.activeDom = 'left';
|
||||
}
|
||||
this.handleCommand("CLOSE_ALL");
|
||||
|
@ -407,7 +407,7 @@ export default {
|
|||
// });
|
||||
}
|
||||
},
|
||||
mounted(){
|
||||
mounted() {
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
|
@ -422,8 +422,8 @@ export default {
|
|||
this.$post('/api/definition/env/create', {userId: getCurrentUserId(), envId: envId}, response => {
|
||||
});
|
||||
},
|
||||
getTrashApi(){
|
||||
this.$get("/api/module/trashCount/"+this.projectId +"/"+this.currentProtocol, response => {
|
||||
getTrashApi() {
|
||||
this.$get("/api/module/trashCount/" + this.projectId + "/" + this.currentProtocol, response => {
|
||||
this.total = response.data;
|
||||
});
|
||||
},
|
||||
|
@ -594,13 +594,15 @@ export default {
|
|||
debug(id) {
|
||||
this.handleTabsEdit(this.$t('api_test.definition.request.fast_debug'), "debug", id);
|
||||
},
|
||||
init(){
|
||||
init() {
|
||||
let routeTestCase = this.$route.params.apiDefinition;
|
||||
if(routeTestCase){
|
||||
if (routeTestCase) {
|
||||
this.editApi(routeTestCase)
|
||||
}
|
||||
},
|
||||
editApi(row) {
|
||||
const index = this.apiTabs.find(p => p.api && p.api.id === row.id);
|
||||
if (!index) {
|
||||
let name = "";
|
||||
if (row.isCopy) {
|
||||
name = "copy" + "-" + row.name;
|
||||
|
@ -620,6 +622,9 @@ export default {
|
|||
}
|
||||
}
|
||||
this.handleTabsEdit(name, "ADD", row);
|
||||
} else {
|
||||
this.apiDefaultTab = index.name;
|
||||
}
|
||||
},
|
||||
handleCase(api) {
|
||||
this.currentApi = api;
|
||||
|
|
|
@ -203,7 +203,7 @@ import MsTableColumn from "@/business/components/common/components/table/MsTable
|
|||
import MsBottomContainer from "../BottomContainer";
|
||||
import MsBatchEdit from "../basis/BatchEdit";
|
||||
import {API_METHOD_COLOUR, API_STATUS, DUBBO_METHOD, REQ_METHOD, SQL_METHOD, TCP_METHOD} from "../../model/JsonData";
|
||||
import {downloadFile, getCurrentProjectID} from "@/common/js/utils";
|
||||
import {downloadFile, getCurrentProjectID, getUUID} from "@/common/js/utils";
|
||||
import {API_LIST} from '@/common/js/constants';
|
||||
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
|
||||
import ApiStatus from "@/business/components/api/definition/components/list/ApiStatus";
|
||||
|
@ -605,11 +605,12 @@ export default {
|
|||
this.$emit('editApi', row);
|
||||
},
|
||||
handleCopy(row) {
|
||||
row.isCopy = true;
|
||||
this.$emit('editApi', JSON.parse(JSON.stringify(row)));
|
||||
let obj = JSON.parse(JSON.stringify(row));
|
||||
obj.isCopy = true;
|
||||
obj.id =getUUID();
|
||||
this.$emit('editApi', obj);
|
||||
},
|
||||
runApi(row) {
|
||||
|
||||
let request = row ? JSON.parse(row.request) : {};
|
||||
if (row.tags instanceof Array) {
|
||||
row.tags = JSON.stringify(row.tags);
|
||||
|
|
Loading…
Reference in New Issue