<template>
  <div class="data-review">
    <cy-up-down-drag>
      <div slot="top">
        <exemption-view-content></exemption-view-content>
      </div>
      <div slot="bar">
        <div>
          资料审核
        </div>
      </div>
      <div slot="bottom">
        <data-review-content ref="dataReview"></data-review-content>
        <div class="submit-btn">
          <el-button @click="() => { $router.go(-1) }">取消</el-button>
          <el-button type="primary" @click="onSubmit">提交</el-button>
        </div>
      </div>
    </cy-up-down-drag>
  </div>
</template>

<script>
import { suppleInfoApproveSubmit } from '@/api/exemptionFollow'
export default {
  components: {
    DataReviewContent: () => import('./components/DataReviewContent.vue'),
    ExemptionViewContent: () => import('./components/ExemptionViewContent.vue')
  },
  data() {
    return {
    }
  },
  methods: {
    onSubmit() {
      this.$refs.dataReview.$refs.ruleForm.validate(valid => {
        if (valid) {
          const { taskId } = this.$route.query
          const { id } = this.$route.params
          const params = {
            Loading: true,
            businessKey: id,
            taskId,
            ...this.$refs.dataReview.ruleForm
          }
          suppleInfoApproveSubmit(params).then(() => {
            this.$message.success('提交成功')
            this.$router.go(-1)
          })
        } else {
          return false
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.contract-approval {

}
</style>
