<!--
  @description: 申报材料变更-供货记录
  @Modifier: 肖文龙
  @routerPath:
  @date: 2020-6-1 16:32:31
-->
<template>
  <div class="p0-16">
    <supplYrecordAdd v-if="isView" @showStatuschage="showStatuschage" />
    <template v-else>
      <div v-if="changeView" class="mb10">
        <el-button type="primary" @click="isView=true">
          修改
        </el-button>
      </div>
      <supplYrecordDetail />
      <!-- 审核信息 -->
      <inforaMtionAuditDetail v-if="!judgePageData.detailType" />
    </template>
  </div>
</template>

<script>
/* 组件 */
import supplYrecordAdd from './supplYrecord-add'// 编辑
import supplYrecordDetail from './supplYrecord-detail'// 查看
import inforaMtionAuditDetail from '@/views/supplier/editorDeclaration/inforaMtionAudit/inforaMtionAudit-detail'// 审报材料-审核信息

export default {
  name: 'SupplYrecordChangeEditView',
  components: {
    supplYrecordAdd, // 编辑
    supplYrecordDetail, // 查看
    inforaMtionAuditDetail // 审核信息
  },
  props: {
    showStatus: {
      type: String,
      default: function() {
        return
      }
    },
    judgePageData: {
      type: Object,
      default: function() {
        return {
          declarationId: '', // 申报id
          departId: '', // 供应商主键id
          isViewPage: '', // 查看基本信息
          departInfoId: '' // 变更提交携带参数
        }
      }
    }
  },
  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(showStatus) {
      this.$emit('showStatuschage', showStatus)// 传给父集组件参数-审核状态-审核图片展示
      if (this.type === 'declarationChange') { // 只有变更展示修改按钮
        this.isView = false
        this.changeView = false
      }
    }
  }
}
</script>

<style lang="less" scoped>

</style>
