<template>
  <div class="health-6">
    <div class="header-info mg-b-16">
      <div class="selections">
        <div class="item" @click="tabSelect(0)" :class="{ active: tabIndex == 0 }">
          <i class="svg-icon svg-icon-sm">
            <svg-icon :svgid="'svg-wind-site'" />
          </i>
          <span>风场</span>
        </div>
        <div class="item" @click="tabSelect(1)" :class="{ active: tabIndex == 1 }">
          <i class="svg-icon svg-icon-sm">
            <svg-icon :svgid="'svg-h-project'" />
          </i>
          <span>项目</span>
        </div>
      </div>
      <div class="state">
        <div class="state-item green">
          <div class="dot "></div>
          <div class="text">良好数量：</div>
          <div class="value">999</div>
        </div>
        <div class="state-item purple">
          <div class="dot "></div>
          <div class="text">正常数量：</div>
          <div class="value">999</div>
        </div>
        <div class="state-item yellow">
          <div class="dot "></div>
          <div class="text">注意数量：</div>
          <div class="value">999</div>
        </div>
        <div class="state-item orange">
          <div class="dot "></div>
          <div class="text">严重数量：</div>
          <div class="value">999</div>
        </div>
      </div>
    </div>
    <row :type="'flex'" class="mg-b-16">
      <Col :span="8">
        <panel :title="'健康走势图'" :showLine="false">
          <dual-pie-chart :height="'250px'" />
        </panel>
      </Col>
      <Col :span="16">
        <panel :title="'矩阵'" :showLine="false">
          <div class="matrix">
            <div class="item green">1号</div>
            <div class="item purple">2号</div>
            <div class="item orange">3号</div>
            <div class="item" v-for="index of 150" :key="index">{{ index + 3 }}号</div>
            <div class="blank" v-for="index of 30" :key="index"></div>
          </div>
        </panel>
      </Col>
    </row>
    <div class="mg-b-16">
      <panel :title="'健康走势图'" :showLine="false">
        <bar-line-chart :lineData="[]" :height="'250px'" />
      </panel>
    </div>
    <div class="mg-b-16">
      <panel :title="'健康走势图'" :showLine="false">
        <normal-line-chart :height="'250px'" />
      </panel>
    </div>
  </div>
</template>

<script>
import BarLineChart from "../../components/chart/combination/bar-line-chart.vue";
import NormalLineChart from "../../components/chart/line/normal-line-chart.vue";
import DualPieChart from "../../components/chart/pie/dual-pie-chart.vue";
import Col from "../../components/coms/grid/col.vue";
import Row from "../../components/coms/grid/row.vue";
import SvgIcon from "../../components/coms/icon/svg-icon.vue";
import Panel from "../../components/coms/panel/panel.vue";
export default {
  setup() {},
  components: { SvgIcon, Panel, NormalLineChart, BarLineChart, Row, Col, DualPieChart },
  data() {
    return {
      tabIndex: 0,
    };
  },
  methods: {
    tabSelect(state) {
      this.tabIndex = state;
    },
  },
};
</script>

<style lang="less">
.health-6 {
  .header-info {
    display: flex;

    .selections {
      display: flex;
      flex: 0 0 200px;

      .item {
        flex: 0 0 80px;
        text-align: center;
        line-height: 33px;
        margin-right: 8px;
        color: @font-color;
        font-size: @fontsize-s;
        background: fade(@gray, 20);
        border: 1px solid fade(@gray, 20);
        display: flex;
        justify-content: center;
        align-items: center;

        i {
          margin-right: 8px;

          svg use {
            fill: @gray;
          }
        }

        &:hover,
        &.active {
          background: fade(@green, 20);
          border: 1px solid @green;
          color: @green;
          cursor: pointer;

          i svg use {
            fill: @green;
          }
        }
      }
    }

    .state {
      display: flex;

      .state-item {
        display: flex;
        height: 32px;
        align-items: center;

        .dot {
          width: 8px;
          height: 8px;
          margin-right: 8px;
        }

        .text {
          margin-left: 8px;
        }

        .value {
          height: 32px;
          line-height: 32px;
          background: fade(@gray, 20);
          padding: 0 16px;
        }

        &.green {
          .dot {
            background: @green;
          }
        }

        &.purple {
          .dot {
            background: @purple;
          }
        }

        &.yellow {
          .dot {
            background: @yellow;
          }
        }

        &.orange {
          .dot {
            background: @orange;
          }
        }

        & + .state-item {
          margin-left: 16px;
        }
      }
    }
  }

  .matrix {
    display: flex;
    flex-wrap: wrap;

    .item {
      flex: 1 0 calc(100% / 20 - 4px);
      line-height: 26px;
      background: fade(@gray, 20);
      color: @gray-l;
      font-size: 12px;
      margin-bottom: 4px;
      text-align: center;
      border: 1px solid transparent;

      & + .item {
        margin-left: 4px;
      }

      &:nth-child(20n + 1) {
        margin-left: 0px;
      }

      &.green {
        color: @green;
        background: fade(@green, 20);
        border-color: @green;
      }

      &.purple {
        color: @purple;
        background: fade(@purple, 20);
        border-color: @purple;
      }

      &.orange {
        color: @orange;
        background: fade(@orange, 20);
        border-color: @orange;
      }
    }

    .blank {
      flex: 1 0 calc(100% / 20 - 4px);
      margin-left: 4px;
    }
  }
}
</style>
