<!--
  @description: 报表统计-供应商供货范围TOP
  @Modifier：肖文龙
  @routerPath:
  @date：  2021/01/29
-->
<template>
  <!-- :style="{'height':height}" -->
  <dl
    class="reportChart_crud"
  >
    <dt>
      在库供应商供货范围
    </dt>
    <dd>
      <tableChart
        :height="height"
        class="echart-dom"
        :option="option"
      />
    </dd>
    <!-- 报表统计-供应商供货范围TOP-更多弹框 -->
    <supplierSupplyScopeList ref="moreSupplyList" />
  </dl>
</template>

<script>
/* api */
import { getSupplyRangeSupplierList } from '@api/statisticalAnalysis/reportChart.js'
/* 組件 */
import tableChart from './../../components/tableChart'// table列表渲染组件
import supplierSupplyScopeList from './supplierSupplyScopeList-dialog' // 报表统计-供应商供货范围TOP-更多弹框

export default {
  name: 'SupplierSupplyScopeTOP',
  components: {
    tableChart, // table列表渲染组件
    supplierSupplyScopeList // 报表统计-供应商供货范围TOP-更多弹框

  },
  props: {
    height: {
      type: String,
      default: '100%'
    }
  },
  data() {
    return {
      // 查询条件
      searchData: {
      },
      option: {
        // 底部-操作类
        footer: [
          {
            text: '更多',
            click: this.more
          }
        ],
        // 标题
        thead: [
          { lable: '供货范围', prop: 'supplyRange', align: 'left' },
          { lable: '供应商数量（个）', prop: 'supplierNumbers', align: 'center', width: 120 }
        ],
        // 渲染数据
        data: []
      }
    }
  },
  methods: {
    /**
     * 获取数据
     *  @param {searchData} Object 查询条件
    */
    initChart(searchData) {
      this.option.data = []
      const data = {
        ...searchData
      }
      getSupplyRangeSupplierList(data).then(res => {
        this.option.data.push(...res.data.records)
      })
    },
    // 查看
    detail() {

    },
    // 更多
    more() {
      this.$refs.moreSupplyList.open(this.searchData)
    }
  }
}
</script>
<style lang="less" scoped>
</style>
