<template>
  <div class="basic-main" style="height: 100%">
    <div class="form-horizontal select-overspread container-fluid auto">
      <div class="span" style="float:right;">
        <report-print id='gasprice' top='3cm' left='0' width='100%' height='100%' :preview="true"></report-print>
        <report-excel id='gasprice'></report-excel>
      </div>
    </div>
    <div partial='list' id='gasprice' style="overflow-y: scroll">
      {{{reportStr}}}
    </div>
  </div>
</template>

<script>
export default {
  title: '历史报表展示',
  props: ['data'],
  data () {
    return {
      reportStr: ''
    }
  },
  ready () {
  },
  methods: {
    // 根据文件路径获取储存的报表内容
    getFileContent (path) {
      this.$resetpost('rs/logic/getReportFileContent', {f_files_path: path}, {
        resolveMsg: null,
        rejectMsg: null
      }).then((res) => {
        this.reportStr = res.data.filecontent
      })
    }
  },
  watch: {
    'data' (val) {
      if (val.f_files_path) {
        this.getFileContent(val.f_files_path)
      } else {
        this.$showAlert('没有获取到文件路径, 请检测', 'warning', 3000)
      }
    }
  },
  computed: {}
}
</script>
<style scoped>

</style>
