// 今日人员/车辆行为数据
<template>
  <div class="main" style="height: 636px">
    <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: 100%; height: 70%">
        <div
          ref="barEcharts"
          :id="id"
          :style="{ width: '100%', height: '100%' }"
        ></div>
        <div class="echarts-num">
          <span>102196</span>
          <span>条</span>
        </div>
      </div>
      <div class="container-bottom">
        <div class="container-bottom-item">
          <div class="img-ryzkjls">
            <img src="../../../assets/ryzkjls.png" alt="" />
          </div>
          <div class="item-info">
            <div>人员闸口记录数</div>
            <div class="item-info-num">28624</div>
          </div>
        </div>
        <div class="container-bottom-item">
          <div class="img-ryzkjls">
            <img src="../../../assets/rysxtzpjls.png" alt="" />
          </div>
          <div class="item-info">
            <div>人员摄像头抓拍记录数</div>
            <div class="item-info-num">28624</div>
          </div>
        </div>
        <div class="container-bottom-item">
          <div class="img-ryzkjls">
            <img src="../../../assets/ryjcgjls.png" alt="" />
          </div>
          <div class="item-info">
            <div>人员进出港记录数</div>
            <div class="item-info-num">28624</div>
          </div>
        </div>
        <div class="container-bottom-item">
          <div class="img-ryzkjls">
            <img src="../../../assets/clkkjls.png" alt="" />
          </div>
          <div class="item-info">
            <div>车辆卡口记录数</div>
            <div class="item-info-num">28624</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: "pieEchartsJrryclxwsj",
      chart: null,
    };
  },
  methods: {
    drawBar() {
      this.chart = this.$echarts.init(document.getElementById(this.id));
      this.chart.setOption({
        // grid: {
        //   top: 70,
        //   bottom: 70,
        //   left: 60,
        //   right: 30,
        // },
        title: {
          zlevel: 0, //设置层级比鼠标移入显示的层低
          text: "今日人员/车辆总数据",
          left: "27%",
          top: "38%",
          textAling: "center",
          // 样式
          textStyle: {
            color: "#E3E8FF",
            fontWeight: 500,
            fontSize: 20,
            lineHeight: 30,
          },
        },
        legend: {
          type: "scroll",
          // orient: "vertical",
          show: true,
          bottom: 0,
          textStyle: {
            color: "#E3E8FF80",
            fontSize: 15,
          },
        },
        series: [
          {
            // name: this.legend[0],
            // data: this.yAxisData,
            data: [
              { value: 48, name: "车辆行为记录数据" },
              { value: 100, name: "人员行为记录数据" },
            ],
            type: "pie",
            radius: ["65%", "78%"],
            color: ["#3243DD", "#ED9D63"],
            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;
  margin: 20px;
}
.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;
  }
}
.container {
  position: relative;
  width: 100%;
  height: 86%;
  .echarts-num {
    // margin-top: -160px;
    margin-top: -39%;
    font-size: 40px;
    font-weight: 900;
    line-height: 60px;
    text-align: center;
    color: #fff;
    span {
      &:last-child {
        margin-left: 5px;
        font-size: 22px;
        font-weight: 500;
        line-height: 33px;
      }
    }
  }
  .container-bottom {
    display: flex;
    align-items: center;
    // justify-content: space-between;
    flex-wrap: wrap;
    padding: 0 20px;
    margin-top: 40px;
    .container-bottom-item {
      width: calc(100% / 2);
      display: flex;
      align-items: center;
      // margin-right: 0px;
      margin-bottom: 20px;
      // &:nth-child(2n) {
      //   margin-right: 0;
      // }
      .img-ryzkjls {
        width: 46px;
        height: 40px;
        img {
          width: 100%;
          height: 100%;
          object-fit: cover;
        }
      }
      .item-info {
        margin-left: 10px;
        font-size: 14px;
        font-weight: 500;
        line-height: 21px;
        text-align: left;
        color: #e3e8ffcc;
        .item-info-num {
          font-size: 24px;
          font-weight: 700;
          line-height: 36px;
          color: #fff;
        }
      }
    }
  }
}
</style>
