<!--
  @description: 招标-踏勘详情
  @Modifier: haoFx
  @routerPath:/bidding/projectDrive/projectExtend/bidProjectExtendDetail
  @date: 2020/3/4-10:28
-->
<template>
  <div class="main mb10">
    <div class="page-title">
      踏勘通知基本信息
    </div>
    <table class="tableData">
      <tr>
        <td>通知名称</td>
        <td>{{ formData.noticeName }}</td>
        <td>踏勘现场截止时间</td>
        <td>
          {{ formData.explorationSceneEndTime && $Moment(formData.explorationSceneEndTime).format(momentDateTime) }}
        </td>
      </tr>
      <tr>
        <td>项目（包组）名称</td>
        <td colspan="3">
          <packDetail :pack-list="selectPackList" />
        </td>
      </tr>
      <tr>
        <td>集合时间</td>
        <td>
          {{ formData.gatherTime && $Moment(formData.gatherTime).format(momentDateTime) }}
        </td>
        <td>集合地点</td>
        <td>{{ formData.gatherAddr }}</td>
      </tr>
      <tr>
        <td>答疑会时间</td>
        <td>
          {{ formData.meetTime && $Moment(formData.meetTime).format(momentDateTime) }}
        </td>
        <td>答疑会地点</td>
        <td>{{ formData.meetAddr }}</td>
      </tr>
      <tr>
        <td>通知内容</td>
        <td colspan="3" v-html="formData.noticeContent" />
      </tr>
      <tr>
        <td>附件</td>
        <td colspan="3">
          <downloadFile ref="downloadFile" :data="upLoadData" />
        </td>
      </tr>
    </table>
    <div class="page-title">
      投标人踏勘信息
    </div>
    <div>
      <el-table
        :data="projectExtendInfoList"
      >
        <el-table-column
          header-align="center"
          prop="supplierName"
          min-width="200"
          label="投标人"
        />
        <el-table-column
          header-align="center"
          prop="linker"
          min-width="200"
          label="联系人"
        />
        <el-table-column
          header-align="center"
          min-width="200"
          prop="linkerTel"
          label="联系电话"
        />
      </el-table>
    </div>
    <!--保存按钮-->
    <div class="but_footer">
      <div class="but_footer-h">
        <div class="but_footer-but">
          <el-button @click="back">
            返 回
          </el-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
/* api*/
import { getSupplierExplorationInfo, getTenderExplorationById } from '@api/bidding/exploration'
/* 组件*/
import packDetail from '@comp/bidding/packComponent/packDetail'// 关联标包渲染组件
import downloadFile from '@comp/common/updownload/downloadFile' // 获取附件信息 下载组件
/* js混入*/
import { bidProjectExtendMixins } from '../mixins/bidProjectExtendMixins'

export default {
  name: 'BidProjectExtendAdd',
  components: {
    packDetail,
    downloadFile // 文件下载
  },
  mixins: [bidProjectExtendMixins],
  data() {
    return {
      explorationId: this.$route.query.explorationId, // 踏勘id
      upLoadData: {
        bizId: '',
        fileType: 'tender_exploration_notice_file_base'
      },
      selectPackList: [], // 获取的已选择的标段（包）
      projectExtendInfoList: [] // 投标人踏勘信息
    }
  },
  created() {
    if (this.explorationId) {
      // 项目经理-通过踏勘id获取详细信息
      this.getTenderExploration()
      this.upLoadData.bizId = this.explorationId
    }
  },
  methods: {
    // 项目经理-通过踏勘id获取详细信息
    getTenderExploration() {
      getTenderExplorationById(this.explorationId).then(res => {
        this.formData = res.data
        this.selectPackList = this.formData.bidtExplorationTenderExplorationExpandVo
        this.getSupplierExplorationInfoList()
      })
    },
    // 获取投标人踏勘信息
    getSupplierExplorationInfoList() {
      const data = this.getPackIds().stageIds.join(',') // 阶段id集合
      const params = {
        stageIds: data, // 阶段id集合
        noticeId: this.explorationId // 踏勘通知表id
      }
      getSupplierExplorationInfo(params).then(res => {
        this.projectExtendInfoList = res.data
      }).catch(() => {

      })
    },
    // 获取投标人踏勘信息标段信息
    getPackIds() {
      const saveParams = {
        packIds: [], // 标段id集合
        stageIds: [], // 阶段id集合
        packNo: [], // 标段编号集合
        packName: [] // 标段名称集合
      }
      this.selectPackList.map(item => {
        saveParams.packIds.push(item.packId) // 标段id集合
        saveParams.stageIds.push(item.stageId) // 阶段id集合
        saveParams.packNo.push(item.packNo) // 标段编号集合
        saveParams.packName.push(item.packName) // 标段名称集合
      })
      return saveParams
    },
    // 返回
    back() {
      this.$router.push({
        path: '/bidding/projectDrive/projectExtend/projectExtendNoticeList',
        query: {
          ...this.$route.query
        }
      })
    }
  }
}
</script>

<style lang="less" scoped>
/deep/.file-list {
  .fileBtn,
  li {
    margin-bottom: 0 !important;
  }
  .name {
    margin-right: 0 !important;
  }
}
</style>
