
<!--
  @description: 评标大厅-推荐中选候选人评审表格组件
  @Modifier：wxy/yf
  @routerPath:
  @date： 2020-08-05 20:29:09
-->
<template>
  <div class="mb10" style="margin-top:10px">
    <el-table :data="tableData" style="width: 100%;" border>
      <el-table-column header-align="center" prop="supplierName" min-width="240px" label="供应商名称" align="left" />
      <el-table-column v-if="!isMerge" header-align="center" prop="businessScore" label="商务评审得分" align="center" />
      <el-table-column v-if="!isMerge" header-align="center" prop="skillScore" label="技术评审得分" align="center" />
      <el-table-column v-if="isMerge" header-align="center" prop="businessScore" label="商务技术评审得分" align="center" />
      <el-table-column header-align="center" prop="priceScore" label="价格评审得分" align="center" />
      <el-table-column header-align="center" prop="total" label="最终得分" align="center" />
      <el-table-column header-align="center" prop="sortNo" label="排名" align="center" />
      <el-table-column header-align="center" label="是否推荐" align="center">
        <template slot-scope="scope">
          <!-- 编辑页且为组长 -->
          <!-- <el-checkbox v-if="!getTenderBase.isEdit" :checked="scope.row.recommend === '01'?true:false" disabled /> v-if="getTenderBase.isEvalLeader==='01'" -->
          <div v-if="getTenderBase.isEdit&&getTenderBase.isRecommendCandidate === '01'">
            <el-checkbox v-model="scope.row.recommend" :checked="scope.row.recommend === '01'?true:false" true-label="01" false-label="00" />
            <span style="font-size: 13px;margin-left: 6px;">推荐</span>
          </div>
          <!-- 查看页面 -->
          <div v-if="!getTenderBase.isEdit">
            <span v-if="scope.row.recommend === '01'" style="font-size: 13px;margin-left: 6px;">推荐</span>
          </div>
        </template>
      </el-table-column>
    </el-table>
    <table class="evaluationBottomTb">
      <tr class="singleRow" style="min-width:200px">
        <td v-if="!getTenderBase.isEdit">
          <span>推荐理由</span>
        </td>
        <td v-if="!getTenderBase.isEdit">
          <span v-if="tableData[0]">{{ tableData[0].evaluationOpinion }}</span>
        </td>
      </tr>
    </table>
  </div>
</template>

<script>
/* api接口*/
import {
  showRecommendCandidate,
  listRecommendCandidate
} from '@/api/procurement/procurementEvaluation'
export default {
  props: {
    getTenderBase: {
      type: Object,
      default: function() {
        return {}
      }
    },
    driveInfo: {
      type: Object,
      default: function() {
        return {}
      }
    }
  },
  data() {
    return {
      tableData: [], // 表格数据
      isMerge: false, // 商务经济是否合并
      metaType: this.$route.meta.type, // 路由meta type信息managerView项目经理查看
      reason: { // 评审意见
        avoidReason: ''
      }
    }
  },
  watch: {
  },
  created() {
    this.initData()
  },
  methods: {
    // 获取评审表格数据
    initData() {
      // 编辑/查看
      if (this.getTenderBase.isEdit) {
        const data = {
          evalExpertId: this.getTenderBase.evalExpertId, // 专家评审表ID
          driverId: this.getTenderBase.driverId, // 驱动id
          packId: this.getTenderBase.packId, // 标段id
          evalRule: this.getTenderBase.evalRule // 评审规则 【00–整体步骤 01-单个评委步骤】
        }
        listRecommendCandidate(data).then(res => {
          this.tableData = res.data
          if (res.data && res.data[0].evaluationOpinion) {
            this.$emit('showRecommendedReason', res.data[0].evaluationOpinion)
          }
          // 商务经济是否合并
          this.businessTechnologyMerge(res.data)
        })
        return
      }
      const data = {
        packId: this.getTenderBase.packId || this.driveInfo.packId, // 标段id
        taskNo: this.getTenderBase.taskNo || this.driveInfo.taskNo // 驱动编号
      }
      showRecommendCandidate(data).then(res => {
        this.tableData = res.data
        if (res.data && res.data[0].evaluationOpinion) {
          this.$emit('showRecommendedReason', res.data[0].evaluationOpinion)
        }
        // 商务经济是否合并
        this.businessTechnologyMerge(res.data)
      })
    },
    // 商务经济是否合并
    businessTechnologyMerge(data) {
      // taskNo 04商务、经济评审分开显示 06 商务经济合并显示
      if (data[0].taskNo === '04') {
        this.isMerge = false
      }
      if (data[0].taskNo === '06') {
        this.isMerge = true
      }
    }
  }
}
</script>

<style lang='less' scoped>
/*评审指标信息*/
.evaluationBottomTb  {
  width: 100%;
  margin: 20px 0;
}
.evaluationBottomTb  td {
  border: 1px solid #E0E0E0;
  line-height: 20px;
  padding: 9px 10px;
    .el-form-item--small.el-form-item{
      margin: 0;
    }
    .el-input{
      width: 90%;
    }
}
.evaluationBottomTb  tr td:nth-child(odd) {
  background-color: #F5F7F9;
  width: 5%;
}
.evaluationBottomTb  tr td:nth-child(even) {
  width: 34%;
}
.evaluationBottomTb  tr.singleRow td:nth-child(odd) {
  background-color: #F5F7F9;
  width: 5.8%;
}
// .evaluationBottomTb  tr.singleRow td:nth-child(even) {
//   width: calc(100%-6.5%);
// }
</style>
