<!--
  @description: 申报材料变更-业务经办人信息
  @Modifier: 肖文龙
  @routerPath:
  @date: 2020-6-1 16:32:31
-->
<template>
  <div class="p0-16">
    <!--添加编辑-->
    <businessManagerInfoAdd
      v-if="isView"
      :depart-data="judgePageData.departInfoId"
      @showStatuschage="showStatuschage"
    />
    <template v-else>
      <div v-if="changeView" class="mb10">
        <el-button type="primary" @click="isView=true">
          修改
        </el-button>
      </div>
      <!--查看-->
      <businessManagerInfoDetail :judge-page-data="judgePageData" :change-record="changeRecord" />
    </template>
  </div>
</template>

<script>
/* 组件 */
import businessManagerInfoAdd from './businessManagerInfo-add'// 编辑
import businessManagerInfoDetail from './businessManagerInfo-detail'// 查看
export default {
  name: 'BusinessManagerInfoChangeEditView',
  components: {
    businessManagerInfoAdd, // 编辑
    businessManagerInfoDetail// 查看
  },
  props: {
    showStatus: { // 图标状态
      type: String,
      default: function() {
        return
      }
    },
    judgePageData: {
      type: Object,
      default: function() {
        return {
          departId: '', // 供应商id
          declarationId: '', // 申报审核携带参数
          isViewPage: '', // 判斷是否是供应商本人登录 空代表是
          departInfoId: '' // 变更提交携带参数
        }
      }
    },
    changeRecord: { // 图标状态
      type: Boolean,
      default: function() {
        return
      }
    }
  },
  data() {
    return {
      isView: false, // 展示状态  true 编辑
      changeView: true, // 是否展示修改按钮
      type: this.$route.meta.type // 类型 变更、审核、入库
    }
  },
  watch: {
    'judgePageData.isViewPage'(val) {
      this.judgePageData.isViewPage = val
    }
  },
  created() {
    if (this.type === 'declarationChange' && this.showStatus === '00') { // 只有变更展示修改按钮
      this.changeView = false
    }
  },
  methods: {
    // 接收基本信息传的参数-审核状态-审核图片展示
    showStatuschage() {
      this.$emit('showStatuschage')// 传给父集组件参数-审核状态-审核图片展示
      if (this.type === 'declarationChange') { // 只有变更展示修改按钮
        this.changeView = false
        this.isView = false
      }
    }
  }
}
</script>

<style lang="less" scoped>

</style>
