<!--
  @description: 专家库-补抽
  @Modifier: qrf
  @routerPath: /expert/extractProjectMakeUpContent
  @date: 2020/10/26
-->
<template>
  <div>
    <section class="title title_border p0-16 clearfix">
      <template>
        <div class="pointer" @click="back">
          <i class="iconfont icon-fanhui mr10" />
          补抽
        </div>
      </template>
    </section>
    <div class="main">
      <!-- 设置抽取条件 -->
      <extractConditionList :list-data="id" @extractConditionData="extractConditionHandle" />
      <!-- 抽取条件记录 -->
      <extractConditionRecordingList ref="extractConditionRecordingList" :list-data="id" />
    </div>
    <div class="but_footer">
      <div class="but_footer-h">
        <div class="but_footer-but">
          <el-button :loading="btnLoding" type="primary" @click="extract()">
            抽 取
          </el-button>
          <el-button @click="back()">
            取 消
          </el-button>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
/* api */
import { saveCondition } from '@/api/expert/extractExpert/extractExpert'
/* 組件 */
import extractConditionList from '@/views/expert/extractExpert/etractApplyList/extractCondition-list'
import extractConditionRecordingList from '@/views/expert/extractExpert/extractConditionRecording/extractConditionRecording-list'
export default {
  name: '',
  components: {
    extractConditionList,
    extractConditionRecordingList
  },
  data() {
    return {
      id: this.$route.params.id,
      extractConditionData: []
    }
  },
  methods: {
    // 返回
    back() {
      if (this.$route.params.type === '01') {
        this.$router.replace(
          {
            path: '/expert/extractApplyList'
          }
        )
      } else {
        this.$router.replace(
          {
            path: '/expert/extractProject-list'
          }
        )
      }
    },
    extractConditionHandle(val) {
      this.extractConditionData = val
    },
    // 抽取
    extract() {
      saveCondition(this.extractConditionData).then((res) => {
        this.$message({
          type: 'success',
          message: '补抽成功!'
        })
        this.back()
        // this.$refs.extractConditionRecordingList.initData()
      }).catch(() => {
      })
    }
  }
}
</script>
