<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) {
                        // window.location.origin.indexOf('172.16.12.101') != -1
                        if (route.query.name === "xinzhuang") {
                            this.url =
                                `${
              this.reportBaseUrl || "http://172.16.12.101:8083"
            }/rbi/ebibase/showreport.do?resid=EANA$2$2$1$bd71f31ba69443b5b3f3997965927c41$4a71c6bc1fd34da7843c6eb2a7b3aee3&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$621b7c14e4aa4a0483a8e577d8dc4cff&id=admin&pw=admin`;
                        } else if (route.query.name === "zuozhuang") {
                            this.url =
                                `${
              this.reportBaseUrl || "http://172.16.12.101:8083"
            }/rbi/ebibase/showreport.do?resid=EANA$2$2$1$bd71f31ba69443b5b3f3997965927c41$36292212f28b4702af2c4aa01a62bdc1&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$2320f3ed77e740d6bb1b66b1f7062ad1&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$3dc29db548d54d289e58bf4a30dfb026&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$5ebbf0905b22448cbd9834ec6560fd26&id=admin&pw=admin`;
                        }
                    }
                },
                immediate: true,
            },
        },
    };
</script>