<template>
  <div v-loading="loading" style="" class="main-container">
    <iframe ref="report-view" id="report-view" name="main-iframe" :src="url" frameborder="0" scrolling="auto" />
  </div>
</template>

<script>
export default {
  name: "ReportDesign",
  props: {},
  data() {
    return {
      loading: true,
      url: "",
      // url: "/pms-am/ureport/preview", // 不行
      // url: "http://192.168.1.62:8080/pms-am/ureport/preview",  // 可以，但不通用
      // url: window.SITE_CONFIG["apiURL"] + "/ureport/designer",
    };
  },
  beforeRouteEnter(to, from, next) {
    next((vm) => {
      vm.loading = true;
      vm.url = window.SITE_CONFIG["apiURL"] + "/ureport/designer?_u=db:" + to.query.name; // + ".ureport.xml";
    });
  },
  mounted() {
    const iframe = this.$refs["report-view"];
    iframe.onload = () => {
      this.loading = false;
    };
  },
  methods: {},
};
</script>

<style scoped>
.main-container {
  min-height: inherit;
  /* padding: 16px; */
  background: white;
  /* border-radius: 6px; */
  /* box-shadow: 0 0 1.125px 0.125px rgba(0, 0, 0, 0.125); */
  /* height: 100%; */
}

#report-view {
  width: 100%;
  min-height: inherit;
}
</style>
