<template>
  <i-frame :src="url"/>
</template>

<script>
import { getToken } from '@/utils/auth'
import { getBiViewUrl } from '@/api/tool/jimu'
import iFrame from '@/components/iFrame/index.vue'

export default {
  name: "ReportView",
  components: {
    iFrame
  },
  data() {
    return {
      url: ''
    }
  },
  created() {
    this.init()
  },
  methods: {
    init() {
      getBiViewUrl().then(res => {
        // 使用 this.$route 替代 proxy.$route
        const reportId = this.$route.path.substring(
          this.$route.path.lastIndexOf("/") + 1
        )
        this.url = res + "/" + reportId + "?token=Bearer " + getToken()
      })
    }
  }
}
</script>
