<!--
  @description: 投标人基本情况列表
  @Modifier: ht
  @date: 2020-7-17-10:57
-->
<template>
    <div>
        <!--标题-->
        <div class="title title_border p0-16">
            <i class="el-icon-s-home" />
            投标人列表
        </div>
        <section class="p0-16">
            <!--查询条件-->
            <div class="crud_menu_title clearfix">
                <span class="icon-line fl">查询条件</span>
            </div>
            <div class="clearfix SearchContent">
                <div class="SearchContent_leftInput fl">
                    <el-form
                            ref="searchForm"
                            :model="searchForm"
                            inline
                            label-position="right"
                    >
                        <el-form-item ref="companyName" label="公司名称" prop="companyName">
                            <el-input v-model.trim="searchForm.companyName" placeholder="公司名称" width="228px" />
                        </el-form-item>
                        <el-form-item ref="legalRepresentativeName" label="法定代表人姓名" prop="legalRepresentativeName">
                            <el-input v-model.trim="searchForm.legalRepresentativeName" placeholder="法定代表人姓名" width="228px" />
                        </el-form-item>
                        <el-form-item ref="setupTime" label="成立时间" prop="setupTime">
                            <el-input v-model.trim="searchForm.setupTime" placeholder="成立时间" width="228px" />
                        </el-form-item>
                        <el-form-item ref="enterpriseNature" label="企业性质" prop="enterpriseNature">
                            <el-input v-model.trim="searchForm.enterpriseNature" placeholder="企业性质" width="228px" />
                        </el-form-item>
                    </el-form>
                </div>
                <div class="fr">
                    <el-button type="primary" @click="onSearch">
                        搜 索
                    </el-button>
                    <el-button plain type="info" @click="resetForm('searchForm')">
                        重 置
                    </el-button>
                </div>
            </div>
            <!--查询结果-->
            <div class="crud_menu_title">
                <span class="icon-line">查询结果</span>
            </div>
            <div>
                <el-table
                        ref="smallTable"
                        v-loading="loading"
                        :data="tableData"
                >
                    <el-table-column
                            type="index"
                            label="序号"
                            width="60px"
                            align="center"
                    />
                    <el-table-column
                            prop="companyName"
                            align="center"
                            label="公司名称"
                            min-width="300"
                    />
                    <el-table-column
                            header-align="center"
                            prop="legalRepresentativeName"
                            label="法定代表人姓名"
                            width="180"
                    />
                    <el-table-column
                            label="成立时间"
                            prop="setupTime"
                            align="center"
                            min-width="200"
                    />
                    <el-table-column
                            header-align="enterpriseNature"
                            label="企业性质"
                            prop="enterpriseNature"
                            align="center"
                            width="100"
                    >
                    </el-table-column>
                    <el-table-column
                            header-align="center"
                            label="操作"
                            width="640"
                    >
                        <template slot-scope="scope">
                            <el-link
                                    type="primary"
                                    @click="examineBulletin(scope.row)"
                            >
                                [查看公司详情]
                            </el-link>
                            <el-link
                                    type="primary"
                                    @click="viewAchievementList(scope.row)"
                            >
                                [查看业绩详情]
                            </el-link>
                            <el-link
                                    type="primary"
                                    @click="viewBusinessLicenseList(scope.row)"
                            >
                                [查看营业执照详情]
                            </el-link>
                            <el-link
                                    type="primary"
                                    @click="viewCertificateAllList(scope.row)"
                            >
                                [查看证书详情]
                            </el-link>
                            <el-link
                                    type="primary"
                                    @click="viewFinancialReportsList(scope.row)"
                            >
                                [查看财务报告详情]
                            </el-link>
                            <el-link
                                    type="primary"
                                    @click="viewPeopleAllList(scope.row)"
                            >
                                [查看项目负责人详情]
                            </el-link>
                        </template>
                    </el-table-column>
                </el-table>
                <!--分页组件-->
                <pagination :pagination-data="paginationData" @change="loadData" />
            </div>
        </section>
    </div>
</template>

<script>
/* 接口*/
import { bidderInfoAllList } from '@/api/bidding/bidderRepresentative'// 公告列表
/* 公用方法*/
import { filterObj } from '@/assets/js/utils'// 常用方法
/* 混合开发方法-参数字段*/
import { ListMixin } from '@/mixins/ListMixin'// 分页
/* 组件*/
import pagination from '@comp/common/pagination/pagination'// 分页
import achievemenyInfo from './achievement-info'
export default {
  name: 'BidderInfoList',
  components: {
    pagination, // 分页
    achievemenyInfo
  },
  mixins: [ListMixin],
  data() {
    return {
      loading: false,
      // 搜索
      searchForm: {
        companyName: '', // 公司名称
        legalRepresentativeName: '', // 法定代表人姓名
        setupTime: '', // 成立时间
        enterpriseNature: '' // 企业性质
      },
      tableData: []
    }
  },
  watch: {
    $route() {
      this.resetForm('searchForm')
    }
  },
  created() {
    // 获取列表信息
    this.loadData()
  },
  methods: {
    // 获取数据
    loadData() {
      this.loading = true
      const params = this.getQueryParams()// 查询条件
      bidderInfoAllList(params).then(response => {
        this.loading = false
        this.tableData = response.data.records
        this.paginationData.total = response.data.total
        this.$forceUpdate()
      }).catch(() => {
        this.loading = false
      })
    },
    // 查询条件
    getQueryParams() {
      const param = Object.assign({}, this.searchForm)
      param.pageNo = this.paginationData.pageNo
      param.pageSize = this.paginationData.pageSize
      return filterObj(param)
    },
    // 查看公司详情
    examineBulletin(row) {
      this.$router.push({
        path: '/bidderRepresentative/bidderInfo',
        query: {
          id: row.id
        }
      })
    },
    // 查看业绩详情
    viewAchievementList(row) {
      this.$router.push({
        path: '/bidderRepresentative/achievementList',
        query: {
          companName: row.companName,
          companId: row.companId
        }
      })
    },
    // 查看营业执照详情
    viewBusinessLicenseList(row) {
      this.$router.push({
        path: '/bidderRepresentative/businessLicenseList',
        query: {
          companName: row.companName,
          companId: row.companId
        }
      })
    },
    // 查看证书详情
    viewCertificateAllList(row) {
      this.$router.push({
        path: '/bidderRepresentative/certificateList',
        query: {
          companName: row.companName,
          companId: row.companId
        }
      })
    },
    // 查看财务报告详情
    viewFinancialReportsList(row) {
      this.$router.push({
        path: '/bidderRepresentative/financialReportsList',
        query: {
          companName: row.companName,
          companId: row.companId
        }
      })
    },
    // 查看项目负责人详情
    viewPeopleAllList(row) {
      this.$router.push({
        path: '/bidderRepresentative/peopleList',
        query: {
          companName: row.companName,
          companId: row.companId
        }
      })
    },
    // 搜索
    onSearch() {
      this.paginationData.pageNo = 1
      this.paginationData.pageSize = 10
      this.loadData()
    },
    // 重置
    resetForm(formName) {
      this.$refs[formName].resetFields()
      this.onSearch()
    }
  }
}
</script>

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