<template>
  <div id="containt">
    <component
      v-if="showWfContent && wfContent"
      :is="wfContent"
      visible-key="showWfContent"
      :outParam.sync="outParam"
      :parent-target="_self"
      @reload="$reloadHandle"
    ></component>
  </div>
</template>

<script>
export default {
  data() {
    return {
      reportCode: null,
      showWfContent: true,
      wfContent: null,
      outParam: null
    };
  },
  created() {
    this.login();
  },
  methods: {
    initData() {
      let dataId = this.$route.query.dataId;
      let purl = this.$route.query.url;
      let param = this.$route.query.param;
      if (param) {
        this.outParam = JSON.parse(param)
      }
      let url = purl + '.vue';
      this.showWfContent = true;
      this.wfContent = require('@/views' + url).default;

    },
    login() {
      let token = this.$route.query.access_token;
      let url = this.$route.query.url;
      if (token && url) {
        this.$store
          .dispatch('user/addToken', {
            token
          })
          .then(() => {
            this.$nextTick(() => {
              this.initData();
            });
          });
      }
    }
  }
};
</script>

<style></style>
