<!--
  @description: 申报材料变更-基本信息
  @Modifier: 肖文龙
  @routerPath:
  @date: 2020-6-1 16:32:31
-->
<template>
  <div class="p0-16">
    <essentialInformationAdd
      v-if="isView"
      :judge-page-data="judgePageData"
      @showStatuschage="showStatuschage"
    />
    <template v-else>
      <div v-if="changeView" class="mb10">
        <el-button type="primary" @click="isView=true">
          修改
        </el-button>
      </div>
      <essentialInformationDetail
        ref="essentialInformationDetail"
        :judge-page-data="judgePageData"
      />
    </template>
  </div>
</template>

<script>
/* 组件 */
import essentialInformationAdd from './essentialInformation-add'// 编辑
import essentialInformationDetail from './essentialInformation-detail'// 查看
export default {
  name: 'EssentialInformationChangeEditView',
  components: {
    essentialInformationAdd, // 编辑
    essentialInformationDetail// 查看
  },
  props: {
    showStatus: {
      type: String,
      default: function() {
        return
      }
    },
    judgePageData: {
      type: Object,
      default() {
      }
    }
  },
  data() {
    return {
      isView: false, // 展示状态  true 编辑
      changeView: true, // 是否展示修改按钮
      type: this.$route.meta.type // 类型 变更、审核、入库
    }
  },
  created() {
    if (this.type === 'declarationChange' && this.showStatus === '00') { // 只有变更展示修改按钮
      this.changeView = false
    }
  },
  methods: {
    // 接收基本信息传的参数-审核状态-审核图片展示
    showStatuschage() {
      this.$emit('showStatuschage')// 传给父集组件参数-审核状态-审核图片展示
      this.isView = false
      this.changeView = false
    }
  }
}
</script>

<style lang="less" scoped>

</style>
