<template>
  <div :style="pageHeight">
    <iframe
      :src="url"
      width="100%"
      height="100%"
      frameborder="0"
      scrolling="auto"
    ></iframe>
  </div>
</template>
<script>
export default {
  data() {
    return {
      url: null,
    };
  },
  computed: {
    pageHeight() {
      return {
        height: document.documentElement.clientHeight - 80 + "px",
      };
    },
  },
  watch: {
    $route: {
      handler: function (route) {
        this.url = null;
        if (route.query.name) {
          if (route.query.name === "xinzuo") {
            this.url = `${
              this.reportBaseUrl || "http://172.16.12.101:8083"
            }/rbi/ebibase/showreport.do?resid=EANA$2$2$1$bd71f31ba69443b5b3f3997965927c41$d169ca9e0c974a6299b49dc752446ee2&id=admin&pw=admin`;
          } else if (route.query.name === "jiliangshan") {
            this.url = `${
              this.reportBaseUrl || "http://172.16.12.101:8083"
            }/rbi/ebibase/showreport.do?resid=EANA$2$2$1$bd71f31ba69443b5b3f3997965927c41$839ccb29a1e84da48b21c659423c0175&id=admin&pw=admin`;
          } else if (route.query.name === "fanshigou") {
            this.url = `${
              this.reportBaseUrl || "http://172.16.12.101:8083"
            }/rbi/ebibase/showreport.do?resid=EANA$2$2$1$bd71f31ba69443b5b3f3997965927c41$03e83149008940daa72311823bd381da&id=admin&pw=admin`;
          } else if (route.query.name === "caoshanliang") {
            this.url = `${
              this.reportBaseUrl || "http://172.16.12.101:8083"
            }/rbi/ebibase/showreport.do?resid=EANA$2$2$1$bd71f31ba69443b5b3f3997965927c41$33ab21248a7e49b683e5891b4ff6dad6&id=admin&pw=admin`;
          } else if (route.query.name === "leijiashan") {
            this.url = `${
              this.reportBaseUrl || "http://172.16.12.101:8083"
            }/rbi/ebibase/showreport.do?resid=EANA$2$2$1$bd71f31ba69443b5b3f3997965927c41$28c6ac8488f841f6b8270cb902aad1ce&id=admin&pw=admin`;
          }
          // if (window.location.origin.indexOf('172.16.12.101') != -1) {
          //     if (route.query.name === 'xinzuo') {
          //         this.url =
          //             'http://172.16.12.101:8083/rbi/ebibase/showreport.do?resid=EANA$2$2$1$bd71f31ba69443b5b3f3997965927c41$d169ca9e0c974a6299b49dc752446ee2&id=admin&pw=admin'
          //     } else if (route.query.name === 'jiliangshan') {
          //         this.url =
          //             'http://172.16.12.101:8083/rbi/ebibase/showreport.do?resid=EANA$2$2$1$bd71f31ba69443b5b3f3997965927c41$839ccb29a1e84da48b21c659423c0175&id=admin&pw=admin'
          //     } else if (route.query.name === 'fanshigou') {
          //         this.url =
          //             'http://172.16.12.101:8083/rbi/ebibase/showreport.do?resid=EANA$2$2$1$bd71f31ba69443b5b3f3997965927c41$03e83149008940daa72311823bd381da&id=admin&pw=admin'
          //     } else if (route.query.name === 'caoshanliang') {
          //         this.url =
          //             'http://172.16.12.101:8083/rbi/ebibase/showreport.do?resid=EANA$2$2$1$bd71f31ba69443b5b3f3997965927c41$33ab21248a7e49b683e5891b4ff6dad6&id=admin&pw=admin'
          //     } else if (route.query.name === 'leijiashan') {
          //         this.url =
          //             'http://172.16.12.101:8083/rbi/ebibase/showreport.do?resid=EANA$2$2$1$bd71f31ba69443b5b3f3997965927c41$28c6ac8488f841f6b8270cb902aad1ce&id=admin&pw=admin'
          //     }
          // } else {
          //     if (route.query.name === 'xinzuo') {
          //         this.url =
          //             'http://10.127.7.196:8083/bi/ebibase/showreport.do?resid=EANA$2$2$1$041302f30436412d9ba78f161a6575f0$d169ca9e0c974a6299b49dc752446ee2&id=admin&pw=admin'
          //     } else if (route.query.name === 'jiliangshan') {
          //         this.url =
          //             'http://10.127.7.196:8083/bi/ebibase/showreport.do?resid=EANA$2$2$1$041302f30436412d9ba78f161a6575f0$839ccb29a1e84da48b21c659423c0175&id=admin&pw=admin'
          //     } else if (route.query.name === 'fanshigou') {
          //         this.url =
          //             'http://10.127.7.196:8083/bi/ebibase/showreport.do?resid=EANA$2$2$1$041302f30436412d9ba78f161a6575f0$03e83149008940daa72311823bd381daid=admin&pw=admin'
          //     } else if (route.query.name === 'caoshanliang') {
          //         this.url =
          //             'http://10.127.7.196:8083/bi/ebibase/showreport.do?resid=EANA$2$2$1$041302f30436412d9ba78f161a6575f0$33ab21248a7e49b683e5891b4ff6dad6&id=admin&pw=admin'
          //     } else if (route.query.name === 'leijiashan') {
          //         this.url =
          //             'http://10.127.7.196:8083/bi/ebibase/showreport.do?resid=EANA$2$2$1$041302f30436412d9ba78f161a6575f0$28c6ac8488f841f6b8270cb902aad1ce&id=admin&pw=admin'
          //     }
          // }
        }
      },
      immediate: true,
    },
  },
};
</script>