fix(场景自动化): 修复引用场景查看问题

This commit is contained in:
fit2-zhao 2021-01-26 15:49:04 +08:00
parent 614acd2ed3
commit 96f6d854ce
4 changed files with 13 additions and 8 deletions

View File

@ -148,7 +148,7 @@
<!-- 步骤组件--> <!-- 步骤组件-->
<ms-component-config :type="data.type" :scenario="data" :response="response" :currentScenario="currentScenario" <ms-component-config :type="data.type" :scenario="data" :response="response" :currentScenario="currentScenario"
:currentEnvironmentId="currentEnvironmentId" :node="node" :currentEnvironmentId="currentEnvironmentId" :node="node"
@remove="remove" @copyRow="copyRow" @suggestClick="suggestClick"/> @remove="remove" @copyRow="copyRow" @suggestClick="suggestClick" @refReload="reload"/>
</span> </span>
</el-tree> </el-tree>
</div> </div>
@ -423,7 +423,6 @@
document.removeEventListener("keydown", this.createCtrlSHandle); document.removeEventListener("keydown", this.createCtrlSHandle);
}, },
createCtrlSHandle(event) { createCtrlSHandle(event) {
console.log("create ctrl + s");
handleCtrlSEvent(event, this.editScenario); handleCtrlSEvent(event, this.editScenario);
}, },
getIdx(index) { getIdx(index) {
@ -884,7 +883,6 @@
} }
this.enableCookieShare = obj.enableCookieShare; this.enableCookieShare = obj.enableCookieShare;
this.scenarioDefinition = obj.hashTree; this.scenarioDefinition = obj.hashTree;
console.log(this.scenarioDefinition)
} }
} }
if (this.currentScenario.copy) { if (this.currentScenario.copy) {

View File

@ -12,7 +12,7 @@
<span @click.stop> <span @click.stop>
<slot name="headerLeft"> <slot name="headerLeft">
<i class="icon el-icon-arrow-right" :class="{'is-active': data.active}" <i class="icon el-icon-arrow-right" :class="{'is-active': data.active}"
@click="active(data)"/> @click="active(data)" v-if="data.type!='scenario'"/>
<el-input :draggable="draggable" v-if="isShowInput && isShowNameInput" size="small" v-model="data.name" class="name-input" <el-input :draggable="draggable" v-if="isShowInput && isShowNameInput" size="small" v-model="data.name" class="name-input"
@blur="isShowInput = false" :placeholder="$t('commons.input_name')" ref="nameEdit"/> @blur="isShowInput = false" :placeholder="$t('commons.input_name')" ref="nameEdit"/>
<span v-else> <span v-else>

View File

@ -38,11 +38,15 @@
}, },
watch: {}, watch: {},
created() { created() {
if (this.scenario.id && this.scenario.referenced === 'REF') { if (this.scenario.id && this.scenario.referenced === 'REF' && !this.scenario.loaded) {
this.result = this.$get("/api/automation/getApiScenario/" + this.scenario.id, response => { this.result = this.$get("/api/automation/getApiScenario/" + this.scenario.id, response => {
if (response.data) { if (response.data) {
this.scenario.loaded = true;
if (response.data.scenarioDefinition) {
this.scenario.hashTree = JSON.parse(response.data.scenarioDefinition).hashTree;
}
this.scenario.name = response.data.name; this.scenario.name = response.data.name;
this.reload(); this.$emit('refReload');
} else { } else {
this.scenario.referenced = "Deleted"; this.scenario.referenced = "Deleted";
} }
@ -58,7 +62,7 @@
}, },
computed: { computed: {
isDeletedOrRef() { isDeletedOrRef() {
if (this.scenario.referenced!= undefined && this.scenario.referenced === 'Deleted' || this.scenario.referenced === 'REF') { if (this.scenario.referenced != undefined && this.scenario.referenced === 'Deleted' || this.scenario.referenced === 'REF') {
return true return true
} }
return false; return false;

View File

@ -2,7 +2,7 @@
<div class="request-form"> <div class="request-form">
<component :is="component" :scenario="scenario" :controller="scenario" :timer="scenario" :assertions="scenario" :extract="scenario" :jsr223-processor="scenario" :request="scenario" :currentScenario="currentScenario" :currentEnvironmentId="currentEnvironmentId" :node="node" <component :is="component" :scenario="scenario" :controller="scenario" :timer="scenario" :assertions="scenario" :extract="scenario" :jsr223-processor="scenario" :request="scenario" :currentScenario="currentScenario" :currentEnvironmentId="currentEnvironmentId" :node="node"
:draggable="true" :title="title" :color="titleColor" :background-color="backgroundColor" @suggestClick="suggestClick(node)" :response="response" :draggable="true" :title="title" :color="titleColor" :background-color="backgroundColor" @suggestClick="suggestClick(node)" :response="response"
@remove="remove" @copyRow="copyRow"/> @remove="remove" @copyRow="copyRow" @refReload="refReload"/>
</div> </div>
</template> </template>
@ -107,6 +107,9 @@
suggestClick(node) { suggestClick(node) {
this.$emit('suggestClick', node); this.$emit('suggestClick', node);
}, },
refReload(){
this.$emit('refReload');
}
} }
} }
</script> </script>