<template>
  <div class="monitor">
    <div class="search">
      <div class="left">
        <div class="search-item">
          <span>场站切换</span>
          <a-cascader v-model:value="value" :options="options" placeholder="Please select" />
        </div>
      </div>
      <div class="right">
        <div class="search-item">
          <span>运行模式</span>
          <a-cascader v-model:value="value" :options="options" placeholder="Please select" />
        </div>
        <div class="search-item">
          <span>策略名称</span>
          <a-cascader v-model:value="value" :options="options" placeholder="Please select" />
        </div>
        <div class="search-item">
          <a-button type="primary">调控</a-button>
        </div>
      </div>
    </div>
    <div class="content">
      <div class="stations">
        <div class="station-item" v-for="station in stations" :key="station.name" @click="()=>currentKey=station.name" :class="currentKey==station.name?'active':''">
          <span class="name">{{ station.name }}</span>
          <span class="des">总功率：{{ station.power }} W</span>
          <span class="des">数量：{{ station.num }}</span>
        </div>
      </div>
      <div class="container">
        <device v-if="stationType" />
        <videos v-else />
      </div>
      
    </div>
  </div>
</template>

<script>
import device from '@/components/monitor/device.vue'
import videos from '@/components/monitor/videos.vue'

export default {
  name: 'MonitorView',
  components: {
    device,
    videos
  },
  data() {
    return {
      currentKey:'储能系统1',
      stationType: 1,
      value: [],
      options: [
        {
          value: 'zhejiang',
          label: 'Zhejiang',
          children: [
            {
              value: 'hangzhou',
              label: 'Hangzhou',
              children: [
                {
                  value: 'xihu',
                  label: 'West Lake'
                }
              ]
            }
          ]
        },
        {
          value: 'jiangsu',
          label: 'Jiangsu',
          children: [
            {
              value: 'nanjing',
              label: 'Nanjing',
              children: [
                {
                  value: 'zhonghuamen'
                }
              ]
            }
          ]
        }
      ],
      stations: [
        {
          name: '储能系统1',
          power: 60,
          num: 62
        },
        {
          name: '储能系统2',
          power: 60,
          num: 62
        }
        // {
        //   name: "储能系统3",
        //   power: 60,
        //   num: 62
        // },
        // {
        //   name: "储能系统4",
        // }
      ]
    }
  }
}
</script>

<style scoped lang="scss">
@import url(@/style/color.scss);
.monitor {
  width: 100%;
  height: 100%;
  padding: 20px;
  background: $bg1-color;
  border-radius: 15px;

  .search {
    display: flex;
    justify-content: space-between;
    .search-item {
      span {
        margin-right: 20px;
      }
      color: #fff;
      margin-left: 30px;
      &:first-child {
        margin-left: 0;
      }
    }
    .left,
    .right {
      display: flex;
    }
  }
  .content {
    width: 100%;
    height: calc(100% - 32px - 20px);
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    .stations {
      min-width: 155px;
      max-width: 235px;
      width: 13%;
      height: 100%;
      border-radius: 12px;
      background: $bg2-color;
      padding: 15px 0;
      overflow-y: auto;
      .station-item {
        width: calc(100% - 30px);
        margin: 0 15px 15px 15px;
        border-radius: 12px;
        
        display: flex;
        flex-direction: column;
        color: #fff;
        padding: 10px 15px;
          cursor: pointer;

        .name {
          font-size: 20px;
          font-weight: 700;
          line-height: 50px;
        }
        .des {
          font-size: 14px;
          font-weight: 600;
          line-height: 40px;
        }
      }
      .active{
        background: $bg3-color;
      }
    }
    .container {
        width: 87%;
        display: flex;
    }
  }
}
</style>
