train-compare.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <!-- -->
  2. <template>
  3. <div class=''>
  4. <el-breadcrumb class="divi2" separator-class="el-icon-arrow-right">
  5. <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
  6. <el-breadcrumb-item :to="{ path: '/alg-train'}">算法训练</el-breadcrumb-item>
  7. <el-breadcrumb-item>训练任务对比</el-breadcrumb-item>
  8. </el-breadcrumb>
  9. <el-divider class="divi">
  10. </el-divider>
  11. <iframe class="iframe" v-bind:src="url" scrolling="no" frameborder="0">
  12. </iframe>
  13. <!-- <el-tabs v-model="activeName" @tab-click="handleClick">
  14. <el-tab-pane label="算法监控" name="first">
  15. </el-tab-pane>
  16. </el-tabs> -->
  17. </div>
  18. </template>
  19. <script>
  20. export default {
  21. name:'Simple',
  22. components:{
  23. },
  24. data() {
  25. return {
  26. activeName: "first",
  27. port:null,
  28. output:"",
  29. url:"",
  30. containerId:""
  31. };
  32. },
  33. activated() {
  34. let port=this.$route.query.port;
  35. let containerId=this.$route.query.containerId;
  36. this.init(port,containerId);
  37. },
  38. methods: {
  39. init(port,containerId){
  40. this.activeName="first";
  41. this.port=port;
  42. this.containerId=containerId;
  43. this.$http({
  44. url:this.$http.adornUrl('/algstrain/getHost'),
  45. method:'get',
  46. params:this.$http.adornParams({
  47. }),
  48. }).then(({data})=>{
  49. this.url="http://"+data.host+":"+port;
  50. });
  51. },
  52. redirectHandle() {
  53. this.$router.replace({ path: "/alg-algs" });
  54. },
  55. handleClick(tab, event) {
  56. console.log(tab, event);
  57. if(tab.name == 'second'){
  58. console.log("切换到算法监控")
  59. this.$http({
  60. url: this.$http.adornUrl("/algstrain/info/" + this.algorithmTrainingId),
  61. method: "get",
  62. params: this.$http.adornParams(),
  63. }).then(({ data }) => {
  64. if (data && data.code === 0) {
  65. this.url=data.algTrain.ipAddress;
  66. }
  67. });
  68. }
  69. },
  70. },
  71. mounted(){
  72. },
  73. //切换路由时,删除容器
  74. beforeRouteLeave(to, from, next){
  75. next();
  76. this.$http({
  77. url:this.$http.adornUrl('/algstrain/deleteContainer'),
  78. method:'get',
  79. params:this.$http.adornParams({
  80. containerId:this.containerId,
  81. port:this.port
  82. }),
  83. }).then(({data})=>{
  84. });
  85. },
  86. };
  87. </script>
  88. <style scoped>
  89. .divi {
  90. display: block;
  91. height: 1px;
  92. width: 100%;
  93. margin: 24px 0;
  94. background-color: #dcdfe6;
  95. position: relative;
  96. }
  97. .divi2 {
  98. display: block;
  99. height: 1px;
  100. width: 100%;
  101. position: relative;
  102. }
  103. .sele {
  104. border: 1px solid #409eff;
  105. border-radius: 5px;
  106. box-sizing: border-box;
  107. padding: 5px 0px;
  108. margin: 10px;
  109. }
  110. .iframe{
  111. width: 64%;
  112. height: 700px;
  113. margin-left: 18%;
  114. }
  115. </style>