<template>
  <div class="main">
    <a-row>
      <a-card :body-style="{ 'padding-top': '10px' }">
        <div class="block">
          <a-button type="primary" icon="download" style="float: right;margin:0 5px" @click="exportExecl">导出</a-button>
          <a-button type="primary"  style="float: right;margin:0 5px" @click="searchExecl">查询</a-button>
        </div>
      </a-card>
    </a-row>
    <a-row>
      <form ref="formMain1" id="formMain1" target="frameMain1" :action="reportSrc" method="post">
        <input type="hidden" name="width" v-model="windowWidth">
        <input type="hidden" name="height" v-model="windowHeight">
        <input type="hidden" name="year" v-model="year">
        <input type="hidden" name="excelName" v-model="excelName">
      </form>
      <a-card :body-style="{ 'height': dxdcMainHeight + 'px', 'padding': '0' }">
        <div style="width: 100%;height: 100%;" v-loading="loading">
          <iframe
            ref="frameMain1"
            id="frameMain1"
            name="frameMain1"
            src=""
            frameborder="0"
            width="100%"
            height="100%"
            style="overflow: auto"></iframe>
        </div>
      </a-card>
    </a-row>
  </div>
</template>

<script>
export default {
  components: {},
  props: [],
  data() {
    return {
      year: new Date().getFullYear().toString(),
      dxdcMainHeight: window.innerHeight - 230,
      windowHeight: window.innerHeight - 200,
      windowWidth: window.innerWidth - 350,
      reportSrc:
        '/modular-source/6ace62b8e2bb467d98286d260aebcef2/demo/reportJsp/reportJsp/showReport.jsp?rpx=dc_zg_1001.rpx',
      loading: true,
      excelName: '整改台账汇总表',
    };
  },
  mounted() {},
  created() {},
  computed: {
    persId() {
      return localStorage.getItem('userid')
        ? localStorage.getItem('userid')
        : '';
    },
  },
  methods: {
    // 获取Excel数据
    searchExecl() {
      //console.log("搜索条件 - " + this.ids.length);
      this.$nextTick(() => {
        this.loading = true;
        // 使用form表单post提交，彻底解决参数值过长的问题
        this.$refs.formMain1.submit();
        // 使用_this
        const _this = this;
        this.$refs.frameMain1.onload = () => {
          _this.loading = false;
        };
      });
    },
    // 导出Excel数据
    exportExecl() {
      const v = window.frames['frameMain1'];
      v.report1_saveAsExcel();
    },
  },
  watch: {},
  activated() {
    this.searchExecl();
  },
};
</script>

<style lang='less' scoped>
.main {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}
:deep(.ant-select) {
  width: 200px;
}
</style>
