parent
64451f7f89
commit
721815e8d6
|
@ -556,7 +556,6 @@ export default {
|
||||||
let data = JSON.parse(res.data);
|
let data = JSON.parse(res.data);
|
||||||
if (data.hashTree) {
|
if (data.hashTree) {
|
||||||
this.sort(data.hashTree);
|
this.sort(data.hashTree);
|
||||||
this.addNum(data.hashTree);
|
|
||||||
this.scenarioDefinition = data.hashTree;
|
this.scenarioDefinition = data.hashTree;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1401,7 +1400,6 @@ export default {
|
||||||
this.onSampleError = obj.onSampleError;
|
this.onSampleError = obj.onSampleError;
|
||||||
}
|
}
|
||||||
this.dataProcessing(obj.hashTree);
|
this.dataProcessing(obj.hashTree);
|
||||||
this.addNum(obj.hashTree);
|
|
||||||
this.scenarioDefinition = obj.hashTree;
|
this.scenarioDefinition = obj.hashTree;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1671,69 +1669,6 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
addNum(hashTree) {
|
|
||||||
let funcs = [];
|
|
||||||
for (let i = 0; i < hashTree.length; i++) {
|
|
||||||
let data = hashTree[i];
|
|
||||||
if (!data.num) {
|
|
||||||
if (data.refType) {
|
|
||||||
if (data.refType === 'API') {
|
|
||||||
funcs.push(this.getApiDefinitionNumById(data.id));
|
|
||||||
} else if (data.refType === 'CASE') {
|
|
||||||
funcs.push(this.getApiTestCaseNumById(data.id));
|
|
||||||
}
|
|
||||||
} else if (data.type === 'scenario') {
|
|
||||||
funcs.push(this.getScenarioNumById(data.id));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Promise.all(funcs).then(([result1, result2, result3]) => {
|
|
||||||
for (let i = 0; i < hashTree.length; i++) {
|
|
||||||
let data = hashTree[i];
|
|
||||||
if (!data.num) {
|
|
||||||
if (data.refType) {
|
|
||||||
if (data.refType === 'API') {
|
|
||||||
this.$set(data, 'num', result1);
|
|
||||||
} else if (data.refType === 'CASE') {
|
|
||||||
this.$set(data, 'num', result2);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.$set(data, 'num', result3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
getApiDefinitionNumById(id) {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
let url = '/api/definition/get/' + id;
|
|
||||||
this.$get(url, response => {
|
|
||||||
if (response.data && response.data.num) {
|
|
||||||
resolve(response.data.num);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
getApiTestCaseNumById(id) {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
let url = '/api/testcase/get/' + id;
|
|
||||||
this.$get(url, response => {
|
|
||||||
if (response.data && response.data.num) {
|
|
||||||
resolve(response.data.num);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
getScenarioNumById(id) {
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
let url = '/api/automation/getApiScenario/' + id;
|
|
||||||
this.$get(url, response => {
|
|
||||||
if (response.data && response.data.num) {
|
|
||||||
resolve(response.data.num);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-slot:afterTitle v-if="request.refType==='API'|| request.refType==='CASE'">
|
<template v-slot:afterTitle v-if="request.refType==='API'|| request.refType==='CASE'">
|
||||||
<span v-if="request.num" @click = "clickResource(request)">{{"( ID: "+request.num+")"}}</span>
|
<span v-if="isShowNum" @click = "clickResource(request)">{{"( ID: "+request.num+")"}}</span>
|
||||||
<span v-else >
|
<span v-else >
|
||||||
<el-tooltip class="ms-num" effect="dark" :content="request.refType==='API'?$t('api_test.automation.scenario.api_none'):$t('api_test.automation.scenario.case_none')" placement="top">
|
<el-tooltip class="ms-num" effect="dark" :content="request.refType==='API'?$t('api_test.automation.scenario.api_none'):$t('api_test.automation.scenario.case_none')" placement="top">
|
||||||
<i class="el-icon-warning"/>
|
<i class="el-icon-warning"/>
|
||||||
|
@ -202,7 +202,8 @@ export default {
|
||||||
apiActive: false,
|
apiActive: false,
|
||||||
reqSuccess: true,
|
reqSuccess: true,
|
||||||
envType: this.environmentType,
|
envType: this.environmentType,
|
||||||
environmentMap: this.envMap
|
environmentMap: this.envMap,
|
||||||
|
isShowNum:false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -408,11 +409,17 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getApiInfo() {
|
getApiInfo() {
|
||||||
|
console.log("看看num")
|
||||||
|
console.log(this.request.id);
|
||||||
|
console.log(this.request.referenced);
|
||||||
if (this.request.id && this.request.referenced === 'REF') {
|
if (this.request.id && this.request.referenced === 'REF') {
|
||||||
|
console.log(this.request.id);
|
||||||
|
console.log(this.request.referenced);
|
||||||
let requestResult = this.request.requestResult;
|
let requestResult = this.request.requestResult;
|
||||||
let enable = this.request.enable;
|
let enable = this.request.enable;
|
||||||
this.$get("/api/testcase/get/" + this.request.id, response => {
|
this.$get("/api/testcase/get/" + this.request.id, response => {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
|
console.log(response.data)
|
||||||
let hashTree = [];
|
let hashTree = [];
|
||||||
if (this.request.hashTree) {
|
if (this.request.hashTree) {
|
||||||
hashTree = JSON.parse(JSON.stringify(this.request.hashTree));
|
hashTree = JSON.parse(JSON.stringify(this.request.hashTree));
|
||||||
|
@ -433,6 +440,10 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
this.request.requestResult = requestResult;
|
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.id = response.data.id;
|
||||||
this.request.disabled = true;
|
this.request.disabled = true;
|
||||||
this.request.root = true;
|
this.request.root = true;
|
||||||
|
@ -614,6 +625,10 @@ export default {
|
||||||
response.data.sourceId = resource.resourceId;
|
response.data.sourceId = resource.resourceId;
|
||||||
response.data.type = resource.type;
|
response.data.type = resource.type;
|
||||||
response.data.refType = resource.refType;
|
response.data.refType = resource.refType;
|
||||||
|
if(response.data.num){
|
||||||
|
this.request.num = response.data.num;
|
||||||
|
this.isShowNum = true;
|
||||||
|
}
|
||||||
this.clickCase(response.data)
|
this.clickCase(response.data)
|
||||||
} else {
|
} else {
|
||||||
this.$error("接口用例场景场景已经被删除");
|
this.$error("接口用例场景场景已经被删除");
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
title='场景'>
|
title='场景'>
|
||||||
|
|
||||||
<template v-slot:afterTitle>
|
<template v-slot:afterTitle>
|
||||||
<span v-if="scenario.num" @click = "clickResource(scenario)">{{"( ID: "+scenario.num+")"}}</span>
|
<span v-if="isShowNum" @click = "clickResource(scenario)">{{"( ID: "+scenario.num+")"}}</span>
|
||||||
<span v-else >
|
<span v-else >
|
||||||
<el-tooltip class="ms-num" effect="dark" :content="$t('api_test.automation.scenario.num_none')" placement="top">
|
<el-tooltip class="ms-num" effect="dark" :content="$t('api_test.automation.scenario.num_none')" placement="top">
|
||||||
<i class="el-icon-warning"/>
|
<i class="el-icon-warning"/>
|
||||||
|
@ -119,7 +119,10 @@ export default {
|
||||||
if (this.scenario.hashTree) {
|
if (this.scenario.hashTree) {
|
||||||
this.setDisabled(this.scenario.hashTree, this.scenario.projectId);
|
this.setDisabled(this.scenario.hashTree, this.scenario.projectId);
|
||||||
}
|
}
|
||||||
//this.scenario.disabled = true;
|
if(response.data.num){
|
||||||
|
this.scenario.num = response.data.num;
|
||||||
|
this.isShowNum = true;
|
||||||
|
}
|
||||||
this.scenario.name = response.data.name;
|
this.scenario.name = response.data.name;
|
||||||
this.scenario.headers = obj.headers;
|
this.scenario.headers = obj.headers;
|
||||||
this.scenario.variables = obj.variables;
|
this.scenario.variables = obj.variables;
|
||||||
|
@ -136,6 +139,7 @@ export default {
|
||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
isShowInput: false,
|
isShowInput: false,
|
||||||
|
isShowNum:false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
Loading…
Reference in New Issue