<template>
  <div class="reportform-component">
    <richform ref="richform" :form="form" @submit="search" />
    <iframe scrolling="no" frameBorder="0" :src="url" width="100%" :style="{ height: height }"></iframe>
  </div>
</template>
<script>
export default {
  props: {
    form: {
      required: true,
      type: Array
    },
    url: {
      required: true,
      type: String
    }
  },
  data() {
    return {
      height: '300px'
    }
  },
  beforeCreate() {
    this.loading.show()
  },
  mounted() {
    this.height = `calc(100% - ${this.$refs.richform.$el.offsetHeight}px)`
    this.loading.close()
  },
  methods: {
    search(formData) {
      this.$emit('search', formData)
    }
  }
}
</script>
<style>
.reportform-component {
  height: 100%;
}

.reportform-component iframe {
  min-height: 300px;
}
</style>