<!--
  @description: 新增标中澄清
  @Modifier: 郝定康
  @routerPath:/procurement/procurementDrive/procEvaluateClarify/procEvaluateClarifyDetail
  @date: 2021-02-09 17:33:00
-->
<template>
  <div>
    <table class="tableData">
      <tr>
        <td>
          澄清标题
        </td>
        <td colspan="3">
          {{ formData.bidClarificationTitle }}
        </td>
      </tr>
      <tr>
        <td>
          澄清回复截止时间
        </td>
        <td>
          {{ formData.clarificationEndTime }}
        </td>
      </tr>
      <!-- <tr>
        <td>
          澄清内容文件
        </td>
        <td colspan="3">
          <downloadFile :data="bidClarificationContent" />
        </td>
      </tr> -->
      <tr>
        <td>
          澄清文件
        </td>
        <td colspan="3">
          <downloadFile :data="bidClarificationAttachment" />
        </td>
      </tr>
    </table>
    <div class="mt10 mb10" style="font-size: 14px;">
      选择需澄清供应商
    </div>
    <el-table
      ref="supplierList"
      :data="supplierList"
    >
      <el-table-column
        :selectable="selectable"
        type="selection"
        width="55"
      />
      <el-table-column
        type="index"
        label="序号"
        width="60px"
        align="center"
      />
      <el-table-column
        label="供应商名称"
        align="center"
        prop="supplierName"
      />
    </el-table>
    <!--保存按钮-->
    <div class="but_footer">
      <div class="but_footer-h" />
      <div class="but_footer-but">
        <el-button @click="back">
          返 回
        </el-button>
      </div>
    </div>
  </div>
</template>

<script>
/* 接口*/
import { listSignUpSupplierList, getEditBidClarificationInfo } from '@/api/procurement/procurementProject'// 澄清
/* 混合开发方法-参数字段*/
import { clarificationGroupMixin } from '../../mixins/clarificationGroupMixin'// 澄清质疑-公用参数
import { clarificationMixin } from '../../mixins/clarificationMixin'// 澄清质疑-公用参数
/* 组件*/
import downloadFile from '@comp/common/updownload/downloadFile'
export default {
  name: 'ClarificationDetail',
  components: {
    downloadFile
  },
  inject: ['getTenderBase'],
  mixins: [clarificationMixin, clarificationGroupMixin],
  data() {
    return {
      tenderBase: this.getTenderBase(), // 项目信息
      confirmLoading: false,
      supplierList: [],
      formData: {}
    }
  },
  created() {
    this.listSignUpSupplierList()
  },
  methods: {
    // 禁用选中
    selectable() {
      return false
    },
    // 返回
    back() {
      // 如果是专家评标-澄清质疑 roleCode 11 采购员  OFF_EXPERT 评标专家
      if (this.roleCode === 'OFF_EXPERT') {
        this.$router.push({
          name: 'procEvaluateClarifyExpertList'
        })
      } else {
        this.$router.push({
          name: 'procEvaluateClarifyList'
        })
      }
    },
    /*
    * 详情
    * */
    getEditBidClarificationInfo() {
      const params = {
        bidClarificationId: this.$route.params.bidClarificationId
      }
      getEditBidClarificationInfo(params).then(response => {
        this.formData = response.data
        this.bidClarificationContent.bizId = this.bidClarificationAttachment.bizId = response.data.bidClarificationId
        this.$nextTick(() => {
          this.supplierList.forEach((item, index) => {
            if (response.data.supplierIdList.indexOf(item.supplierId) !== -1) {
              this.$refs.supplierList.toggleRowSelection(this.supplierList[index], true)
            }
          })
        })
      }).catch(() => {
      })
    },
    // 供应商列表
    listSignUpSupplierList() {
      const params = {
        packId: this.tenderBase.packId
      }
      listSignUpSupplierList(params).then(response => {
        this.supplierList = response.data
        // 详情
        this.getEditBidClarificationInfo()
      }).catch(() => {
      })
    }
  }
}
</script>

<style scoped lang="less">

</style>
