<template>
  <div>
    <FollowReview :currentRow="currentRow" titlePosition="top" @update="update">
      <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>
  </div>
</template>

<script>
import FollowReview from "./components/FollowReview"
export default {
  name: "FollowUpDetail",
  props: {
    currentRow: {},
  },
  components: {
    FollowReview,
  },
  data() {
    return {
      isLast: false,
    }
  },
  methods: {
    handleEdit() {
      const { patientId, followId } = this.currentRow
      this.$router.push({
        path: "/followupentry",
        query: {
          patientId,
          followId,
          model: "edit",
          getData: 1,
          formType: 2,
        },
      })
    },
    update(val) {
      this.isLast = val
    },
  },
  computed: {
    isShowEdit() {
      const { checkStatus, followBatch } = this.currentRow
      return (
        this.isLast && followBatch > 0 && checkStatus !== 3 && checkStatus !== 4
      )
    },
  },
}
</script>
