<template>
  <Box title="监控">
    <div class="h-full flex flex-col">
      <div class="py-10px">
        <ul class="flex items-center justify-center m-0">
          <li
            class="mx-11px text-white text-12px cursor-pointer"
            :class="{ active: currentTab == item.key }"
            @click="changeTab(item.key)"
            v-for="item in tabList"
            :key="item.key"
            >{{ item.value }}</li
          >
        </ul>
      </div>
      <div class="flex-1 px-30px grid grid-cols-2 gap-y-10px gap-x-90px pb-16px">
        <div class="flex items-center" v-for="item in 4" :key="item">
          <div>
            <SvgIcon name="jd1-icon" :size="65" />
            <div class="text-12px font-bold text-white mt-11px">AI智能监控</div>
          </div>
          <div class="ml-24px">
            <div class="flex items-center h-22px">
              <div class="w-7px h-7px bg-[#76E9F0]"></div>
              <div class="ml-11px text-11px text-white">在线</div>
            </div>
            <div class="flex items-center h-22px">
              <div class="w-7px h-7px bg-[#F7B379]"></div>
              <div class="ml-11px text-11px text-white">离线</div>
            </div>
            <div class="flex items-center h-22px">
              <div class="w-7px h-7px bg-[#EB313E]"></div>
              <div class="ml-11px text-11px text-white">故障</div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </Box>
</template>

<script lang="ts">
  import { defineComponent, reactive, ref, Ref, onMounted } from 'vue'
  import { SvgIcon } from '/@/components/Icon'
  import Box from './Box.vue'
  export default defineComponent({
    components: {
      Box,
      SvgIcon,
    },
    setup() {
      const tabList = reactive([
        {
          key: '0',
          value: '基地1',
        },
        {
          key: '1',
          value: '基地2',
        },
        {
          key: '2',
          value: '基地3',
        },
      ])

      const currentTab = ref<String>('0')

      const chartRef = ref<HTMLDivElement | null>(null)

      const changeTab = (key: String) => {
        if (currentTab.value == key) return
        currentTab.value = key
      }

      onMounted(() => {})

      return {
        tabList,
        currentTab,
        chartRef,
        changeTab,
      }
    },
  })
</script>

<style scoped lang="less">
  .active {
    @apply font-bold text-15px text-[#76E9F0];
  }
</style>
