<!-- 外部机构意见反馈 -->
<template>
  <div class="feedbackMain">
    <el-tabs v-model="activeName" type="card" class="marginCard">
      <el-tab-pane :label="item.name" :name="item.id" v-for="item in tabList" :key="item.id">
        <component v-if="activeName === item.id" :is="item.componentName" :form="forms[item.id]"></component>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script>

import BasePage from '@/pages/basePage'

export default {
  extends: new BasePage(),
  name: 'feedBackMainIndex',
  data () {
    return {
      activeName: '0', // tab控件
      forms: [{}, {}, {}],
      initFlag: true,
      // tab列表
      tabList: []
    }
  },
  methods: {
    init () {
      if (this.initFlag) {
        this.initFlag = false
        this.$nextTick(() => {
          let params = this.$route.params
          // console.log(params)
          this.activeName = params.type || this.activeName
          this.forms[params.type || this.activeName] = params.form || {}
          // console.log(this.forms)
          this.tabList = [
            // 抽样文件反馈
            {
              id: '0',
              name: '抽样文件反馈',
              componentName: resolve => require([`@/pages/assetoutfeedback/feedBackMain/sampleFeedBackMain`], resolve)
            },
            // 确权文件反馈
            {
              id: '1',
              name: '确权文件反馈',
              componentName: resolve => require([`@/pages/assetoutfeedback/feedBackMain/confirmFeedBackMain`], resolve)
            },
            // 其他文件反馈
            {
              id: '2',
              name: '其他文件反馈',
              componentName: resolve => require([`@/pages/assetoutfeedback/feedBackMain/otherFeedBackMain`], resolve)
            }
          ]
          this.initFlag = true
        })
      }
    }
  },
  mounted () {
    this.init()
  },
  activated () {
    this.init()
  }
}
</script>
<style lang="scss" scoped>
  @import '~@/styles/assetoutfeedback/common.scss';
</style>
