<template>

    <el-container style="height:100%;">
        <el-header style="display:flex;align-items:center;" v-if="vShow">

        </el-header>

        <el-main id="dcjhMain">
            <div :style="{'height':dxdcMainHeight + 'px','padding':'0','width':'100%','overflow':'hidden'}" v-loading="false">
                <iframe ref="myIframe" id="frameMainSlgc" src="" frameborder="0" width="100%" height="100%" style="overflow: auto"></iframe>
            </div>
        </el-main>

</el-container>
</template>
<script>

import request from '@/utils/gw_ajax_request.js';
import {dateFormat} from '@/utils/gw_date.js';

export default {
    props: ['show','listId','heightStr','widthStr','dxdcMainHeightStr'],
    components: {

    },
    data() {
        return {
            loading:true,
            reportSrc:'/demo/reportJsp/showInput.jsp?sht=jc_zl_jb.sht', // @todo 此处换上问题填报的报表链接就行了 
            excelName:'稽察资料填报表',
            dxdcMainHeight: window.innerHeight - 120,
            windowHeight:window.innerHeight - 120,
            windowWidth:window.innerWidth - 10,
            vShow:true,
        }

    },

    computed:{
        userId:function(){
            return localStorage.getItem("userid")? localStorage.getItem("userid"): '1098101939614724096'
        },
    },
    watch:{

    },
    mounted(){
        if(this.show != undefined){
             this.vShow = this.show;
        }
        if(this.heightStr != undefined){
            this.windowHeight = this.heightStr;
        }
        if(this.widthStr != undefined){
            this.windowWidth = this.widthStr;
        }
        if(this.dxdcMainHeightStr != undefined){
            this.dxdcMainHeight = this.dxdcMainHeightStr;
        }
        this.searchExecl();
    },
    methods:{
        // 获取Excel数据
        searchExecl(){
            this.loading = true;
            let _this = this;
            let iframe = document.getElementById("frameMainSlgc");
            let src = this.reportSrc;
           
            iframe.src= src
                + "&width=" + this.windowWidth
                + "&height=" + this.windowHeight
                + "&excelName=" + this.excelName
                + "&listId=" + this.listId
                + "&persId=" + this.userId

            if (iframe.attachEvent){
                iframe.attachEvent("onload", function(){
                    _this.loading = false;
                });
            } else {
                iframe.onload = function(){
                    _this.loading = false;
                };
            }

        },
        // 导出Excel数据
        exportExecl(){
            v = window.frames["frameMainSlgc"];
            v.contentWindow.report1_saveAsExcel();
        },

    },
    activated() {

    }
}
</script>
<style>

#dcjhMain {
    /* overflow: hidden; */
    padding:0;
}

</style>
