fix(接口自动化): 只赋值ID和num

--user=郭雨琦 api和case复制只赋值ID和num
This commit is contained in:
guoyuqi 2021-11-25 10:12:58 +08:00 committed by 刘瑞斌
parent 9bde158b7e
commit 8f9cd3dfe9
1 changed files with 1 additions and 60 deletions

View File

@ -453,85 +453,26 @@ export default {
})
}
if(this.request.id && this.request.referenced === 'Copy'){
let requestResult = this.request.requestResult;
let enable = this.request.enable;
if(this.request.refType==='CASE'){
this.$get("/api/testcase/get/" + this.request.id, response => {
if (response.data) {
let hashTree = [];
if (this.request.hashTree) {
hashTree = JSON.parse(JSON.stringify(this.request.hashTree));
}
Object.assign(this.request, JSON.parse(response.data.request));
this.request.name = response.data.name;
this.request.referenced = "Copy";
this.request.enable = enable;
if (response.data.path && response.data.path != null) {
this.request.path = response.data.path;
this.request.url = response.data.url;
}
if (response.data.method && response.data.method != null) {
this.request.method = response.data.method;
}
if (requestResult && Object.prototype.toString.call(requestResult) !== '[object Array]') {
this.request.requestResult = [requestResult];
} else {
this.request.requestResult = requestResult;
}
if(response.data.num){
this.request.num = response.data.num;
this.isShowNum = true;
}
this.request.id = response.data.id;
this.request.root = true;
this.request.projectId = response.data.projectId;
let req = JSON.parse(response.data.request);
if (req && this.request) {
this.request.hashTree = hashTree;
this.mergeHashTree(req.hashTree);
}
this.reload();
this.sort();
}
})
}
if(this.request.refType==='API'){
this.$get("/api/definition/get/" + this.request.id, response => {
if (response.data) {
let hashTree = [];
if (this.request.hashTree) {
hashTree = JSON.parse(JSON.stringify(this.request.hashTree));
}
Object.assign(this.request, JSON.parse(response.data.request));
this.request.name = response.data.name;
this.request.referenced = "Copy";
this.request.enable = enable;
if (response.data.path && response.data.path != null) {
this.request.path = response.data.path;
this.request.url = response.data.url;
}
if (response.data.method && response.data.method != null) {
this.request.method = response.data.method;
}
if (requestResult && Object.prototype.toString.call(requestResult) !== '[object Array]') {
this.request.requestResult = [requestResult];
} else {
this.request.requestResult = requestResult;
}
if(response.data.num){
this.request.num = response.data.num;
this.isShowNum = true;
}
this.request.id = response.data.id;
this.request.root = true;
this.request.projectId = response.data.projectId;
let req = JSON.parse(response.data.request);
if (req && this.request) {
this.request.hashTree = hashTree;
this.mergeHashTree(req.hashTree);
}
this.reload();
this.sort();
}
})
}