<template>
  <div>
    <dialog-edit :visible.sync="dialogVisible" :editModel="editModel" :form="form" :title="$t('effectDealFeedBackMain.trackSummary')" :saveFlag="saveFlag">
      <el-tabs type="card" v-model="fatherTabNum" @tab-click="fatherTabClick()">
        <el-tab-pane v-for="item in sonTab" :key="item.dictId" :label="item.dictName" :name="item.dictId">
        </el-tab-pane>
      </el-tabs>
      <keep-alive>
        <component :is="component.filter(res => res.index === fatherTabNum)[0].name"
                   :editModel="editModel"
                   :form.sync="dealForm"
                   :num="num"
                   :userType="userType"
                   :key="fatherTabNum"
                   :ref="'dataTable'+fatherTabNum"
                   :fileAll="fileAll"
                   :trackType="trackType"
                   :feedbackResource="sonTab.filter(res => res.dictId === fatherTabNum)[0].feedbackResource"></component>
      </keep-alive>
      <template slot="footer">
          <!--导出-->
          <auth-button :label="'导出'" type="primary" size="medium" @click="importFile"></auth-button>
      </template>
    </dialog-edit>
  </div>
</template>

<script>
import trackScheduleBasePop from '@/pages/assetoutfeedback/coordManage/trackScheduleBasePop'
import trackScheduleConAndOtherPop from '@/pages/assetoutfeedback/coordManage/trackScheduleConAndOtherPop'
import { DialogEdit, searchForm, authButton } from 'newepoch-components'
import BasePage from '@/pages/baseEditPage'
export default {
  extends: new BasePage(),
  components: { DialogEdit, searchForm, authButton, trackScheduleBasePop, trackScheduleConAndOtherPop },
  props: {
    form: {
      type: Object,
      default () {
        return {}
      }
    },
    editModel: {
      type: String,
      default () {
        return ''
      }
    },
    userType: {
      type: String,
      default () {
        return '1'
      }
    },
    fileAll: {
      type: Array,
      default () {
        return []
      }
    },
    trackType: {
      type: String,
      default () {
        return ''
      }
    }
  },
  computed: {
    dealForm () {
      return this.form
    }
  },
  data () {
    return {
      saveFlag: false,
      num: 0,
      fatherTabNum: '1',
      sonTab: [
        {
          dictId: '1',
          feedbackResource: '1',
          dictName: '律所基础资产反馈进度'
        }, {
          dictId: '2',
          feedbackResource: '1',
          dictName: '律所批量反馈进度'
        }, {
          dictId: '3',
          feedbackResource: '2',
          dictName: '管理人基础资产反馈进度'
        }, {
          dictId: '4',
          feedbackResource: '2',
          dictName: '管理人批量反馈进度'
        }
      ],
      component: [
        {
          index: '1',
          name: 'trackScheduleBasePop'
        }, {
          index: '2',
          name: 'trackScheduleConAndOtherPop'
        }, {
          index: '3',
          name: 'trackScheduleBasePop'
        }, {
          index: '4',
          name: 'trackScheduleConAndOtherPop'
        }
      ]
    }
  },
  methods: {
    fatherTabClick () {
      this.num = this.num + 1
    },
    importFile () {
      this.$refs['dataTable' + this.fatherTabNum].importData()
    }
  }
}
</script>

<style>

</style>
