<template>
  <div class="home">
    <Row type="flex">
      <Col :span="6">
        <Row type="flex">
          <Col :span="24">
            <com-panel
              title="银川"
              sub-title="AM 10:52 实况"
              icon="fa fa-map-marker"
            >
              <weather />
            </com-panel>
          </Col>
        </Row>
        <Row type="flex">
          <Col :span="24">
            <com-panel title="预测电量" sub-title="（单位：万KWh）">
              <list-bar-chart :list="ForecastPower" height="16.6667vh" />
            </com-panel>
          </Col>
        </Row>
        <Row type="flex">
          <Col :span="24">
            <com-panel title="功率复核" sub-title="（单位：万KW）">
              <power-review />
            </com-panel>
          </Col>
        </Row>
      </Col>
      <Col :span="12">
        <Map></Map>
      </Col>
      <Col :span="6">
        <Row type="flex">
          <Col :span="24">
            <com-panel title="电量分析" sub-title="（单位：万KWh）">
              <coulometric-analysis />
            </com-panel>
          </Col>
        </Row>
        <Row type="flex">
          <Col :span="24">
            <com-panel title="计划电量完成情况" sub-title="（单位：万KWh）">
              <power-plan />
            </com-panel>
          </Col>
        </Row>
      </Col>
    </Row>
    <Row type="flex">
      <Col :span="12">
        <toolbar-panel title="日发电量">
          <template v-slot:tools>
            <div class="tools">
              <div class="tool-block">
                <div class="legend bg-green"></div>
                <div class="legend-text">日发电量(单位:万KWh)</div>
              </div>
              <div class="tool-block">
                <div class="legend bg-purple"></div>
                <div class="legend-text">上网电量（单位：万KWh）</div>
              </div>
              <div class="tool-block">
                <div class="legend bg-orange"></div>
                <div class="legend-text">购网电量（单位：万KWh）</div>
              </div>
              <div class="tool-block">
                <div class="legend bg-yellow"></div>
                <div class="legend-text">风速</div>
              </div>
            </div>
          </template>
          <template v-slot:default>
            <!-- 日发电量 -->
            <multiple-bar-chart
              :list="DayPower.value"
              :units="DayPower.units"
              height="12.963vh"
            />
          </template>
        </toolbar-panel>
      </Col>
      <Col :span="12">
        <toolbar-panel title="72小时功率趋势图">
          <template v-slot:tools>
            <div class="tools">
              <div class="tools">
                <div class="tool-block">
                  <div class="legend long bg-green"></div>
                  <div class="legend-text">平均风速</div>
                </div>
                <div class="tool-block">
                  <div class="legend long bg-yellow"></div>
                  <div class="legend-text">应发功率</div>
                </div>
                <div class="tool-block">
                  <div class="legend long bg-purple"></div>
                  <div class="legend-text">实际功率</div>
                </div>
              </div>
            </div>
          </template>
          <template v-slot:default>
            <multiple-line-chart
              :list="Powertrend.value"
              :units="Powertrend.units"
              height="12.963vh"
            />
          </template>
        </toolbar-panel>
      </Col>
    </Row>
    <Row type="flex">
      <!-- 下方 table -->
      <Col :span="16">
        <row>
          <Col>
            <com-panel>
              <table class="table-card">
                <tr class="">
                  <td class="text gray">装机容量</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray">MW</td>
                </tr>
                <tr class="">
                  <td class="text gray">上网电量(日)</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray">MW</td>
                </tr>
                <tr class="">
                  <td class="text gray">减排二氧化硫</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray">MW</td>
                </tr>
                <tr class="">
                  <td class="text gray">减排二氧化碳</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray gray">MW</td>
                </tr>
                <tr class="">
                  <td class="text gray">节约用水</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray">MW</td>
                </tr>
                <tr class="">
                  <td class="text gray">节约用煤</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray">MW</td>
                </tr>
              </table>
            </com-panel>
          </Col>
          <Col>
            <com-panel>
              <table class="table-card">
                <tr class="">
                  <td class="text gray">装机容量</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray">MW</td>
                </tr>
                <tr class="">
                  <td class="text gray">上网电量(日)</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray">MW</td>
                </tr>
                <tr class="">
                  <td class="text gray">减排二氧化硫</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray">MW</td>
                </tr>
                <tr class="">
                  <td class="text gray">减排二氧化碳</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray gray">MW</td>
                </tr>
                <tr class="">
                  <td class="text gray">节约用水</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray">MW</td>
                </tr>
                <tr class="">
                  <td class="text gray">节约用煤</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray">MW</td>
                </tr>
              </table>
            </com-panel>
          </Col>
          <Col>
            <com-panel>
              <table class="table-card">
                <tr class="">
                  <td class="text gray">装机容量</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray">MW</td>
                </tr>
                <tr class="">
                  <td class="text gray">上网电量(日)</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray">MW</td>
                </tr>
                <tr class="">
                  <td class="text gray">减排二氧化硫</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray">MW</td>
                </tr>
                <tr class="">
                  <td class="text gray">减排二氧化碳</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray gray">MW</td>
                </tr>
                <tr class="">
                  <td class="text gray">节约用水</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray">MW</td>
                </tr>
                <tr class="">
                  <td class="text gray">节约用煤</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray">MW</td>
                </tr>
              </table>
            </com-panel>
          </Col>
          <Col>
            <com-panel>
              <table class="table-card">
                <tr class="">
                  <td class="text gray">装机容量</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray">MW</td>
                </tr>
                <tr class="">
                  <td class="text gray">上网电量(日)</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray">MW</td>
                </tr>
                <tr class="">
                  <td class="text gray">减排二氧化硫</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray">MW</td>
                </tr>
                <tr class="">
                  <td class="text gray">减排二氧化碳</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray gray">MW</td>
                </tr>
                <tr class="">
                  <td class="text gray">节约用水</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray">MW</td>
                </tr>
                <tr class="">
                  <td class="text gray">节约用煤</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray">MW</td>
                </tr>
              </table>
            </com-panel>
          </Col>
          <Col>
            <com-panel>
              <table class="table-card">
                <tr class="">
                  <td class="text gray">装机容量</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray">MW</td>
                </tr>
                <tr class="">
                  <td class="text gray">上网电量(日)</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray">MW</td>
                </tr>
                <tr class="">
                  <td class="text gray">减排二氧化硫</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray">MW</td>
                </tr>
                <tr class="">
                  <td class="text gray">减排二氧化碳</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray gray">MW</td>
                </tr>
                <tr class="">
                  <td class="text gray">节约用水</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray">MW</td>
                </tr>
                <tr class="">
                  <td class="text gray">节约用煤</td>
                  <td class="value green">361033.3</td>
                  <td class="unit gray">MW</td>
                </tr>
              </table>
            </com-panel>
          </Col>
        </row>
      </Col>
      <!-- 右下角 panel -->
      <Col :span="8">
        <panel-3 class="situation">
          <div class="situation-body">
            <row align="middle">
              <div class="situation-item fengji">
                <div class="icon fengji-icon svg-icon svg-icon-white">
                  <svg-icon class="" svgid="svg-风机" />
                </div>
                <div class="info">
                  <div class="title green">接入风机</div>
                  <div class="value">30</div>
                </div>
              </div>
              <div class="situation-item">
                <div class="icon svg-icon svg-icon-purple">
                  <svg-icon class="" svgid="svg-待机图标" />
                </div>
                <div class="info">
                  <div class="title green">待机</div>
                  <div class="value">
                    <span class="text gray">手动停机</span>
                    <span>123 </span>
                  </div>
                  <div class="value">
                    <span class="text gray">手动停机</span>
                    <span>123</span>
                  </div>
                </div>
              </div>
              <div class="situation-item">
                <div class="icon svg-icon svg-icon-green">
                  <svg-icon class="" svgid="svg-运行图标" />
                </div>
                <div class="info">
                  <div class="title green">运行</div>
                  <div class="value">
                    <span class="text gray">手动停机</span>
                    <span>123 </span>
                  </div>
                  <div class="value">
                    <span class="text gray">手动停机</span>
                    <span>123</span>
                  </div>
                </div>
              </div>
              <div class="situation-item">
                <div class="icon svg-icon svg-icon-yellow">
                  <svg-icon class="" svgid="svg-限电图标" />
                </div>
                <div class="info">
                  <div class="title green">待机</div>
                  <div class="value">
                    <span class="text gray">手动停机</span>
                    <span>123 </span>
                  </div>
                  <div class="value">
                    <span class="text gray">手动停机</span>
                    <span>123</span>
                  </div>
                </div>
              </div>
            </row>
            <row align="middle">
              <div class="situation-item">
                <div class="icon svg-icon svg-icon-red">
                  <svg-icon class="" svgid="svg-故障图标" />
                </div>
                <div class="info">
                  <div class="title green">待机</div>
                  <div class="value">
                    <span class="text gray">手动停机</span>
                    <span>123 </span>
                  </div>
                  <div class="value">
                    <span class="text gray">手动停机</span>
                    <span>123</span>
                  </div>
                </div>
              </div>
              <div class="situation-item">
                <div class="icon svg-icon svg-icon-orange">
                  <svg-icon class="" svgid="svg-检修图标" />
                </div>
                <div class="info">
                  <div class="title green">待机</div>
                  <div class="value">
                    <span class="text gray">手动停机</span>
                    <span>123 </span>
                  </div>
                  <div class="value">
                    <span class="text gray">手动停机</span>
                    <span>123</span>
                  </div>
                </div>
              </div>
              <div class="situation-item">
                <div class="icon svg-icon svg-icon-gray">
                  <svg-icon class="" svgid="svg-离线图标" />
                </div>
                <div class="info">
                  <div class="title green">待机</div>
                  <div class="value">
                    <span class="text gray">手动停机</span>
                    <span>123 </span>
                  </div>
                  <div class="value">
                    <span class="text gray">手动停机</span>
                    <span>123</span>
                  </div>
                </div>
              </div>
              <div class="situation-item">
                <div class="icon svg-icon svg-icon-blue">
                  <svg-icon class="" svgid="svg-受累图标" />
                </div>
                <div class="info">
                  <div class="title green">待机</div>
                  <div class="value">
                    <span class="text gray">手动停机</span>
                    <span>123 </span>
                  </div>
                  <div class="value">
                    <span class="text gray">手动停机</span>
                    <span>123</span>
                  </div>
                </div>
              </div>
            </row>
          </div>
        </panel-3>
      </Col>
    </Row>
  </div>
</template>

<script>
// @ is an alias to /src
import Row from "../../components/coms/grid/row.vue";
import Col from "../../components/coms/grid/col.vue";
import ComPanel from "../../components/coms/panel/panel";
import ListBarChart from "../../components/chart/bar/list-bar-chart.vue";
import ToolbarPanel from "../../components/coms/panel/toolbar-panel.vue";
import MultipleBarChart from "../../components/chart/bar/multiple-bar-chart.vue";
import MultipleLineChart from "../../components/chart/line/multiple-line-chart.vue";
import Panel3 from "../../components/coms/panel/panel3.vue";
import SvgIcon from "../../components/coms/icon/svg-icon.vue";
import CoulometricAnalysis from "./components/coulometric-analysis.vue";
import Weather from "./components/weather.vue";
import PowerReview from "./components/power-review.vue";
import PowerPlan from "./components/power-plan.vue";
import Map from "./components/map.vue";

export default {
  name: "Home",
  components: {
    Row,
    Col,
    ComPanel,
    Weather,
    CoulometricAnalysis,
    ListBarChart,
    PowerReview,
    ToolbarPanel,
    PowerPlan,
    MultipleBarChart,
    MultipleLineChart,
    Panel3,
    SvgIcon,
    Map,
  },
  data() {
    return {
      // 预测电量
      ForecastPower: [
        {
          name: "当日预测电量",
          value: 103.62,
        },
        {
          name: "实际发电量",
          value: 98.62,
        },
        {
          name: "当月预测电量",
          value: 113.27,
        },
        {
          name: "实际发电量",
          value: 136.72,
        },
      ],
      // 日发电量
      DayPower: {
        // 图表所用单位
        units: ["(万KWh)", "(风速)"],
        value: [
          {
            title: "日发电量",
            yAxisIndex: 0, // 使用单位
            value: [
              {
                text: "1日",
                value: 1,
              },
              {
                text: "2日",
                value: 1,
              },
              {
                text: "3日",
                value: 1,
              },
              {
                text: "4日",
                value: 1,
              },
              {
                text: "5日",
                value: 1,
              },
              {
                text: "6日",
                value: 1,
              },
              {
                text: "7日",
                value: 1,
              },
            ],
          },
          {
            title: "上网电量",
            yAxisIndex: 0,
            value: [
              {
                text: "1日",
                value: 2,
              },
              {
                text: "2日",
                value: 2,
              },
              {
                text: "3日",
                value: 2,
              },
              {
                text: "4日",
                value: 2,
              },
              {
                text: "5日",
                value: 2,
              },
              {
                text: "6日",
                value: 2,
              },
              {
                text: "7日",
                value: 2,
              },
            ],
          },
          {
            title: "购网电量",
            yAxisIndex: 0,
            value: [
              {
                text: "1日",
                value: 3,
              },
              {
                text: "2日",
                value: 3,
              },
              {
                text: "3日",
                value: 3,
              },
              {
                text: "4日",
                value: 3,
              },
              {
                text: "5日",
                value: 3,
              },
              {
                text: "6日",
                value: 3,
              },
              {
                text: "7日",
                value: 3,
              },
            ],
          },
          {
            title: "风速",
            yAxisIndex: 1,
            value: [
              {
                text: "1日",
                value: 4,
              },
              {
                text: "2日",
                value: 4,
              },
              {
                text: "3日",
                value: 4,
              },
              {
                text: "4日",
                value: 4,
              },
              {
                text: "5日",
                value: 4,
              },
              {
                text: "6日",
                value: 4,
              },
              {
                text: "7日",
                value: 4,
              },
            ],
          },
        ],
      },
      // 72小时功率趋势图
      Powertrend: {
        // 图表所用单位
        units: ["(万KWh)", "(风速)"],
        value: [
          {
            title: "平均风速",
            yAxisIndex: 1, // 使用单位
            value: [
              {
                text: "1日",
                value: 0,
              },
              {
                text: "2日",
                value: 1,
              },
              {
                text: "3日",
                value: 0,
              },
              {
                text: "4日",
                value: 1,
              },
              {
                text: "5日",
                value: 0,
              },
              {
                text: "6日",
                value: 1,
              },
              {
                text: "7日",
                value: 0,
              },
            ],
          },
          {
            title: "应发功率",
            yAxisIndex: 0,
            value: [
              {
                text: "1日",
                value: 4,
              },
              {
                text: "2日",
                value: 2,
              },
              {
                text: "3日",
                value: 4,
              },
              {
                text: "4日",
                value: 2,
              },
              {
                text: "5日",
                value: 4,
              },
              {
                text: "6日",
                value: 2,
              },
              {
                text: "7日",
                value: 4,
              },
            ],
          },
          {
            title: "实际功率",
            yAxisIndex: 0,
            value: [
              {
                text: "1日",
                value: 1,
              },
              {
                text: "2日",
                value: 3,
              },
              {
                text: "3日",
                value: 1,
              },
              {
                text: "4日",
                value: 3,
              },
              {
                text: "5日",
                value: 1,
              },
              {
                text: "6日",
                value: 3,
              },
              {
                text: "7日",
                value: 1,
              },
            ],
          },
        ],
      },
    };
  },
};
</script>

<style lang="less" scoped>
.grid-content {
  background: #333;
  height: 1.111vh;
}

.table-card {
  background: rgba(255, 255, 255, 0.1);
  border-collapse: collapse;
  width: 100%;

  tr {
    font-size: @fontsize-s;
    td {
      border: 0.093vh solid @darkgray;
      padding: 0.556vh 0.741vh;
      &.text {
      }

      &.value {
        text-align: right;
      }

      &.unit {
      }
    }
  }
}

.tools {
  display: flex;

  .tool-block {
    display: flex;
    align-items: center;
    margin-left: 0.741vh;

    .legend {
      flex: auto;
      width: 0.741vh;
      height: 0.741vh;
      margin-right: 0.741vh;

      &.long {
        width: 2.963vh;
        height: 0.37vh;
      }
    }

    .legend-text {
      color: #ffffff4d;
    }
  }
}

.situation {
  width: 100%;
  height: 100%;
  .situation-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;

    .situation-item {
      display: flex;
      align-content: center;
      flex: 1 1 auto;
      align-items: center;

      .icon {
        svg {
          width: 4.167vh;
          height: 4.167vh;
        }
      }

      &.fengji {
        flex: 0 1 7.3737vw;

        .info .value {
          font-size: 1.852vh;
        }
      }

      .fengji-icon {
        padding: 1.111vh;
        border: 0.093vh solid #05bb4c;
        border-radius: 50%;
        border-right-color: transparent;
        border-top-color: transparent;
        margin-right: -0.741vh;

        svg {
          width: 2.593vh;
          height: 2.593vh;
        }
      }

      .info {
        display: flex;
        flex-direction: column;
        justify-content: center;
        margin-left: 0.741vh;

        .title {
          font-size: @fontsize;
          margin-bottom: 0.741vh;
        }

        .text {
          margin-right: 0.741vh;
        }

        .value {
          text-align: right;
          font-size: @fontsize-s;
        }
      }
    }
  }
}
</style>
