|
188 | 188 | </span> |
189 | 189 | </el-dialog> |
190 | 190 |
|
| 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 | + |
191 | 212 |
|
192 | 213 | <div style="position: fixed; bottom: 0; right:0; left: 460px; top: 160px"> |
193 | 214 | <el-table |
|
254 | 275 | <span class="block-summary-description text-ellipsis">{{ scope.row.name }}</span> |
255 | 276 | </el-tooltip> |
256 | 277 | <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 }} |
260 | 282 | </span> |
261 | 283 | </div> |
262 | 284 | </template> |
@@ -392,7 +414,10 @@ export default { |
392 | 414 | dialogTreeVisible: false, |
393 | 415 | dialogTreeMoveAPIVisible: false, |
394 | 416 | dialogTableVisible: false, |
| 417 | + dialogRelatedCasesVisible: false, |
| 418 | + dialogTitle: '关联用例', |
395 | 419 | summary: {}, |
| 420 | + relatedCases: [], |
396 | 421 | selectAPI: [], |
397 | 422 | currentRow: '', |
398 | 423 | currentPage: this.listCurrentPage, |
@@ -770,6 +795,12 @@ export default { |
770 | 795 | cellMouseLeave(row) { |
771 | 796 | this.currentRow = ''; |
772 | 797 | }, |
| 798 | +
|
| 799 | + showRelatedCases(cases, apiName) { |
| 800 | + this.relatedCases = cases; |
| 801 | + this.dialogTitle = `${apiName} - 关联用例`; |
| 802 | + this.dialogRelatedCasesVisible = true; |
| 803 | + }, |
773 | 804 | } |
774 | 805 | , |
775 | 806 | mounted() { |
@@ -838,5 +869,14 @@ export default { |
838 | 869 | .block_url { |
839 | 870 | max-width: 250px; /* 根据需要调整 */ |
840 | 871 | } |
| 872 | +
|
| 873 | +.clickable { |
| 874 | + cursor: pointer; |
| 875 | + transition: opacity 0.3s; |
| 876 | +} |
| 877 | +
|
| 878 | +.clickable:hover { |
| 879 | + opacity: 0.8; |
| 880 | +} |
841 | 881 | </style> |
842 | 882 |
|
0 commit comments