fix(接口自动化): 修复导入自定义请求无法另存为新接口问题 #1005657
--bug=1005657 --user=赵勇 【接口测试】场景中导... https://www.tapd.cn/55049933/s/1032531
This commit is contained in:
parent
c1de9186c1
commit
245d5d0a71
|
@ -12,7 +12,7 @@
|
|||
<el-dropdown-item command="openScenario" v-if="data.type==='scenario' && data.referenced==='REF'">
|
||||
{{ this.$t("api_test.automation.open_scene") }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="saveAs" v-if="allSamplers.indexOf(data.type)!=-1 && data.referenced ==='Created' ">
|
||||
<el-dropdown-item command="saveAs" v-if="allSamplers.indexOf(data.type)!=-1 && (data.referenced===undefined || data.referenced ==='Created' )">
|
||||
{{ this.$t("api_test.automation.save_as_api") }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
|
@ -23,62 +23,61 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {getCurrentProjectID, getUUID} from "@/common/js/utils";
|
||||
import {ELEMENTS} from "../Setting";
|
||||
import MsVariableList from "../variable/VariableList";
|
||||
import MsAddBasisApi from "../api/AddBasisApi";
|
||||
import {ELEMENTS} from "../Setting";
|
||||
import MsVariableList from "../variable/VariableList";
|
||||
import MsAddBasisApi from "../api/AddBasisApi";
|
||||
|
||||
export default {
|
||||
name: "StepExtendBtns",
|
||||
components: {ELEMENTS, MsVariableList, MsAddBasisApi},
|
||||
props: {
|
||||
data: Object,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
allSamplers: ELEMENTS.get('AllSamplerProxy'),
|
||||
currentProtocol: "HTTP",
|
||||
export default {
|
||||
name: "StepExtendBtns",
|
||||
components: {ELEMENTS, MsVariableList, MsAddBasisApi},
|
||||
props: {
|
||||
data: Object,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
allSamplers: ELEMENTS.get('AllSamplerProxy'),
|
||||
currentProtocol: "HTTP",
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleCommand(cmd) {
|
||||
switch (cmd) {
|
||||
case "copy":
|
||||
this.$emit('copy');
|
||||
break;
|
||||
case "remove":
|
||||
this.$emit('remove');
|
||||
break;
|
||||
case "scenarioVar":
|
||||
this.$refs.scenarioParameters.open(this.data.variables, this.data.headers, this.data.referenced === 'REF');
|
||||
break;
|
||||
case "openScenario":
|
||||
this.getScenario();
|
||||
break;
|
||||
case "saveAs":
|
||||
this.saveAsApi();
|
||||
break;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleCommand(cmd) {
|
||||
switch (cmd) {
|
||||
case "copy":
|
||||
this.$emit('copy');
|
||||
break;
|
||||
case "remove":
|
||||
this.$emit('remove');
|
||||
break;
|
||||
case "scenarioVar":
|
||||
this.$refs.scenarioParameters.open(this.data.variables, this.data.headers, this.data.referenced === 'REF');
|
||||
break;
|
||||
case "openScenario":
|
||||
this.getScenario();
|
||||
break;
|
||||
case "saveAs":
|
||||
this.saveAsApi();
|
||||
break;
|
||||
getScenario() {
|
||||
this.result = this.$get("/api/automation/getApiScenario/" + this.data.id, response => {
|
||||
if (response.data) {
|
||||
this.$emit('openScenario', response.data);
|
||||
} else {
|
||||
this.$error("引用场景已经被删除");
|
||||
}
|
||||
},
|
||||
getScenario() {
|
||||
this.result = this.$get("/api/automation/getApiScenario/" + this.data.id, response => {
|
||||
if (response.data) {
|
||||
this.$emit('openScenario', response.data);
|
||||
} else {
|
||||
this.$error("引用场景已经被删除");
|
||||
}
|
||||
});
|
||||
},
|
||||
saveAsApi() {
|
||||
this.currentProtocol = this.data.protocol;
|
||||
this.$refs.api.open(this.data);
|
||||
}
|
||||
});
|
||||
},
|
||||
saveAsApi() {
|
||||
this.currentProtocol = this.data.protocol;
|
||||
this.$refs.api.open(this.data);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.scenario-ext-btn {
|
||||
margin-left: 10px;
|
||||
}
|
||||
.scenario-ext-btn {
|
||||
margin-left: 10px;
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue