  <!--
  @Author: wxy
  @Date: 2020-06-03 15:55:14
  @Description: 联系人信息-报名情况-不审核-竞价类/非竞价类
  @routerPath:/procurement/procurementDrive/supplierResponse/contactInfoNoAuditList
-->
<template>
  <div class="main">
    <p class="page-title">
      1、参与项目情况
    </p>
    <table class="tableData mb16">
      <tr class="singleRow">
        <td>参与家数</td>
        <td>
          {{ signUpCountVo.totalCount }}
        </td>
      </tr>
    </table>
    <p v-if="isShowMessage === '01'" class="page-title">
      2、参与供应商列表
    </p>
    <div v-if="isShowMessage === '01'" style="padding:10px 0">
      <gx-button :code="'001_010_001'" @click="exportSignUpList">
        导出名单
      </gx-button>
    </div>
    <section v-if="isShowMessage === '01'">
      <el-table
        ref="smallTable"
        :data="tableData"
      >
        <el-table-column
          type="index"
          label="序号"
          align="center"
          width="60"
        />
        <el-table-column
          align="left"
          label="单位名称"
          header-align="center"
          prop="supplierName"
        />
        <el-table-column
          align="center"
          width="160"
          label="联系人"
          header-align="center"
          prop="linker"
        />
        <el-table-column
          align="center"
          label="联系电话"
          header-align="center"
          prop="linkerTel"
        />
        <el-table-column
          align="center"
          label="联系人登记时间"
          header-align="center"
          prop="applyTime"
        />
        <el-table-column
          align="center"
          label="操作"
          header-align="center"
        >
          <template slot-scope="scope">
            <gx-link v-if="scope.row.auditStatus!=='00'" :code="'001_010_002'" type="primary" @click.stop="view(scope.row)">
              [查看]
            </gx-link>
          </template>
        </el-table-column>
      </el-table>
      <!--分页组件-->
      <pagination :pagination-data="paginationData" @change="getLinkManData" />
    </section>
  </div>
</template>

<script>
/* 接口*/
import { connectionSignUpMessage, exportSignUpList } from '@/api/procurement/procurementSignup'// 获取联系人信息
/* 公共方法 */
import { download, filterObj } from '@/assets/js/utils'
/* 混合开发-参数字段 */
import { ListMixin } from '@/mixins/ListMixin'// 分页
/* 公共组件 */
import pagination from '@comp/common/pagination/pagination'// 分页
export default {
  name: 'ContactInfoAdd',
  inject: ['getTenderBase'],
  components: {
    pagination // 分页
  },
  filters: {
    filterStatus(val) {
      let text = ''
      switch (val) {
        case '00':
          text = '待审核'
          break
        case '01':
          text = '审核通过'
          break
        case '02':
          text = '不通过'
          break
      }
      return text
    }
  },
  mixins: [ListMixin],
  data() {
    return {
      isShowMessage: '', // 是否显示参与供应商列表
      tableData: [], // 邀请供应商列表
      signUpCountVo: {}, // 参与项目情况
      searchForm: {
        packId: '' // 标段id
      },
      tenderBase: this.getTenderBase() // 获取项目信息
    }
  },
  created() {
    // 查询联系人信息
    this.getLinkManData()
  },
  methods: {
    // 获取联系人页面入参参数
    getQueryParam() {
      this.searchForm.packId = this.tenderBase.packId // 获取项目的标段id
      const param = Object.assign({}, this.searchForm)
      param.pageNo = this.paginationData.pageNo
      param.pageSize = this.paginationData.pageSize
      return filterObj(param)
    },
    // 查询联系人信息
    getLinkManData() {
      const parameter = this.getQueryParam()
      connectionSignUpMessage(parameter).then(response => {
        this.isShowMessage = response.data.isShowMessage // 是否显示参与供应商列表
        const { signUpList, signUpCountVo } = response.data
        this.signUpCountVo = signUpCountVo
        this.tableData = signUpList.records // 获取参加的供应商列表
        this.paginationData.total = signUpList.total // 获取总条数
      }).catch(() => {
      })
    },
    // 查看
    view(val) {
      this.$router.push({
        path: '/procurement/procurementDrive/supplierResponse/contactInfoNoAudit',
        query: {
          data: val }
      })
    },
    // 导出名单
    exportSignUpList() {
      exportSignUpList(this.tenderBase.packId).then(res => {
        download(res, '参与供应商名单.xls')
      })
    }
  }
}
</script>

<style lang="less" scoped>

</style>
