<!--
  @description: 采购人/代理机构-建设项目-关联招标项目-列表
  @author: 肖文龙/孙新满
  @routerPath:/buildingProject/buildingProjectCorrelationList
  @date：2019-11-28 15:21:25
-->
<template>
  <div class="p0-16">
    <section class="title">
      <i class="iconfont icon-fanhui pointer" @click="back" />
      关联招标项目
    </section>
    <table class="tableData">
      <tr>
        <td>建设项目编码</td>
        <td>{{ formData.projectNo }}</td>
        <td>建设项目名称</td>
        <td>{{ formData.projectName }}</td>
      </tr>
    </table>
    <section style="margin-top:10px">
      <el-table
        ref="smallTable"
        v-loading="loading"
        :data="tableData"
      >
        <el-table-column
          type="index"
          label="序号"
          align="center"
          width="60"
        />
        <el-table-column

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

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

<script>
/* api接口*/
import { getBuildingProjectTenderProjectList } from '@/api/purchasePlan/taskplan'
/* 公共方法*/
import { ListMixin } from '@/mixins/ListMixin'
/* 分页组件*/
import pagination from '@comp/common/pagination/pagination'
export default {
  name: 'BuildingProjectCorrelationList',
  components: {
    pagination
  },
  mixins: [ListMixin],
  data() {
    return {
      loading: true,
      formData: {
        projectNo: '', // 建设项目编码
        projectName: ''// 建设项目名称
      },
      tableData: []
    }
  },
  created() {
    this.paginationData.constructionProjectId = this.$route.params.id
    this.loadData(this.paginationData)
  },
  methods: {
    // 返回按钮
    back() {
      this.$router.push({ path: '/buildingProject/buildingProjectList' })
    },
    // 获取数据
    loadData(params) {
      getBuildingProjectTenderProjectList(params).then(response => {
        this.loading = false
        this.tableData = response.data.records
        this.formData.projectNo = this.tableData[0].projectNo // 建设项目编码
        this.formData.projectName = this.tableData[0].projectName // 建设项目名称
        this.paginationData.total = response.data.total
      }).catch(() => {
        this.loading = false
      })
    }
  }
}
</script>

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