liuguocan
2023-03-14 ef61883a5437d03c5e384ba0b35c3e0885a882ab
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<template>
  <div class="report-box">
    <iframe id="iframe-box" @load="loadFrame" ref="iframe" :src="url" scrolling="auto" :style="{height:'100%',width:'100%',border:'none'}" />
  </div>
</template>
 
<script>
  import { getToken } from '@/utils/auth';
  export default {
    name: "",
    data() {
      return {
        url: '',
        height: 500
      }
    },
    created() {
      // const orgLv = this.$store.getters.info.orgLv
      // const orgCode = this.$store.getters.info.orgNo
      // this.url = globalConf.reportUrl + `/decision/view/report?viewlet=score_summary_branch.cpt&lv=${orgLv}&orgCode=${orgCode}`
      // let token = 'Bearer ' + getToken();
      let token = getToken();
      this.url = globalConf.baseUrl + `/jmreport/view/ff9bd143582a6dfed897ba8b6f93b175?token=${token}`
      this.height = window.screen.availHeight
    },
    methods:{
      loadFrame() {
        const iframeBox = document.getElementById('iframe-box')
        const doc = iframeBox.contentWindow.document
        const head = doc.getElementsByTagName('head')
        const linkTag = document.createElement('link')
        linkTag.id = 'newstyle'
        linkTag.href = `./iframe.css`
        linkTag.setAttribute('rel', 'stylesheet')
        linkTag.setAttribute('type', 'text/css')
        head[0].append(linkTag)
      }
    }
  }
</script>
<style lang="scss">
.report-box{
  height: calc( 100vh - 150px );
}
</style>