fix(接口自动化): 场景步骤按钮控制

This commit is contained in:
fit2-zhao 2021-03-23 17:30:23 +08:00
parent c4ae15256b
commit eeedae7a4a
3 changed files with 23 additions and 8 deletions

View File

@ -164,7 +164,7 @@
</div>
<!--接口列表-->
<scenario-api-relevance @save="pushApiOrCase" ref="scenarioApiRelevance" v-if="type!=='detail'"/>
<scenario-api-relevance @save="pushApiOrCase" @close="setHideBtn" ref="scenarioApiRelevance" v-if="type!=='detail'"/>
<!--自定义接口-->
<el-drawer v-if="type!=='detail'" :visible.sync="customizeVisible" :destroy-on-close="true" direction="ltr"
@ -173,7 +173,7 @@
<ms-api-customize :request="customizeRequest" @addCustomizeApi="addCustomizeApi"/>
</el-drawer>
<!--场景导入 -->
<scenario-relevance v-if="type!=='detail'" @save="addScenario" ref="scenarioRelevance"/>
<scenario-relevance v-if="type!=='detail'" @save="addScenario" @close="setHideBtn" ref="scenarioRelevance"/>
<!-- 环境 -->
<api-environment-config v-if="type!=='detail'" ref="environmentConfig" @close="environmentConfigClose"/>
@ -288,7 +288,7 @@
loading: false,
apiListVisible: false,
customizeVisible: false,
scenarioVisible: false,
isBtnHide: false,
debugVisible: false,
customizeRequest: {protocol: "HTTP", type: "API", hashTree: [], referenced: 'Created', active: false},
operatingElements: [],
@ -441,6 +441,9 @@
}
},
methods: {
setHideBtn() {
this.isBtnHide = false;
},
//
openScenario(data) {
this.$emit('openScenario', data);
@ -532,6 +535,7 @@
this.scenarioDefinition.push(new LoopController());
break;
case ELEMENT_TYPE.scenario:
this.isBtnHide = true;
this.$refs.scenarioRelevance.open();
break;
default:
@ -559,12 +563,14 @@
}
},
showAll() {
if (!this.customizeVisible) {
//
if (!this.customizeVisible && !this.isBtnHide) {
this.operatingElements = ELEMENTS.get("ALL");
this.selectedTreeNode = undefined;
}
},
apiListImport() {
this.isBtnHide = true;
this.$refs.scenarioApiRelevance.open();
},
recursiveSorting(arr) {
@ -631,13 +637,17 @@
item.hashTree = [];
}
item.enable === undefined ? item.enable = true : item.enable;
this.scenarioDefinition.push(item);
if (this.selectedTreeNode != undefined) {
this.selectedTreeNode.hashTree.push(item);
} else {
this.scenarioDefinition.push(item);
}
})
}
this.isBtnHide = false;
this.sort();
this.reload();
this.initProjectIds();
this.scenarioVisible = false;
},
setApiParameter(item, refType, referenced) {
let request = {};
@ -676,6 +686,7 @@
data.forEach(item => {
this.setApiParameter(item, refType, referenced);
});
this.isBtnHide = false;
this.sort();
this.reload();
this.initProjectIds();

View File

@ -128,6 +128,7 @@ export default {
}
},
close() {
this.$emit('close');
this.refresh();
this.$refs.relevanceDialog.close();
},

View File

@ -90,8 +90,10 @@
response.data.forEach(item => {
let scenarioDefinition = JSON.parse(item.scenarioDefinition);
if (scenarioDefinition && scenarioDefinition.hashTree) {
let obj = {id: item.id, name: item.name, type: "scenario", headers: scenarioDefinition.headers, variables: scenarioDefinition.variables, environmentMap: scenarioDefinition.environmentMap,
referenced: 'Copy', resourceId: getUUID(), hashTree: scenarioDefinition.hashTree, projectId: item.projectId};
let obj = {
id: item.id, name: item.name, type: "scenario", headers: scenarioDefinition.headers, variables: scenarioDefinition.variables, environmentMap: scenarioDefinition.environmentMap,
referenced: 'Copy', resourceId: getUUID(), hashTree: scenarioDefinition.hashTree, projectId: item.projectId
};
scenarios.push(obj);
}
});
@ -101,6 +103,7 @@
})
},
close() {
this.$emit('close');
this.refresh();
this.$refs.relevanceDialog.close();
},