<!--
  @description: 采购公告tab切换(采购员/项目经理驱动内的)
  @Modifier: 高铭昱
  @routerPath:/procurement/procurementDrive/procurementContentTabs/procurementProjectContentDetail
  @date: 2020-8-25-15:52
-->
<template>
  <div>
    <div class="main" style="margin-top: 0;">
      <tabs ref="tabs" :list="tabsList" />
    </div>
    <div class="main">
      <router-view />
    </div>
  </div>
</template>

<script>
// 组件
import tabs from '@comp/common/tabs'// 非主流程tabs
export default {
  name: 'ObjectionTabs',
  inject: ['getTenderBase'],
  components: {
    tabs
  },
  data() {
    return {
      procurementRole: this.$route.meta.procurementRole,
      tabsList: [],
      tenderBase: this.getTenderBase()
    }
  },
  created() {
    this.roleSelectRouter(this.procurementRole)
  },
  methods: {
    //  根据角色选择不同路由数据
    roleSelectRouter(procurementRole) {
      // 根据项目类型 动态修改列表字段
      const tenderTypeTxt = this.tenderBase.tenderType === '00' ? '采购公告' : '邀请函'
      // procurementRole 11项目经理 12供应商
      if (procurementRole === '11') {
        this.tabsList = [
          {
            name: '采购单信息',
            path: '/procurement/procurementDrive/procurementContentTabs/procurementProjectContentDetail'
          },
          {
            name: tenderTypeTxt,
            path: '/procurement/procurementDrive/procurementContentTabs/procurementParticpatingBulletin'
          }
        ]
        if (this.tenderBase.tenderMethod !== '12') {
          this.tabsList.push({
            name: '采购单变更',
            path: '/procurement/procurementDrive/procurementContentTabs/procurementAlterRecord'
          })
        }
        return
      }
      this.tabsList = [
        {
          name: tenderTypeTxt,
          path: '/procurement/procurementDriveSupplier/procurementSupplierBulletin/procurementSupplierBulletinDetail'
        }
      ]
      if (this.tenderBase.tenderMethod !== '12') {
        this.tabsList.push({
          name: '采购单变更',
          path: '/procurement/procurementDriveSupplier/procurementSupplierBulletin/procurementSupplierAlterRecord'
        })
      }
    }
  }
}
</script>
