<!--
  @description:查询评标结果统计
  @Modifier: haofengxian
  @routerPath:/statisticalAnalysis/statisticsBidEvaluationResultsList
  @date: 2020-7-14-16:30
-->
<template>
  <table-crud
    :menu="true"
    :search-form="searchForm"
    search-label-width="110px"
    @on-load="loadData"
  >
    <template v-slot:header>
      查询评标结果统计分析信息
    </template>
    <template v-slot:search="search">
      <el-form-item ref="tenderNo" label="招标项目编号" prop="tenderNo">
        <el-input
          v-model.trim="searchForm.tenderNo"
          placeholder="招标项目编号"
          style="width:220px"
          @keyup.enter.native="search.onSearch"
        />
      </el-form-item>
      <el-form-item ref="tenderName" label="招标项目名称" prop="tenderName">
        <el-input
          v-model.trim="searchForm.tenderName"
          style="width:220px"
          placeholder="招标项目名称"
          @keyup.enter.native="search.onSearch"
        />
      </el-form-item>
      <el-form-item ref="packName" label="标段（包）名称" prop="packName">
        <el-input
          v-model.trim="searchForm.packName"
          style="width:220px"
          placeholder="标段（包）名称"
          @keyup.enter.native="search.onSearch"
        />
      </el-form-item>
      <el-form-item ref="packNo" label="标段（包）编号" prop="packNo">
        <el-input
          v-model.trim="searchForm.packNo"
          style="width:220px"
          placeholder="标段（包）编号"
          @keyup.enter.native="search.onSearch"
        />
      </el-form-item>
    </template>
    <template slot="menuLeft">
      <div class="mb10">
        <el-button type="primary" @click="derivedRecord">
          导出记录
        </el-button>
      </div>
    </template>
    <template v-slot:GXTable>
      <el-table
        ref="smallTable"
        v-loading="loading"
        :data="tableData"
      >
        <el-table-column
          type="index"
          label="序号"
          width="60px"
          align="center"
        />
        <el-table-column
          prop="tenderNo"
          align="center"
          label="招标项目编号"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="packName"
          label="标段（包）名称"
          min-width="230"
        />
        <el-table-column
          prop="packNo"
          align="center"
          label="标段（包）编号"
          width="170"
        />
        <el-table-column
          header-align="center"
          prop="tenderName"
          label="招标项目名称"
          min-width="230"
        />
        <el-table-column
          header-align="center"
          label="创建时间"
          width="130"
        >
          <template slot-scope="scope">
            {{ scope.row.crateTime && $Moment(scope.row.crateTime).format(momentDateTime) }}
          </template>
        </el-table-column>
        <el-table-column
          header-align="center"
          label="操作"
          width="130"
          align="center"
        >
          <template slot-scope="scope">
            <el-link
              type="primary"
              @click.stop="examine(scope.row)"
            >
              [评标结果统计分析]
            </el-link>
          </template>
        </el-table-column>
      </el-table>
    </template>
  </table-crud>
</template>
<script>
/* 接口*/
import { queryEvaluationResultPage } from '@api/statisticalAnalysis'
import { exportInvoiceList } from '@api/fee/docfee'
/* 公用方法*/
import { download } from '@/assets/js/utils'// 常用方法

export default {
  name: 'TenderProjectList',
  data() {
    return {
      loading: true,
      winningTime: '', // 中标日期
      // 搜索
      searchForm: {
        packName: '', // 标段名称
        packNo: '', // 标段(包)编号
        tenderName: '', // 项目名称
        tenderNo: '' // 项目编号
      },
      tableData: []
    }
  },
  methods: {
    // 导出记录
    derivedRecord() {

    },
    // 导出记录Excel
    exportExcel(feeDocIds) {
      const params = {
        feeDocIds
      }
      exportInvoiceList(params).then(res => {
        download(res, '开票记录.xls')
      }).catch(() => {
      })
    },
    // 获取数据
    loadData(params, callback) {
      queryEvaluationResultPage(params).then(response => {
        this.loading = false
        this.tableData = response.data.records
        callback(response.data.total)
      }).catch(() => {
        this.loading = false
      })
    },
    // 查看
    examine(row) {
      this.$router.push({
        path: '/statisticalAnalysis/statisticsBidEvaluationResultsDetail',
        query: {
          packId: row.packId
        }
      })
    },
    // 处理搜索时间格式
    handleCreateTime(val) {
      if (val) {
        this.searchForm.winningStartTime = this.$Moment(val[0]).format(this.momentDate)// 开始时间
        this.searchForm.winningEndTime = this.$Moment(val[1]).format(this.momentDate)// 结束时间
      }
    }
  }
}
</script>
<style lang="less" scoped>

</style>
