<template>
  <div class="app-container">
    <div class="chart-container">
      <el-row>
        <div class="chart-title">按分局统计闸井数量</div>
      </el-row>
      <el-row>
        <el-col :span="11" :offset="1">
          <div class="chart-body">
            <ve-pie ref="chartdept" :data="chartData" :settings="chartSettings"/>
          </div>
        </el-col>
        <el-col :span="10" >
          <div class="chart-body" style="margin: 70px 20px">
            <el-table :data="chartData.rows" border show-summary>
              <el-table-column :label="chartSettings.labelMap['pidName']" prop="pidName"/>
              <el-table-column :label="chartSettings.labelMap['wellCount']" prop="wellCount"/>
            </el-table>
          </div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
export default {
  name: 'WellStaticsByDept',
  data() {
    return {
      chartSettings: {
        labelMap: {
          'pidName': '分局',
          'wellCount': '闸井数量'
        }
      },
      chartData: {
        columns: ['pidName', 'wellCount'],
        rows: []
      }
    }
  },
  mounted() {
    this.fetchData()
  },
  methods: {
    fetchData() {
      this.chartData.rows = [
        { 'pidName': '天安门分局', 'wellCount': 343 },
        { 'pidName': '东城分局', 'wellCount': 200 },
        { 'pidName': '西城分局', 'wellCount': 100 }
      ]
      this.$refs.chartdept.echarts.resize()
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  .app-container{
    padding: 5px 10px 10px 10px;
    .chart-container{
      padding:0px;
      border: 1px solid #d3dce6;
      .chart-tools{
        background-color: #f2f2f2;
        line-height: 35px;
        padding-left: 10px;
        padding-right: 5px;
        .chart-tool-button{
          padding: 5px;
          line-height: 16px;
          margin-top:5px;
          font-size:13px;
        }
        .chart-tool-button:hover{
          background-color: #8cc5ff;
          cursor: pointer;
          color:white
        }
        .chart-tool-button:active{
          background-color: #8cc5ff;
          color:white
        }
        .editor--datetimerange.el-input__inner{
          width: 300px;
        }
      }

      .chart-body{
        padding:15px;
        margin-top: 20px;
      }
    }
  }
  .chart-title{
    margin: auto;
    text-align: center;
    margin-top: 15px;
    font-size: 20px;
    line-height: 30px;
  }
</style>

