// 本月各预警等级预警情况
<template>
  <div class="main">
    <div class="mian-contain">
      <div class="top">
        <div class="top-tit">
          <img src="../../../assets/arrow.png" alt="" />
          <span>本月各预警等级预警情况</span>
        </div>
        <div class="top-line">
          <img src="../../../assets/top-line.png" alt="" />
        </div>
      </div>
      <div class="container">
        <div style="width: 50%; height: 86%">
          <div
            ref="barEcharts"
            :id="id"
            :style="{ width: '100%', height: '100%' }"
          ></div>
        </div>
        <div>
          <div class="lable-right">
            <div class="lable-right-top">
              <span></span>
              <span>Ⅰ级预警</span>
              <div class="lable-right-top-data">
                <i class="el-icon-caret-top"></i>
                <div>月同比+1.5%</div>
              </div>
            </div>
            <div class="lable-right-num">16</div>
          </div>
          <div class="lable-right">
            <div class="lable-right-top">
              <span style="background-color: #aaed75"></span>
              <span>Ⅱ级预警</span>
              <div class="lable-right-top-data">
                <i class="el-icon-caret-top"></i>
                <div>月同比+1.5%</div>
              </div>
            </div>
            <div class="lable-right-num">16</div>
          </div>
          <div class="lable-right">
            <div class="lable-right-top">
              <span style="background-color: #5cd8ff"></span>
              <span>Ⅲ级预警</span>
              <div class="lable-right-top-data" style="color: #5bffeb">
                <i class="el-icon-caret-bottom"></i>
                <div>月同比-1.5%</div>
              </div>
            </div>
            <div class="lable-right-num">16</div>
          </div>
          <div class="lable-right">
            <div class="lable-right-top">
              <span style="background-color: #2e8cfb"></span>
              <span>Ⅳ级预警</span>
              <div class="lable-right-top-data">
                <i class="el-icon-caret-top"></i>
                <div>月同比+1.5%</div>
              </div>
            </div>
            <div class="lable-right-num">16</div>
          </div>
          <div class="lable-right">
            <div class="lable-right-top">
              <span style="background-color: #3a64f7"></span>
              <span>Ⅴ级预警</span>
              <div class="lable-right-top-data">
                <i class="el-icon-caret-top"></i>
                <div>月同比+1.5%</div>
              </div>
            </div>
            <div class="lable-right-num">16</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
// import resize from "./mixins/resize";
export default {
  // mixins: [resize],
  props: {
    type: {
      type: String,
      default: "",
    },
    legend: {
      type: Array,
      default() {
        return [];
      },
    },
    // title: {
    //   type: String,
    //   default: ''
    // },
    xAxisData: {
      type: Array,
      default() {
        return [];
      },
    },
    yAxisData: {
      type: Array,
      default() {
        return [];
      },
    },
    colorList: {
      type: Array,
      default() {
        return ["#88aefe", "#4983fb"];
      },
    },
  },
  data() {
    return {
      id: "barEcharts",
      chart: null,
    };
  },
  methods: {
    drawBar() {
      this.chart = this.$echarts.init(document.getElementById(this.id));
      this.chart.setOption({
        series: [
          {
            // name: this.legend[0],
            // data: this.yAxisData,
            data: [
              { value: 100, name: "Ⅰ级预警" },
              { value: 48, name: "Ⅱ级预警" },
              { value: 98, name: "Ⅲ级预警" },
              { value: 73, name: "Ⅳ级预警" },
              { value: 92, name: "Ⅴ级预警" },
            ],
            type: "pie",
            radius: ["45%", "65%"],
            // roseType: "radius",
            color: ["#ED9D63", "#AAED75", "#5CD8FF", "#2E8CFB", "#3A64F7"],
            label: {
              show: false,
            },
          },
        ],
      });
    },
  },
  watch: {
    yAxisData() {
      // console.log(this.findingsData);
      // console.log(this.type);
      this.drawBar();
    },
  },
  mounted() {
    this.drawBar();
  },
};
</script>

<style lang="scss" scoped>
.main {
  width: 455px;
  height: 308px;
  border-radius: 8px;
  // background: rgba(26, 52, 125, 0.95);
  padding: 10px;
}
.top {
  height: 45px;
  .top-tit {
    font-size: 18px;
    font-weight: 600;
    line-height: 23.4px;
    text-align: left;
    color: #ffffff;
    img {
      margin-right: 10px;
    }
  }
  .top-line {
    margin-top: -7px;
  }
}
.mian-contain {
  border-radius: 8px;
  padding: 10px;
  background: rgba(29, 65, 171);
  // overflow: hidden;
  height: 100%;
}
.container {
  display: flex;
  width: 100%;
  height: 86%;
  .lable-right {
    .lable-right-top {
      display: flex;
      align-items: center;
      span {
        font-size: 14px;
        font-weight: 500;
        line-height: 21px;
        color: #e3e8ffcc;
        &:first-child {
          width: 10px;
          height: 10px;
          border-radius: 23px;
          background-color: #ed9d63;
          margin-right: 10px;
        }
      }
      .lable-right-top-data {
        display: flex;
        align-items: center;
        margin-left: 20px;
        font-size: 11px;
        font-weight: 400;
        line-height: 16.5px;
        color: #ff8c85;
        div {
          margin-left: 5px;
        }
      }
    }
    .lable-right-num {
      margin-left: 20px;
      font-size: 18px;
      font-weight: 900;
      line-height: 27px;
      color: #ebefff;
    }
  }
}
</style>
