<template>
  <ht-template-form
    :template-key="templateKey"
    :action="action"
    :is-share="isShare"
    :open-type="openType"
    :data-param="params"
    :is-custom-handle-close="isNewPage"
    @close="handleClose"
  ></ht-template-form>
</template>
<script>
export default {
  name: 'TemplateForm',
  data() {
    return {
      templateKey: null,
      action: null,
      isShare: false,
      openType: null,
      params: null
    }
  },
  computed: {
    isNewPage() {
      return (
        this.$route.query.isNewPage === 'true' ||
        this.$route.query.isNewPage === true
      )
    }
  },
  created() {
    this.templateKey = this.$route.params.templateKey
    this.action = this.$route.params.action
    this.isShare = this.$route.params.isShare
    this.openType = this.$route.params.openType
    if (this.$route.query.showModifyRecord) {
      let showModifyRecordId =this.$route.params.data
      this.$requestConfig.boDataModifyRecordById(showModifyRecordId).then((resp) => {
       this.params = Base64.encode(resp.data) 
      }) 
    } else if (this.$route.query.data) {
      console.log(this.$route.query.data,'this.$route.query.data')
      this.params = this.$route.query.data
    } else {
      this.params = this.$route.params.data
    }
  },
  methods: {
    handleClose() {
      window.close()
    }
  }
}
</script>
<style lang="scss" scoped>
::v-deep {
  .form-table__container {
    .form-table-header {
      .import-export__wrap {
        .el-dropdown {
          height: 32px;
          line-height: 29px;
        }
      }
      .clear-all-btn {
        font-size: 16px;
        margin-top: 0;
      }
    }
  }
}
</style>
