<template>
  <FollowReview
    :currentRow="currentRow"
    ref="follow"
    titlePosition="top"
    @update="update"
  >
    <template #note>{{ note }}</template>

    <template #button>
      <el-button style="padding: 8px 20px" v-if="isShowEdit" @click="handleEdit"
        >修 改</el-button
      >
      <el-button
        style="padding: 8px 20px; margin-left: 20px"
        @click="$emit('back')"
        >返 回</el-button
      >
    </template>
  </FollowReview>
</template>

<script>
import FollowReview from "./components/FollowReview"
export default {
  name: "FollowUpDetail",
  props: {
    currentRow: {},
  },
  components: {
    FollowReview,
  },
  data() {
    return {
      isLast: false,
    }
  },
  methods: {
    handleEdit() {
      this.$emit("handleEdit", this.currentRow)
    },
    update(val) {
      this.isLast = val
    },
    refresh() {
      this.$refs.follow.refreshFollow()
    },
  },
  computed: {
    isShowEdit() {
      const { checkStatus, followBatch } = this.currentRow
      return (
        this.isLast && followBatch > 0 && checkStatus !== 3 && checkStatus !== 4
      )
    },
    note() {
      const { checkStatus, checkNote } = this.currentRow
      const status =
        checkStatus === 2 ? "驳回修改" : checkStatus === 4 ? "不合格" : ""
      return status ? status + "：" + checkNote : ""
    },
  },
}
</script>
