fix (接口自动化): 修复查看引用问题

--bug=1007453 --user=赵勇 【接口测试】场景查看引用,场景引用显示了两次 https://www.tapd.cn/55049933/s/1058821
This commit is contained in:
fit2-zhao 2021-10-25 18:44:58 +08:00 committed by fit2-zhao
parent 1f5de735fd
commit 6b1d5c38da
1 changed files with 47 additions and 43 deletions

View File

@ -1,10 +1,14 @@
<template> <template>
<el-dialog :close-on-click-modal="false" :title="$t('api_test.automation.scenario_ref')" :visible.sync="visible" <el-dialog :close-on-click-modal="false" :title="$t('api_test.automation.scenario_ref')" :visible.sync="visible"
width="45%" :destroy-on-close="true" > width="45%" :destroy-on-close="true">
<span>{{ $t('api_test.automation.scenario_ref') }}</span> <span>{{ $t('api_test.automation.scenario_ref') }}</span>
<div class="refs" v-loading="scenarioLoading"> <div class="refs" v-loading="scenarioLoading">
<div v-for="(item, index) in scenarioRefs" :key="index" class="el-button--text"> <div v-for="(item, index) in scenarioRefs" :key="index" class="el-button--text">
<el-link @click="openScenario(item)"> <el-link @click="openScenario(item)" v-if="item.status === 'Trash'">
{{ item.name }}
<el-tag size="mini">{{ $t('commons.trash') }}</el-tag>
</el-link>
<el-link @click="openScenario(item)" v-else>
{{ item.name }} {{ item.name }}
</el-link> </el-link>
</div> </div>
@ -31,52 +35,52 @@
<script> <script>
export default { export default {
name: "MsReferenceView", name: "MsReferenceView",
components: {}, components: {},
data() { data() {
return { return {
visible: false, visible: false,
scenarioLoading: false, scenarioLoading: false,
scenarioRefs: [], scenarioRefs: [],
planRefs: [] planRefs: []
} }
},
methods: {
getReferenceData(row) {
this.scenarioLoading = true;
this.scenarioRefs = [];
this.$post("/api/automation/getReference/", row, response => {
this.scenarioRefs = response.data.scenarioList;
this.planRefs = response.data.testPlanList;
this.scenarioLoading = false;
})
}, },
methods: { open(row) {
getReferenceData(row) { this.getReferenceData(row);
this.scenarioLoading = true; this.visible = true
this.scenarioRefs = []; },
this.$post("/api/automation/getReference/", row, response => { openScenario(item) {
this.scenarioRefs = response.data.scenarioList; this.$emit('openScenario', item);
this.planRefs = response.data.testPlanList; this.visible = false;
this.scenarioLoading = false;
})
},
open(row) {
this.getReferenceData(row);
this.visible = true
},
openScenario(item) {
this.$emit('openScenario', item);
this.visible = false;
}
} }
} }
}
</script> </script>
<style scoped> <style scoped>
.refs { .refs {
min-height: 50px; min-height: 50px;
max-height: 200px; max-height: 200px;
overflow-y: auto; overflow-y: auto;
font-size: 12px; font-size: 12px;
padding-bottom: 10px; padding-bottom: 10px;
} }
.el-button--text .el-link.el-link--default { .el-button--text .el-link.el-link--default {
font-size: 12px; font-size: 12px;
color: #4b1980; color: #4b1980;
font-weight: 400; font-weight: 400;
text-decoration: underline; text-decoration: underline;
} }
</style> </style>