<template>
  <div class="top-panel" v-show="!appStore.mobile">
    <div class="top-panel__left">
      <div class="search-group">
        <el-input v-model="search" class="search-input" placeholder="请输入关键词" />
      </div>
    </div>
    <div class="top-panel__center">
      <!-- <div class="data_item">
        <span class="data_item__title">手持设备</span>
        <span class="data_item__value">{{ handDetectorCount }}</span>
        <span class="data_item__unit">台</span>
      </div> -->
      <div class="data_item">
        <span class="data_item__title">在线数量</span>
        <span class="data_item__value">{{ onlineCount }} / {{ handDetectorCount }}</span>
        <span class="data_item__unit">台</span>
      </div>
    </div>
    <div class="top-panel__right">
      <span class="legend-title">报警图例：</span>
      <div class="normal-legend">正常状态</div>
      <div class="alarm1-legend">围栏报警</div>
      <div class="alarm2-legend">气体报警</div>
    </div>
  </div>
</template>
<script lang="ts" setup>
// import { ref, computed } from 'vue'
import { useAppStore } from '@/store/modules/app'
const appStore = useAppStore()
var props = defineProps({
  handDetectorCount: {
    type: Number,
    default: 0
  },
  onlineCount: {
    type: Number,
    default: 0
  }
})
var search = defineModel({
  type: String,
  default: ''
})
</script>
<style scoped lang="scss">
/* 顶部面板样式 */
.top-panel {
  position: absolute;
  top: 0px;
  left: 50px;
  right: 10px;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  // gap: 12px;
  padding: 6px 0px;
  flex-wrap: wrap;

  box-sizing: border-box;

  .top-panel__left {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    height: 100%;
    margin-right: 12px;
    padding: 10px;
  }

  .top-panel__center {
    flex: 1 1 auto;
    display: flex;
    align-items: center;

    .data_item {
      box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
      // width: 200px;
      background: rgba(255, 255, 255, 0.9);
      border: 1px solid rgba(0, 0, 0, 0.06);
      border-radius: 8px;
      padding: 12px 20px;
      margin-right: 12px;

      .data_item__title {
        font-size: 14px;
        color: #3f3f3f;
        vertical-align: middle;
      }

      .data_item__value {
        display: inline-block;
        padding: 0 10px;
        font-size: 18px;
        font-weight: 600;
        color: #3399ff;
        vertical-align: middle;
      }
      .data_item__unit {
        font-size: 14px;
        color: #3f3f3f;
        vertical-align: middle;
      }
    }
  }

  .top-panel__right {
    display: flex;
    align-items: center;
    gap: 8px; 
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.06);
    padding: 12px 12px;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    white-space: nowrap;
    height: 100%;

    .legend-title {
      color: #606266;
      font-size: 14px;
    }
    .normal-legend,
    .alarm1-legend,
    .alarm2-legend {
      padding: 4px 8px;
      border-radius: 999px;
      color: #fff;
      font-size: 12px;
      line-height: 1;
    }

    .normal-legend {
      background: #67c23a;
    }

    .alarm1-legend {
      background: #e6a23c;
    }

    .alarm2-legend {
      background: #f56c6c;
    }
  }
}
</style>
