<!--
  @description: 报表统计-中标金额TOP
  @Modifier：肖文龙
  @routerPath:
  @date：  2021/01/29
-->
<template>
  <!-- :style="{'height':height}" -->
  <dl
    class="reportChart_crud"
  >
    <dt>
      本年中标金额TOP
    </dt>
    <dd>
      <tableChart
        :height="dd_height"
        class="echart-dom"
        :option="option"
      />

      <!-- 报表统计-供应商统计-供应商投标项目详情 -->
      <supplierTenderDetail ref="tenderDetail" />
      <!-- 报表统计-供应商统计-中标金额TOP-更多弹框 -->
      <supplierWinBIdMoneyList ref="moreList" />
    </dd>
  </dl>
</template>

<script>
/* api */
import { getWinningAmountSupplierList } from '@api/statisticalAnalysis/reportChart.js'
/* 組件 */
import tableChart from './../../components/tableChart'// table列表渲染组件
import supplierTenderDetail from './supplierTenderDetail-dialog.vue' // 报表统计-供应商统计-供应商投标项目详情
import supplierWinBIdMoneyList from './supplierWinBIdMoneyList-dialog.vue' // 报表统计-中标金额TOP-更多弹框
export default {
  name: 'SupplierWinBIdMoneyTOP',
  components: {
    tableChart, // table列表渲染组件
    supplierTenderDetail, // 报表统计-供应商统计-供应商投标项目详情
    supplierWinBIdMoneyList// 报表统计-供应商统计-供应商投标项目详情
  },
  props: {
    height: {
      type: String,
      default: '100%'
    }
  },
  data() {
    return {
      // - 2.5rem
      dd_height: 'calc(' + this.height + ')', // 内容的高度
      // 查询条件
      searchData: {
      },
      option: {
        // 底部-操作类
        footer: [
          {
            text: '更多',
            click: this.more
          }
        ],
        // 标题
        thead: [
          { lable: '供应商名称', prop: 'supplierName', align: 'left' },
          { lable: '中标金额（万元）', prop: 'winningAmount', 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
      }
      getWinningAmountSupplierList(data).then(res => {
        this.option.data.push(...res.data.records)
      })
    },
    // 更多
    more() {
      this.$refs.moreList.open(this.searchData)
    },
    // 查看
    detail(row) {
      this.$refs.tenderDetail.open(row.row, this.searchData)
    }
  }
}
</script>
<style lang="less" scoped>
</style>
