Skip to content

Commit dab45e9

Browse files
authored
Merge pull request #243
* feat: add clickable associated test cases display * refactor: simplify associated test cases dialog * fix: use correct field name for test case display * feat: add dynamic dialog title with API name * fix: remove redundant text from associated cases display
1 parent 6ba3943 commit dab45e9

File tree

1 file changed

+43
-3
lines changed

1 file changed

+43
-3
lines changed

web/src/pages/fastrunner/api/components/ApiList.vue

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,27 @@
188188
</span>
189189
</el-dialog>
190190

191+
<el-dialog
192+
:title="dialogTitle"
193+
:visible.sync="dialogRelatedCasesVisible"
194+
width="50%"
195+
>
196+
<div v-if="relatedCases.length > 0">
197+
<el-table :data="relatedCases" style="width: 100%">
198+
<el-table-column label="序号" width="80" type="index" :index="1">
199+
</el-table-column>
200+
<el-table-column prop="case_name" label="用例名称">
201+
</el-table-column>
202+
</el-table>
203+
</div>
204+
<div v-else>
205+
<el-empty description="暂无关联用例"></el-empty>
206+
</div>
207+
<span slot="footer" class="dialog-footer">
208+
<el-button @click="dialogRelatedCasesVisible = false">关 闭</el-button>
209+
</span>
210+
</el-dialog>
211+
191212

192213
<div style="position: fixed; bottom: 0; right:0; left: 460px; top: 160px">
193214
<el-table
@@ -254,9 +275,10 @@
254275
<span class="block-summary-description text-ellipsis">{{ scope.row.name }}</span>
255276
</el-tooltip>
256277
<span v-if="scope.row.cases.length > 0"
257-
class="block-method block_method_color block_method_cases"
258-
:title="`API已被用例引用,共计: ${scope.row.cases.length} 次`">
259-
被引用: {{ scope.row.cases.length }} 次
278+
class="block-method block_method_color block_method_cases clickable"
279+
:title="`API已被用例引用,共计: ${scope.row.cases.length} 次`"
280+
@click="showRelatedCases(scope.row.cases, scope.row.name)">
281+
关联用例: {{ scope.row.cases.length }}
260282
</span>
261283
</div>
262284
</template>
@@ -392,7 +414,10 @@ export default {
392414
dialogTreeVisible: false,
393415
dialogTreeMoveAPIVisible: false,
394416
dialogTableVisible: false,
417+
dialogRelatedCasesVisible: false,
418+
dialogTitle: '关联用例',
395419
summary: {},
420+
relatedCases: [],
396421
selectAPI: [],
397422
currentRow: '',
398423
currentPage: this.listCurrentPage,
@@ -770,6 +795,12 @@ export default {
770795
cellMouseLeave(row) {
771796
this.currentRow = '';
772797
},
798+
799+
showRelatedCases(cases, apiName) {
800+
this.relatedCases = cases;
801+
this.dialogTitle = `${apiName} - 关联用例`;
802+
this.dialogRelatedCasesVisible = true;
803+
},
773804
}
774805
,
775806
mounted() {
@@ -838,5 +869,14 @@ export default {
838869
.block_url {
839870
max-width: 250px; /* 根据需要调整 */
840871
}
872+
873+
.clickable {
874+
cursor: pointer;
875+
transition: opacity 0.3s;
876+
}
877+
878+
.clickable:hover {
879+
opacity: 0.8;
880+
}
841881
</style>
842882

0 commit comments

Comments
 (0)