<template>
  <div class="txtSize">
    <div class="title">
      <span>部门业绩</span>
      <span style="width: 80px" class="mouth">
        <el-select v-model="region" size="mini">
          <el-option label="本月" value="1"></el-option>
          <el-option label="本年" value="2"></el-option>
        </el-select>
      </span>
    </div>
    <!-- <div id="topCenter" style="width: auto; height: 400px"></div> -->
    <Echart
      :options="options"
      id="topCenter"
      height="350px"
      width="100%"
    ></Echart>
  </div>
</template>

<script>
import Echart from "@/common/echart";

export default {
  components: {
    Echart,
  },
  data() {
    return {
      
      region: "1",
      options: {
        label: {
          show: true,
          position: "inside",
          formatter: function (params) {
            return params.value + "%";
          },
        },
        tooltip: {
          trigger: "axis",
        },
        xAxis: {
          // splitLine: {
          //   show: true,
          // },
          data: ["网络部", "客服部", "项目部", "平台部"],

          type: "category",
        },

        yAxis: {
            // splitLine: {
            //   show: false,
            // },
          type: "value",
        },

        series: [
          {
            name: "可用",

            type: "bar",

            stack: "使用情况",

            data: [5, 20, 36, 10],

            itemStyle: {
              normal: { color: "#19BE6B" },
            },

            barWidth: 30, //柱图宽度
          },
          {
            name: "不可用",

            type: "bar",

            stack: "使用情况",

            data: [90, 22, 18, 35],

            itemStyle: {
              normal: { color: "#2D8CF0" },
            },

            barWidth: 30, //柱图宽度
          },
        ],
      },
    };
  },
  mounted() {
    // this.cinit();
  },
  methods: {
    cinit() {
      this.$echarts.init(document.getElementById("topCenter")).setOption(
        this.options
       );
    },
  },
};
</script>

<style lang="scss" scoped>
.txtSize {
  // font-size: 0px;
  
}
.title {
  font-size: 18px;
  margin: 20px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#topCenter {
  width: 100%;
  height: 350px;
  top: -40px;
  // z-index: 0;
}
.mouth{
  position: relative;
  z-index: 90;
}
</style>