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: {
|
watch: {
|
||||||
currentProtocol() {
|
currentProtocol() {
|
||||||
if(this.activeDom === 'right'){
|
if (this.activeDom === 'right') {
|
||||||
this.activeDom = 'left';
|
this.activeDom = 'left';
|
||||||
}
|
}
|
||||||
this.handleCommand("CLOSE_ALL");
|
this.handleCommand("CLOSE_ALL");
|
||||||
|
@ -407,7 +407,7 @@ export default {
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted(){
|
mounted() {
|
||||||
this.init();
|
this.init();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -422,8 +422,8 @@ export default {
|
||||||
this.$post('/api/definition/env/create', {userId: getCurrentUserId(), envId: envId}, response => {
|
this.$post('/api/definition/env/create', {userId: getCurrentUserId(), envId: envId}, response => {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getTrashApi(){
|
getTrashApi() {
|
||||||
this.$get("/api/module/trashCount/"+this.projectId +"/"+this.currentProtocol, response => {
|
this.$get("/api/module/trashCount/" + this.projectId + "/" + this.currentProtocol, response => {
|
||||||
this.total = response.data;
|
this.total = response.data;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -594,32 +594,37 @@ export default {
|
||||||
debug(id) {
|
debug(id) {
|
||||||
this.handleTabsEdit(this.$t('api_test.definition.request.fast_debug'), "debug", id);
|
this.handleTabsEdit(this.$t('api_test.definition.request.fast_debug'), "debug", id);
|
||||||
},
|
},
|
||||||
init(){
|
init() {
|
||||||
let routeTestCase = this.$route.params.apiDefinition;
|
let routeTestCase = this.$route.params.apiDefinition;
|
||||||
if(routeTestCase){
|
if (routeTestCase) {
|
||||||
this.editApi(routeTestCase)
|
this.editApi(routeTestCase)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
editApi(row) {
|
editApi(row) {
|
||||||
let name = "";
|
const index = this.apiTabs.find(p => p.api && p.api.id === row.id);
|
||||||
if (row.isCopy) {
|
if (!index) {
|
||||||
name = "copy" + "-" + row.name;
|
let name = "";
|
||||||
row.name = "copy" + "-" + row.name;
|
if (row.isCopy) {
|
||||||
} else {
|
name = "copy" + "-" + row.name;
|
||||||
if (row.name) {
|
row.name = "copy" + "-" + row.name;
|
||||||
name = this.$t('api_test.definition.request.edit_api') + "-" + row.name;
|
|
||||||
} else {
|
} else {
|
||||||
name = this.$t('api_test.definition.request.title');
|
if (row.name) {
|
||||||
|
name = this.$t('api_test.definition.request.edit_api') + "-" + row.name;
|
||||||
|
} else {
|
||||||
|
name = this.$t('api_test.definition.request.title');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
this.activeTab = "api";
|
||||||
this.activeTab = "api";
|
if (row != null && row.tags != 'null' && row.tags != '' && row.tags != undefined) {
|
||||||
if (row != null && row.tags != 'null' && row.tags != '' && row.tags != undefined) {
|
if (Object.prototype.toString.call(row.tags).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object'
|
||||||
if (Object.prototype.toString.call(row.tags).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'object'
|
&& Object.prototype.toString.call(row.tags).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'array') {
|
||||||
&& Object.prototype.toString.call(row.tags).match(/\[object (\w+)\]/)[1].toLowerCase() !== 'array') {
|
row.tags = JSON.parse(row.tags);
|
||||||
row.tags = JSON.parse(row.tags);
|
}
|
||||||
}
|
}
|
||||||
|
this.handleTabsEdit(name, "ADD", row);
|
||||||
|
} else {
|
||||||
|
this.apiDefaultTab = index.name;
|
||||||
}
|
}
|
||||||
this.handleTabsEdit(name, "ADD", row);
|
|
||||||
},
|
},
|
||||||
handleCase(api) {
|
handleCase(api) {
|
||||||
this.currentApi = api;
|
this.currentApi = api;
|
||||||
|
|
|
@ -203,7 +203,7 @@ import MsTableColumn from "@/business/components/common/components/table/MsTable
|
||||||
import MsBottomContainer from "../BottomContainer";
|
import MsBottomContainer from "../BottomContainer";
|
||||||
import MsBatchEdit from "../basis/BatchEdit";
|
import MsBatchEdit from "../basis/BatchEdit";
|
||||||
import {API_METHOD_COLOUR, API_STATUS, DUBBO_METHOD, REQ_METHOD, SQL_METHOD, TCP_METHOD} from "../../model/JsonData";
|
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 {API_LIST} from '@/common/js/constants';
|
||||||
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
|
import MsTableHeaderSelectPopover from "@/business/components/common/components/table/MsTableHeaderSelectPopover";
|
||||||
import ApiStatus from "@/business/components/api/definition/components/list/ApiStatus";
|
import ApiStatus from "@/business/components/api/definition/components/list/ApiStatus";
|
||||||
|
@ -605,11 +605,12 @@ export default {
|
||||||
this.$emit('editApi', row);
|
this.$emit('editApi', row);
|
||||||
},
|
},
|
||||||
handleCopy(row) {
|
handleCopy(row) {
|
||||||
row.isCopy = true;
|
let obj = JSON.parse(JSON.stringify(row));
|
||||||
this.$emit('editApi', JSON.parse(JSON.stringify(row)));
|
obj.isCopy = true;
|
||||||
|
obj.id =getUUID();
|
||||||
|
this.$emit('editApi', obj);
|
||||||
},
|
},
|
||||||
runApi(row) {
|
runApi(row) {
|
||||||
|
|
||||||
let request = row ? JSON.parse(row.request) : {};
|
let request = row ? JSON.parse(row.request) : {};
|
||||||
if (row.tags instanceof Array) {
|
if (row.tags instanceof Array) {
|
||||||
row.tags = JSON.stringify(row.tags);
|
row.tags = JSON.stringify(row.tags);
|
||||||
|
|
Loading…
Reference in New Issue