<!--
  @description: 评标-废标-查看页面
  @Modifier: yf
  @routerPath:
  @date: 2020-8-22-16:56
-->
<template>
  <div class="p0-16" style="margin-top:16px">
    <!-- 废标原因 -->
    <dl class="projectInfoDetail">
      <dt>
        1.废标原因
      </dt>
      <dd>
        <!-- 废标原因 -->
        <table class="tableData">
          <tr>
            <td>是否投标表决</td>
            <td>
              <span v-if="votingResult==='废标'">是</span>
              <span v-else>否</span>
            </td>
          </tr>
          <tr>
            <td>废标原因</td>
            <td>{{ wasteBidReason }}</td>
          </tr>
        </table>
      </dd>
    </dl>
    <!-- 投票结果 -->
    <dl class="projectInfoDetail">
      <dt>
        2.投票结果
      </dt>
      <dd>
        <!-- 投票结果 -->
        <expertElectLeader :show-voted="showVote" :expert-data="expertData" />
      </dd>
    </dl>
  </div>
</template>

<script>
/* api接口*/
import {
  procurementAbandonVotesInfo
} from '@/api/procurement/procurementEvaluation'
// 引入组件
import expertElectLeader from './procurementExpertElectFb-detail' // 废标
export default {
  components: {
    expertElectLeader // 投票结果
  },
  props: {
    packId: {
      type: String,
      default: function() {
        return ''
      }
    },
    // 项目经理查看单个评委评审信息
    driveInfo: {
      type: Object,
      default: function() {
        return {}
      }
    }
  },
  data() {
    return {
      showVote: true,
      expertData: [], // 专家投票列表
      votingResult: '', // 表决结果
      wasteBidReason: '', // 废标原因
      packIdDetail: ''
    }
  },
  created() {
    // 判断是否为项目经理页面
    this.packId !== '' ? this.packIdDetail = this.packId : this.packIdDetail = this.driveInfo.packId
    if (this.packIdDetail !== '') {
      this.initData()
    }
  },
  methods: {
    // 初始化页面数据
    async initData() {
      const data = {
        packId: this.packIdDetail
      }
      const res = await procurementAbandonVotesInfo(data)
      this.votingResult = res.data.abandonType
      this.wasteBidReason = res.data.abandonReason
      this.expertData = res.data.evalExpertVotesList
      // })
    }
  }
}

</script>
<style lang="less" scoped>
.tableData tr td:nth-child(odd) {
    width: 7%;
}
</style>
