@@ -1515,14 +1515,17 @@ export default {
this.showAll();
this.buttonData = buttons(this);
this.initPlugins();
- if (e && e.target.className && e.target.className.split(" ")[1] === "white--space") {
+ if (e && e.target.className && e.target.className.split(' ')[1] === 'white--space') {
this.selectedTreeNode = undefined;
this.selectedNode = undefined;
}
},
fabClick() {
if (this.operatingElements && this.operatingElements.length < 1) {
- if ((this.selectedTreeNode && this.selectedTreeNode.referenced === 'REF') || (this.selectedNode.disabled && this.selectedTreeNode.disabled)) {
+ if (
+ (this.selectedTreeNode && this.selectedTreeNode.referenced === 'REF') ||
+ (this.selectedNode.disabled && this.selectedTreeNode.disabled)
+ ) {
this.$warning(this.$t('api_test.scenario.scenario_warning'));
} else {
this.$warning(this.$t('api_test.scenario.scenario_step_warning'));
@@ -2016,6 +2019,7 @@ export default {
}
}
if (this.scenarioDefinition !== null) {
+ this.stepCount = 0;
this.dataProcessing(this.scenarioDefinition);
}
// 保存成功后刷新历史版本
diff --git a/api-test/frontend/src/business/automation/scenario/component/ApiComponent.vue b/api-test/frontend/src/business/automation/scenario/component/ApiComponent.vue
index 462241e24e..1876b0513e 100644
--- a/api-test/frontend/src/business/automation/scenario/component/ApiComponent.vue
+++ b/api-test/frontend/src/business/automation/scenario/component/ApiComponent.vue
@@ -256,60 +256,15 @@ export default {
};
},
created() {
- this.request.protocol = this.request.protocol === 'ESB' ? 'TCP' : this.request.protocol;
- // 历史数据兼容
- if (!this.request.requestResult) {
- this.request.requestResult = [{ responseResult: {} }];
- } else if (
- this.request.requestResult &&
- Object.prototype.toString.call(this.request.requestResult) !== '[object Array]'
- ) {
- let obj = JSON.parse(JSON.stringify(this.request.requestResult));
- this.request.requestResult = [obj];
- }
- // 跨项目关联,如果没有ID,则赋值本项目ID
- if (!this.request.projectId) {
- this.request.projectId = getCurrentProjectID();
- }
- this.request.customizeReq = this.isCustomizeReq;
- if (this.request.customizeReq) {
- if (this.node.parent && this.node.parent.data && this.node.parent.data.length > 1) {
- this.request.projectId = getCurrentProjectID();
- } else {
- this.request.projectId =
- this.node.parent.data instanceof Array ? this.node.parent.data[0].projectId : this.node.parent.data.projectId;
- }
- }
- if (this.currentScenario) {
- this.request.currentScenarioId = this.currentScenario.id;
- }
- // 传递场景ID
- if (this.request.hashTree) {
- this.setOwnEnvironment(this.request.hashTree);
- }
- if (this.request.id && this.request.referenced === 'REF') {
- this.request.disabled = true;
- this.request.root = this.node.parent.parent ? false : true;
- this.request.showExtend =
- this.node.parent && this.node.parent.data && this.node.parent.data.disabled ? false : true;
- }
- this.isShowNum = this.request.num ? true : false;
- if (this.request.protocol === 'HTTP') {
- // 历史数据 auth 处理
- if (this.request.hashTree) {
- for (let index in this.request.hashTree) {
- if (this.request.hashTree[index].type == 'AuthManager') {
- this.request.authManager = this.request.hashTree[index];
- this.request.hashTree.splice(index, 1);
- }
- }
- }
- }
- if (this.request.requestResult && this.request.requestResult.length > 0) {
- this.response = this.request.requestResult[0];
- }
+ this.init();
},
watch: {
+ request: {
+ handler() {
+ this.init();
+ },
+ deep: true,
+ },
message() {
this.forStatus();
this.reload();
@@ -374,6 +329,62 @@ export default {
},
},
methods: {
+ init() {
+ this.request.protocol = this.request.protocol === 'ESB' ? 'TCP' : this.request.protocol;
+ // 历史数据兼容
+ if (!this.request.requestResult) {
+ this.request.requestResult = [{ responseResult: {} }];
+ } else if (
+ this.request.requestResult &&
+ Object.prototype.toString.call(this.request.requestResult) !== '[object Array]'
+ ) {
+ let obj = JSON.parse(JSON.stringify(this.request.requestResult));
+ this.request.requestResult = [obj];
+ }
+ // 跨项目关联,如果没有ID,则赋值本项目ID
+ if (!this.request.projectId) {
+ this.request.projectId = getCurrentProjectID();
+ }
+ this.request.customizeReq = this.isCustomizeReq;
+ if (this.request.customizeReq) {
+ if (this.node.parent && this.node.parent.data && this.node.parent.data.length > 1) {
+ this.request.projectId = getCurrentProjectID();
+ } else {
+ this.request.projectId =
+ this.node.parent.data instanceof Array
+ ? this.node.parent.data[0].projectId
+ : this.node.parent.data.projectId;
+ }
+ }
+ if (this.currentScenario) {
+ this.request.currentScenarioId = this.currentScenario.id;
+ }
+ // 传递场景ID
+ if (this.request.hashTree) {
+ this.setOwnEnvironment(this.request.hashTree);
+ }
+ if (this.request.id && this.request.referenced === 'REF') {
+ this.request.disabled = true;
+ this.request.root = this.node.parent.parent ? false : true;
+ this.request.showExtend =
+ this.node.parent && this.node.parent.data && this.node.parent.data.disabled ? false : true;
+ }
+ this.isShowNum = this.request.num ? true : false;
+ if (this.request.protocol === 'HTTP') {
+ // 历史数据 auth 处理
+ if (this.request.hashTree) {
+ for (let index in this.request.hashTree) {
+ if (this.request.hashTree[index].type == 'AuthManager') {
+ this.request.authManager = this.request.hashTree[index];
+ this.request.hashTree.splice(index, 1);
+ }
+ }
+ }
+ }
+ if (this.request.requestResult && this.request.requestResult.length > 0) {
+ this.response = this.request.requestResult[0];
+ }
+ },
setOwnEnvironment(scenarioDefinition) {
for (let i in scenarioDefinition) {
let typeArray = ['JDBCPostProcessor', 'JDBCSampler', 'JDBCPreProcessor'];