<!--
  @description: 采购人/代理机构-委托代理合同-关联招标项目-列表
  @author: 肖文龙
  @routerPath:/consignContract/consignContractCorrelationList
  @date：2019-11-28 15:21:25
-->
<template>
  <div class="p0-16">
    <section class="title">
      <i class="iconfont icon-fanhui pointer" @click="back" />
      关联招标项目
    </section>
    <div class="page-title">
      1. 委托合同信息
    </div>
    <table class="tableData">
      <tr>
        <td>合同名称</td>
        <td>{{ formData.contractName }}</td>
        <td>合同编号</td>
        <td>{{ formData.contractNo }}</td>
      </tr>
    </table>
    <div class="page-title">
      2. 招标项目列表
    </div>
    <div>
      <el-table :data="tableData">
        <el-table-column
          type="index"
          label="序号"
          align="center"
          width="60"
        />
        <el-table-column

          prop="constructionProjectName"
          label="建设项目名称"
        />
        <el-table-column

          prop="tenderNo"
          label="招标项目编号"
        />
        <el-table-column

          prop="tenderName"
          label="招标项目名称"
        />
      </el-table>
      <!--分页组件-->
      <pagination :pagination-data="paginationData" @change="loadData" />
    </div>
  </div>
</template>

<script>
import { getEntrustContentTenderProjectList } from '@/api/purchasePlan/taskplan'
import { ListMixin } from '@/mixins/ListMixin'
import pagination from '@comp/common/pagination/pagination'
export default {
  name: 'ConsignContractList',
  components: {
    pagination
  },
  mixins: [ListMixin],
  data() {
    return {
      formData: {
        contractName: '', // 委托合同名称
        contractNo: '' // 委托合同编码
      },
      // 招标项目列表
      tableData: []
    }
  },
  created() {
    this.loadData()
  },
  methods: {
    // 返回按钮
    back() {
      this.$router.push({ path: 'consignContractList' })
    },
    // 委托合同获取关联招标项目列表
    loadData() {
      const params = {
        contractId: this.$route.params.id, // 委托合同id
        pageNo: this.paginationData.pageNo,
        pageSize: this.paginationData.pageSize
      }
      getEntrustContentTenderProjectList(params).then(response => {
        this.tableData = response.data.records
        this.paginationData.total = response.data.total
        if (this.tableData.length > 0) {
          this.formData.contractName = this.tableData[0].contractName // 委托合同名称
          this.formData.contractNo = this.tableData[0].contractNo // 委托合同编码
        }
      }).catch(() => {
      })
    }
  }
}
</script>

<style lang="less" scoped>
</style>
