<!--
  @description: 报表统计-中标次数TOP
  @Modifier：肖文龙
  @routerPath:
  @date：  2021/01/29
-->
<template>
  <!-- :style="{'height':height}" -->
  <dl
    class="reportChart_crud"
  >
    <dt>
      本年中标次数TOP
    </dt>
    <dd>
      <tableChart
        :height="height"
        class="echart-dom"
        :option="option"
      />
      <!-- 报表统计-供应商统计-供应商投标项目详情 -->
      <supplierTenderDetail ref="tenderDetailOpt" />
      <!-- 报表统计-供应商统计-中标次数TOP-更多弹框 -->
      <supplierWinBIdNumberList ref="moreList" />
    </dd>
  </dl>
</template>

<script>
/* api */
import { getWinningTimesSupplierList } from '@api/statisticalAnalysis/reportChart.js'
/* 組件 */
import tableChart from './../../components/tableChart'// table列表渲染组件
import supplierTenderDetail from './../supplierWinBIdMoney/supplierTenderDetail-dialog.vue' // 报表统计-供应商统计-供应商投标项目详情
import supplierWinBIdNumberList from './supplierWinBIdNumberList-dialog.vue' // 报表统计-中标次数TOP-更多弹框

export default {
  name: 'SupplierWinBIdNumberTOP',
  components: {
    tableChart, // table列表渲染组件
    supplierTenderDetail, // 报表统计-供应商统计-供应商投标项目详情
    supplierWinBIdNumberList // 报表统计-中标次数TOP-更多弹框

  },
  props: {
    height: {
      type: String,
      default: '100%'
    }
  },
  data() {
    return {
      // 查询条件
      searchData: {
      },
      option: {
        // 底部-操作类
        footer: [
          {
            text: '更多',
            click: this.more
          }
        ],
        // 标题
        thead: [
          { lable: '供应商名称', prop: 'supplierName', align: 'left' },
          { lable: '中标次数（次）', prop: 'winningTimes', align: 'center' },
          { lable: '详情',
            // 操作类
            handle: [
              {
                text: '查看',
                click: this.detail
              }
            ] }
        ],
        // 渲染数据
        data: []
      }
    }
  },
  methods: {
    /**
     * 获取数据
     *  @param {searchData} Object 查询条件
    */
    initChart(searchData) {
      this.option.data = []
      if (searchData) {
        this.searchData = {
          ...this.searchData,
          ...searchData
        }
      }
      const data = {
        ...this.searchData
      }
      getWinningTimesSupplierList(data).then(res => {
        this.option.data.push(...res.data.records)
      })
    },
    // 查看
    detail(row) {
      this.$refs.tenderDetailOpt.open(row.row, this.searchData)
    },
    // 更多
    more() {
      this.$refs.moreList.open(this.searchData)
    }
  }
}
</script>
<style lang="less" scoped>
</style>
