<template>
    <div class="mian">
        <div class="title">
            <div class="left">
                <div class="left-first" id="time">--:--:--</div>
                <div class="left-second" id="date">----</div>
            </div>
            <div class="center">南川区综合服务中心数智管理平台安防大屏</div>
            <div class="right">
                <div>{{ weekDay }}</div>
                <div>晴</div>
                <div>40℃</div>
                <div class="logout" @click="logout">
               <img src="../../../assets/return.png" style="width: 1.5rem; height: 1.5rem;">
                <div>
                退出
                </div>
              </div>
            </div>
        </div>
        <div class="header">
            <div class="header-item">
                <span class="header-label">今年用电量</span>
                <span class="header-value orange">180</span>
                <span class="header-unit">亿kwh</span>
            </div>
            <div class="header-item">
                <span class="header-label">本月用电总量</span>
                <span class="header-value green">1.8</span>
                <span class="header-unit">亿kwh</span>
            </div>
            <div class="header-item">
                <span class="header-label">今年用水总量</span>
                <span class="header-value blue">2600</span>
                <span class="header-unit">万吨</span>
            </div>
            <div class="header-item">
                <span class="header-label">本月用水总量</span>
                <span class="header-value purple">30</span>
                <span class="header-unit">万吨</span>
            </div>
            <div class="header-item">
                <span class="header-label">设备总数</span>
                <span class="header-value green">500</span>
                <span class="header-unit">台</span>
            </div>
        </div>
        <div class="contents">
            <div class="content">
                <div class="content-left">
                    <div class="first">
                      <div class="first-content1">
                        <div>746</div>
                        <div>214</div>
                        <div>456</div>
                      </div>
                        <div class="first-content2">
                         <div ref="pieChart" class="pie-chart"></div>
                       </div>
                    </div>
                    <div class="second">
                        <div class="second-content">
                            <div ref="powerChart" class="power-chart"></div>
                        </div>
                    </div>
                    <div class="third">
                      <div class="alarm-table-container">
                        <table class="alarm-table">
                          <thead>
                            <tr>
                              <th>报警时间</th>
                              <th>报警位置</th>
                              <th>报警内容</th>
                              <th>处理情况</th>
                            </tr>
                          </thead>
                          <tbody>
                            <tr>
                              <td>06-25 14:25:12</td>
                              <td>东区大门</td>
                              <td>门禁异常</td>
                              <td class="status-done">已处理</td>
                            </tr>
                            <tr>
                              <td>06-25 14:25:12</td>
                              <td>东区大门</td>
                              <td>门禁异常</td>
                              <td class="status-done">已处理</td>
                            </tr>
                            <tr>
                              <td>06-25 14:25:12</td>
                              <td>东区大门</td>
                              <td>门禁异常</td>
                              <td class="status-done">已处理</td>
                            </tr>
                            <tr>
                              <td>06-25 14:25:12</td>
                              <td>东区大门</td>
                              <td>门禁异常</td>
                              <td class="status-undone">未处理</td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                    </div>
                </div>
                <div class="content-center">
                    <div class="content-center-first">
                        <div class="first-item">
                            <div class="first-item-button1">三维模式</div>
                            <div class="first-item-button1">地图模式</div>
                            <div class="first-item-button2">视频模式</div>
                        </div>
                        <div class="second-item">
                                <img src="../../../assets/security/stop-icon.png" alt="">
                        </div>
                    </div>
                    <div class="content-center-second">
                        <div class="second-item-box">
                            <div class="second-item">
                                <div class="second-item-box1">
                                  <div class="box-text">相似度98%</div>
                                </div>
                            </div>
                            <div class="second-item">
                                <div class="second-item-box2">
                                  <div class="box-text">相似度98%</div>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
                <div class="content-right">
                    <div class="first">
                      <div class="track-query-panel">
                        <div class="track-section">
                          <div class="track-section-box">
                            <div class="track-section-box-item">人行轨迹</div>
                            <div class="track-section-box-item">车行轨迹</div>
                          </div>
                          <div class="track-img-list">
                            <div class="track-img-add">
                              <span>+</span>
                            </div>
                            <div class="track-img-placeholder"></div>
                            <div class="track-img-placeholder"></div>
                            <div class="track-img-placeholder"></div>
                          </div>
                        </div>
                        <div class="track-section">
                          <div class="track-feature-bar">
                          </div>
                        </div>
                        <div class="track-section">
                          <div class="track-time-bar">
                            <span>2025-06-24 09:00---2025-06-25 18:00</span>
                          </div>
                        </div>
                        <div class="track-section">
                          <div class="track-table">
                            <div class="track-table-row">
                              <div>大门口监控</div>
                              <div>2025-06-24 09:00</div>
                            </div>
                            <div class="track-table-row">
                              <div>一楼监控</div>
                              <div>2025-06-24 09:00</div>
                            </div>
                            <div class="track-table-row">
                              <div>二楼监控</div>
                              <div>2025-06-24 09:00</div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                    <div class="second">
                      <div class="person-car-bar-chart" ref="personCarBarChart"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup lang="ts">
import { ref, onMounted, onBeforeUnmount } from 'vue'
import { useRouter } from 'vue-router'
import * as echarts from 'echarts'
import 'echarts-gl'
import { getThreeDBarOption } from '#/utils/threeDBarOption'
import { renderPie3DChart } from '#/utils/pie3d'
import { addChartToResizeManager, removeChartFromResizeManager } from '#/utils/echartsResize'

// 路由
const router = useRouter()

// 图表实例
const barChart = ref<HTMLElement>()
const powerChart = ref<HTMLElement>()
const envChart = ref<HTMLElement>()
const waterChart = ref<HTMLElement>()
const deviceChart = ref<HTMLElement>()
const pie3dChart = ref<HTMLElement>()
const pieChart = ref<HTMLElement>()
const personCarBarChart = ref<HTMLElement>()

// 定时器
let timer: number | null = null
let personCarBarChartTimer: number | null = null

// 星期几
const weekDay = ref('')

// 图表实例
let barChartInstance: echarts.ECharts | null = null
let powerChartInstance: echarts.ECharts | null = null
let envChartInstance: echarts.ECharts | null = null
let waterChartInstance: echarts.ECharts | null = null
let deviceChartInstance: echarts.ECharts | null = null
let pie3dChartInstance: any = null
let pieChartInstance: echarts.ECharts | null = null
let personCarBarChartInstance: echarts.ECharts | null = null

// 退出方法
const logout = () => {
  router.push('/navigation')
}

// 更新时间
const updateTime = () => {
  const now = new Date()
  const time = now.toLocaleTimeString('zh-CN', { hour12: false })
  const date = now.getFullYear() + '.' +
    String(now.getMonth() + 1).padStart(2, '0') + '.' +
    String(now.getDate()).padStart(2, '0')

  // 获取星期几
  const weekDays = ['日', '一', '二', '三', '四', '五', '六']
  weekDay.value = '星期' + weekDays[now.getDay()]

  const timeElement = document.getElementById('time')
  const dateElement = document.getElementById('date')

  if (timeElement) timeElement.innerText = time
  if (dateElement) dateElement.innerText = date
}

// 初始化柱状图
const initBarChart = () => {
  if (!barChart.value) return

  const chart = echarts.init(barChart.value)
  const option = getThreeDBarOption({
    xData: ['A区', 'B区', 'C区', 'D区'],
    yData: [320, 452, 688, 400]
  })
  chart.setOption(option)
  barChartInstance = chart
  addChartToResizeManager(chart)
}

// 初始化电力图表
const initPowerChart = () => {
  if (!powerChart.value) return

  const chart = echarts.init(powerChart.value)
  const option = {
    tooltip: { trigger: 'axis' },
    grid: { left: 40, right: 20, top: 40, bottom: 30 },
    xAxis: {
      type: 'category',
      data: Array.from({length: 19}, (_, i) => i + 6),
      axisLine: { lineStyle: { color: '#3ec6ff' } },
      axisLabel: { color: '#fff' }
    },
    yAxis: {
      type: 'value',
      name: '',
      axisLine: { lineStyle: { color: '#3ec6ff' } },
      axisLabel: { color: '#fff' },
      splitLine: { lineStyle: { color: '#1e90ff22' } }
    },
    series: [{
      data: [80, 120, 100, 130, 150, 180, 200, 220, 250, 285, 230, 200, 180, 150, 120, 100, 80, 60, 40],
      type: 'line',
      smooth: true,
      symbol: 'circle',
      symbolSize: 0,
      itemStyle: { color: '#3ec6ff' },
      lineStyle: { width: 1 },
      areaStyle: { color: new echarts.graphic.LinearGradient(
            0, 0, 0, 1, // 上→下
            [
              { offset: 0, color: '#32B7E9' },
              { offset: 1, color: 'rgba(50,183,233,0)' }
            ]
            ), }
    }]
  }
  chart.setOption(option)
  powerChartInstance = chart
  addChartToResizeManager(chart)
}

// 初始化环境图表
const initEnvChart = () => {
  if (!envChart.value) return

  const chart = echarts.init(envChart.value)
  const option = {
    tooltip: { trigger: 'axis' },
    grid: { left: 40, right: 20, top: 10, bottom: 20 },
    xAxis: {
      type: 'category',
      data: Array.from({length: 8}, (_, i) => (i+1)*3),
      axisLine: { lineStyle: { color: '#3ec6ff' } },
      axisLabel: { color: '#fff' }
    },
    yAxis: {
      type: 'value',
      axisLine: { lineStyle: { color: '#3ec6ff' } },
      axisLabel: { color: '#fff' },
      splitLine: { lineStyle: { color: '#1e90ff22' } }
    },
    series: [
      {
        name: '今年',
        data: [100, 200, 150, 300, 250, 200, 100, 80],
        type: 'line',
        smooth: true,
        itemStyle: { color: '#b388ff' },
        lineStyle: { width: 3 },
        areaStyle: { color: 'rgba(179,136,255,0.2)' },
        symbol: 'circle',
        symbolSize: 0,
      },
      {
        name: '去年',
        data: [80, 120, 100, 180, 150, 120, 60, 40],
        type: 'line',
        smooth: true,
        itemStyle: { color: '#ffb300' },
        lineStyle: { width: 3 },
        areaStyle: { color: 'rgba(255,179,0,0.15)' },
        symbol: 'circle',
        symbolSize: 0,
      }
    ]
  }
  chart.setOption(option)
  envChartInstance = chart
  addChartToResizeManager(chart)
}

// 初始化水表图表
const initWaterChart = () => {
  if (!waterChart.value) return

  const chart = echarts.init(waterChart.value)
  const option = {
    tooltip: { trigger: 'axis' },
    legend: {
      data: ['今日', '平均'],
      textStyle: { color: '#fff' },
      right: 20,
      top: 10
    },
    grid: { left: 40, right: 20, top: 40, bottom: 30 },
    xAxis: {
      type: 'category',
      data: Array.from({length: 19}, (_, i) => i + 6),
      axisLine: { lineStyle: { color: '#3ec6ff' } },
      axisLabel: { color: '#fff' }
    },
    yAxis: {
      type: 'value',
      axisLine: { lineStyle: { color: '#3ec6ff' } },
      axisLabel: { color: '#fff' },
      splitLine: { lineStyle: { color: '#1e90ff22' } }
    },
    series: [
      {
        name: '今日',
        data: [1.2, 2.1, 1.8, 2.5, 3.0, 3.8, 4.2, 4.5, 4.8, 4.8, 4.0, 3.2, 2.5, 2.0, 1.5, 1.0, 0.8, 0.5, 0.2],
        type: 'line',
        smooth: true,
        symbol: 'circle',
        symbolSize: 0,
        itemStyle: { color: '#3ec6ff' },
        lineStyle: { width: 1 },
        areaStyle: { color: new echarts.graphic.LinearGradient(
              0, 0, 0, 1, // 上→下
              [
                { offset: 0, color: '#32B7E9' },
                { offset: 1, color: 'rgba(50,183,233,0)' }
              ]
              ), }
      },
      {
        name: '平均',
        data: Array(19).fill(2.5),
        type: 'line',
        smooth: true,
        symbol: 'none',
        itemStyle: { color: '#ff6b00' },
        lineStyle: { width: 1, type: 'solid', color: '#ff6b00' }
      }
    ]
  }
  chart.setOption(option)
  waterChartInstance = chart
  addChartToResizeManager(chart)
}

// 初始化设备图表
const initDeviceChart = () => {
  if (!deviceChart.value) return

  const chart = echarts.init(deviceChart.value)
  const option = {
    grid: { left: 60, right: 40, top: 10, bottom: 30 },
    xAxis: {
      type: 'value',
      axisLine: { lineStyle: { color: '#8697BA' } },
      axisLabel: { color: '#fff' },
      splitLine: { show: false }
    },
    yAxis: {
      type: 'category',
      data: ['门禁', '监控', '水表'],
      axisLine: { lineStyle: { color: '#8697BA' } },
      axisLabel: { color: '#A1B2C2' }
    },
    series: [
      {
        name: '设备数',
        type: 'bar',
        data: [650, 120, 40],
        barWidth: 12,
        itemStyle: {
          color: function(params: any) {
            const colors = [
            new echarts.graphic.LinearGradient(
            0, 0, 0, 1, // 上→下
            [
              { offset: 0, color: '#2986B1' },
              { offset: 1, color: '#6941FF' }
            ]
            ),
            new echarts.graphic.LinearGradient(
            0, 0, 0, 1, // 上→下
            [
              { offset: 0, color: '#33FF99' },
              { offset: 1, color: '#00908E' }
            ]
            ),
            new echarts.graphic.LinearGradient(
            0, 0, 0, 1, // 上→下
            [
              { offset: 0, color: '#01B4FF' },
              { offset: 1, color: '#0336FF' }
            ]
            ),
          ];
            return colors[params.dataIndex]
          }
        },
        label: {
          show: true,
          position: 'right',
          color: '#fff'
        }
      }
    ]
  }
  chart.setOption(option)
  deviceChartInstance = chart
  addChartToResizeManager(chart)
}

// 初始化3D饼图
const initPie3DChart = () => {
  if (!pie3dChart.value) return

  pie3dChartInstance = renderPie3DChart(pie3dChart.value, {
    data: [
      { name: 'A区域', value: 20, itemStyle: { color: '#3ffbff' } },
      { name: 'D区域', value: 20, itemStyle: { color: '#b388ff' } },
      { name: 'C区域', value: 45, itemStyle: { color: '#ff9900' } },
      { name: 'B区域', value: 15, itemStyle: { color: '#3f6bff' } },
    ],
    hoverHeightScale: 2,
    selectOffset: 0.1,
    distance: 220,
    boxHeight: 5
  })
  if (pie3dChartInstance) {
    addChartToResizeManager(pie3dChartInstance)
  }
}

// 初始化饼图
const initPieChart = () => {
  if (!pieChart.value) return
  const m2R2Data = [
    {value:335, legendname:'设备预警',name:"设备预警",itemStyle:{color:"#01A2F3"}},
    {value:310, legendname:'其他预警',name:"其他预警",itemStyle:{color:"#A564F8"}},
    {value:234, legendname:'客户报障',name:"客户报障",itemStyle:{color:"#54E6CB"}},
    {value:154, legendname:'设备故障',name:"设备故障",itemStyle:{color:"#F8976A "}},
  ]
  const chart = echarts.init(pieChart.value)
  const option = {
    tooltip: {
      trigger: 'item',
      formatter:function (parms: any){
        var str=  parms.seriesName+"</br>"+
          parms.marker+""+parms.data.legendname+"</br>"+
          "数量："+ parms.data.value+"</br>"+
          "占比："+ parms.percent+"%";
        return  str ;
      }
    },
    legend: {
      type:"scroll",
      orient: 'vertical',
      left:'70%',
      align:'left',
      top:'middle',
      textStyle: {
        color:'#fff'
      },
      height:250
    },
    series: [
      {
        name:'标题',
        type:'pie',
        center: ['35%', '50%'],
        radius: '65%',
        clockwise: false, //饼图的扇区是否是顺时针排布
        avoidLabelOverlap: false,
        data:m2R2Data
      }
    ]
  }
  chart.setOption(option)
  pieChartInstance = chart
  addChartToResizeManager(chart)
}

// 初始化人员车辆柱状图
const initPersonCarBarChart = () => {
  if (!personCarBarChart.value) return
  const option = {
    // backgroundColor:'#323a5e',
    tooltip: {
      trigger: 'axis',
      axisPointer: { type: 'shadow' }
    },
    grid: {
      left: '2%',
      right: '4%',
      bottom: '14%',
      top:'16%',
      containLabel: true
    },
    legend: {
      data: ['内部', '预约', '异常'],
      right: 10,
      top:12,
      textStyle: { color: "#fff" },
      itemWidth: 12,
      itemHeight: 10,
    },
    xAxis: {
      type: 'category',
      data: ['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24'],
      axisLine: { lineStyle: { color: 'white' } },
      axisLabel: { textStyle: { fontFamily: 'Microsoft YaHei' } }
    },
    yAxis: {
      type: 'value',
      max:'1200',
      axisLine: { show: false, lineStyle: { color: 'white' } },
      splitLine: { show: true, lineStyle: { color: 'rgba(255,255,255,0.3)' } },
      axisLabel: {}
    },
    dataZoom: [{
      show: true,
      height: 12,
      xAxisIndex: [0],
      bottom:'8%',
      start: 10,
      end: 90,
      handleIcon: 'path://M306.1,413c0,2.2-1.8,4-4,4h-59.8c-2.2,0-4-1.8-4-4V200.8c0-2.2,1.8-4,4-4h59.8c2.2,0,4,1.8,4,4V413z',
      handleSize: '110%',
      handleStyle:{ color:"#d3dee5" },
      textStyle:{ color:"#fff"},
      borderColor:"#90979c"
    }, {
      type: "inside",
      show: true,
      height: 15,
      start: 1,
      end: 35
    }],
    series: [
      {
        name: '内部',
        type: 'bar',
        barWidth: '15%',
        itemStyle: {
          normal: {
            color: '#01A2F3',
            barBorderRadius: 12,
          },
        },
        data: [400, 400, 300, 300, 300, 400, 400, 400, 300, 400, 400, 300, 300, 400, 400, 400, 300, 400, 400, 400, 300, 400, 400, 400]
      },
      {
        name: '预约',
        type: 'bar',
        barWidth: '15%',
        itemStyle: {
          normal: {
            color: '#54E6CB',
            barBorderRadius: 11,
          }
        },
        data: [400, 500, 500, 500, 500, 400,400, 500, 500, 400, 500, 500, 500, 400, 400, 500, 500, 400, 500, 500, 500, 400, 400, 500]
      },
      {
        name: '异常',
        type: 'bar',
        barWidth: '15%',
        itemStyle: {
          normal: {
            color: '#F8976A',
            barBorderRadius: 11,
          }
        },
        data: [400, 600, 700, 700, 1000, 400, 400, 600, 700, 400, 600, 700, 700, 1000, 400, 400, 600, 700, 400, 600, 700, 700, 1000, 400]
      }
    ]
  }
  personCarBarChartInstance = echarts.init(personCarBarChart.value)
  personCarBarChartInstance.setOption(option)

  // 自动高亮轮播
  let currentIndex = -1
  personCarBarChartTimer = window.setInterval(() => {
    const dataLen = option.series[0].data.length
    personCarBarChartInstance?.dispatchAction({
      type: 'downplay',
      seriesIndex: 0,
      dataIndex: currentIndex
    })
    currentIndex = (currentIndex + 1) % dataLen
    personCarBarChartInstance?.dispatchAction({
      type: 'highlight',
      seriesIndex: 0,
      dataIndex: currentIndex,
    })
    personCarBarChartInstance?.dispatchAction({
      type: 'showTip',
      seriesIndex: 0,
      dataIndex: currentIndex
    })
  }, 1000)
}

// 组件挂载时初始化
onMounted(() => {
  updateTime()
  timer = setInterval(updateTime, 1000)
  initBarChart()
  initPowerChart()
  initEnvChart()
  initWaterChart()
  initDeviceChart()
  initPie3DChart()
  initPieChart()
  initPersonCarBarChart()
})

// 组件卸载时清理
onBeforeUnmount(() => {
  if (timer) {
    clearInterval(timer)
  }

  // 从管理器中移除图表
  if (barChartInstance) {
    removeChartFromResizeManager(barChartInstance)
    barChartInstance.dispose()
  }
  if (powerChartInstance) {
    removeChartFromResizeManager(powerChartInstance)
    powerChartInstance.dispose()
  }
  if (envChartInstance) {
    removeChartFromResizeManager(envChartInstance)
    envChartInstance.dispose()
  }
  if (waterChartInstance) {
    removeChartFromResizeManager(waterChartInstance)
    waterChartInstance.dispose()
  }
  if (deviceChartInstance) {
    removeChartFromResizeManager(deviceChartInstance)
    deviceChartInstance.dispose()
  }
  if (pie3dChartInstance) {
    removeChartFromResizeManager(pie3dChartInstance)
    pie3dChartInstance.dispose()
  }
  if (pieChartInstance) {
    removeChartFromResizeManager(pieChartInstance)
    pieChartInstance.dispose()
  }
  if (personCarBarChartInstance) {
    personCarBarChartInstance.dispose()
  }
  if (personCarBarChartTimer) {
    clearInterval(personCarBarChartTimer)
  }
})
</script>

<style scoped>
.mian{
    height: 100vh;
    background: url("../../../assets/security/bg.png");
    background-size: 100% 100%;
    background-color: #081b3a;
    display: flex;
    flex-direction: column;
}
.title {
    height: 5.375rem;
    align-items: center;
    display: flex;
    justify-content: space-between;
    .left{
        display: flex;
        width: 14.3125rem;
        .left-first{
            padding-left: 2.3125rem;
            padding-right: 3.5rem;
            font-size: 1.875rem;
            color: #FFFFFF;
        }
        .left-second{
            width: 6.5rem;
            font-family: ShiShangZhongHeiJianTi;
            font-weight: 400;
            font-size: 1.25rem;
            color: #FFFFFF;
        }
    }
    .center{
    font-size: 1.9rem;
    color: #fff;
    text-align: center;
    font-weight: bold;
    letter-spacing: 0.1em;
    text-shadow: 0 0 10px #1e90ff, 0 0 20px #1e90ff;
    }
    .right{
        width: 17.3125rem;
        display: flex;
        font-family: ShiShangZhongHeiJianTi;
        font-weight: 400;
        font-size: 1.25rem;
        color: #FFFFFF;
        gap: .75rem;
        .logout{
          display: flex;
          cursor: pointer;
          align-items: center;
          gap: .2rem;
        }
    }
}
.header{
    margin-top: 1.125rem;
    margin-left: 4.625rem;
    margin-right: 4.25rem;
    height: 4.625rem;
    display: flex;
    justify-content: space-between;
    .header-item {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 1.5rem;
        border-radius: 0.5rem;
        box-shadow: 0 0 10px #0ff2, 0 0 20px #0ff2 inset;
        }
    .header-label {
    color: #fff;
    font-size: 1rem;
    margin-right: 0.5rem;
    letter-spacing: 0.05em;
    }

    .header-value {
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0 0.2rem;
    }

    .header-value.orange { color: #ffb300; }
    .header-value.green { color: #00ffb0; }
    .header-value.blue { color: #3ec6ff; }
    .header-value.purple { color: #b388ff; }

    .header-unit {
    color: #fff;
    font-size: 1rem;
    margin-left: 0.2rem;
    }
}
.header div{
    width: 20.125rem;
}
.contents{
    flex: 1;
    padding-bottom: 1.93rem;
    .content{
    height: 100%;
    display: flex;
    justify-content: space-between;
    margin: 0 2.25rem;
    .content-left{
        width: 32.6875rem;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        .first{
            height: 17.5rem;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            .first-content1{
              margin: 0 2rem;
              height: 7rem;
              display: flex;
              justify-content: space-between;
              align-items: center;
            }
            .first-content1 div{
              width: 3rem;
              color: #fff;
              font-size: 1rem;
              font-weight: bold;
              text-align: left;
            }
            .first-content2{
               flex: 1;
               .pie-chart {
                 width: 100%;
                 height: 100%;
               }
             }
        }
        .second{
            height: 13rem;
            .second-content{
                height: 100%;
                .power-chart {
                    height: 100%;
                }
            }

        }
        .third{
            height: 15rem;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            .alarm-table-container {
              border-radius: 0.5rem;
              width: 95%;
              margin: 0 auto;
            }
            .alarm-table-title {
              color: #fff;
              font-size: 1.1rem;
              font-weight: bold;
              margin-bottom: 0.5rem;
              letter-spacing: 0.1em;
            }

            .alarm-table {
              width: 100%;
              border-collapse: collapse;
              color: #8697BA;
              font-size: 0.95rem;
            }

            .alarm-table thead th {
              padding: .8rem 0.2rem;
              color: #3ec6ff;
              font-weight: bold;
            }
            .alarm-table thead {
              border: .1rem solid #1EC7F8;
            }

            .alarm-table tbody td {
              text-align: center;
              padding: .3rem .2rem;
            }

            .status-done {
              color: #3ec6ff;
            }

            .status-undone {
              color: #ffb300;
              font-weight: bold;
            }
        }
    }
    .content-center{
        width: 47.5rem;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        .content-center-first{
            height: 33.9rem;
            display: flex;
            flex-direction: column;
            justify-content: flex-end;
            .first-item{
                height: 2.25rem;
                width: 100%;
                display: flex;
                align-items: center;
                font-weight: 400;
                font-size: 1rem;
                color: #F3F3F3;
                .first-item-button1{
                    width: 6rem;
                    height: 2.2rem;
                    background: url("../../../assets/security/button1.png");
                    background-size: 100% 100%;
                    background-repeat: no-repeat;
                    background-position: center;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    font-family: Microsoft YaHei UI;
                    line-height: 30px;
                }
                .first-item-button2{
                    width: 6rem;
                    height: 2.2rem;
                    background: url("../../../assets/security/button2.png");
                    background-size: 100% 100%;
                    background-repeat: no-repeat;
                    background-position: center;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    line-height: 30px;

                }
            }
            .first-item div{
                cursor: pointer;
            }
            .first-item div:hover{
                color: #0074E0;
            }
            .second-item{
                height: 31.2rem;
                width: 100%;
                background: url("../../../assets/security/center-bg.png");
                background-size: 95% 95%;
                background-repeat: no-repeat;
                background-position: center;
                display: flex;
                justify-content: center;
                align-items: center;
            }
        }
        .content-center-second{
            height: 14.5rem;
            .second-item-box{
                margin: 0 2.12rem 0 1.62rem;
                display: flex;
                justify-content: space-between;
                .second-item{
                    width: 20.5rem;
                    height: 11.75rem;
                    .second-item-box1{
                      background: url("../../../assets/security/monitor1.png");
                      background-size: 100% 100%;
                      background-repeat: no-repeat;
                      background-position: center;
                      margin: 1rem;
                      height: calc(100% - 2rem);
                      width: calc(100% - 2rem);
                      color: #fff;
                      font-size: 1.2rem;
                    }
                    .second-item-box2{
                      background: url("../../../assets/security/monitor2.png");
                      background-size: 100% 100%;
                      background-repeat: no-repeat;
                      background-position: center;
                      margin: 1rem;
                      height: calc(100% - 2rem);
                      width: calc(100% - 2rem);
                      color: #fff;
                      font-size: 1.2rem;
                    }
                    .box-text{
                      width: 6.56rem;
                      height: 1.37rem;
                      background: url("../../../assets/security/button3.png");
                      background-size: 100% 100%;
                      background-repeat: no-repeat;
                      background-position: center;
                      font-family: Adobe Heiti Std;
                      font-weight: normal;
                      font-size: 0.8rem;
                      color: #FFFFFF;
                    }
                }
            }
        }
    }
    .content-right{
        width: 32.68rem;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        .first{
            height: 32rem;
            /* 轨迹查询面板科技蓝风格 */
        .track-query-panel {
          padding: 3rem 1rem 1rem 1rem;
          width: 90%;
          border-radius: 12px;
          font-family: 'Microsoft YaHei', Arial, sans-serif;
          color: #b8e6ff;
          position: relative;
          display: flex;
          flex-direction: column;
          justify-content: space-between;
          height: 90%;
          margin: 0 auto;
        }

        .track-section {
        }
        .track-section-box{
          height: 3.6rem;
          display: flex;
          justify-content: space-between;
          align-items: center;
          margin: 0 4rem 0 6rem;
          .track-section-box-item{
            width: 7.5rem;
            display: flex;
            justify-content: center;
          }
        }
        .track-img-list {
          display: flex;
          gap: 12px;
          align-items: center;
          margin-top: 2rem;
        }
        .track-img-add {
          width: 54px;
          height: 54px;
          border: 1.5px dashed #1e90ff;
          border-radius: 7px;
          display: flex;
          align-items: center;
          justify-content: center;
          color: #1e90ff;
          font-size: 32px;
          background: #0a2a4d;
          cursor: pointer;
          transition: background 0.2s;
        }
        .track-img-add:hover {
          background: #1e90ff22;
        }
        .track-img-placeholder {
          width: 4.4rem;
          height: 4.4rem;
          border: .1rem dashed #1e90ff55;
          border-radius: .5rem;
          background: #1e8fff00 url('data:image/svg+xml;utf8,<svg width="32" height="32" xmlns="http://www.w3.org/2000/svg"><rect width="32" height="32" rx="6" fill="%230a2a4d"/><path d="M6 26l7-8 5 6 4-5 4 7" stroke="%231e90ff" stroke-width="2" fill="none"/><circle cx="12" cy="13" r="2" fill="%231e90ff"/></svg>') center/60% no-repeat;
        }
        .track-feature-bar {
          width: 100%;
          height: 3.5rem;
          background: #0a2a4d;
          border: .1rem solid #1e90ff55;
          position: relative;
          margin-top: 3rem;
        }
        .track-time-bar {
          margin-top: 2rem;
          width: 100%;
          height: 3rem;
          background: linear-gradient(90deg, #1e90ff44 0%, #0a2a4d 100%);
          color: #fff;
          text-align: center;
          display: flex;
          justify-content: center;
          align-items: center;
        }
        .track-table {
          overflow: hidden;
          margin-top: 3rem;
          margin-bottom: 2rem;
        }
        .track-table-header, .track-table-row {
          display: flex;
          justify-content: space-around;
          font-size: .8rem;
          line-height: 1.5rem;
        }
        .track-table-header {
          background: #1e90ff22;
          color: #1e90ff;
          font-weight: bold;
        }
        .track-table-row:last-child {
          border-bottom: none;
        }
        }
        .second{
            height: 14.5rem;
            .person-car-bar-chart {
              width: 100%;
              height: 100%;
            }
        }
    }
}
}
.pie3d-title {
  color: #fff;
  font-size: 1.1rem;
  font-weight: bold;
  margin-bottom: 0.3rem;
}
.pie3d-water {
  color: #fff;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}
.pie3d-water-num {
  font-size: 1.3rem;
  color: #3ec6ff;
  background: #0a1e3a;
  border-radius: 0.2rem;
  padding: 0 0.2rem;
  margin: 0 0.2rem;
  letter-spacing: 0.1em;
}
.pie3d-chart {
  width: 100%;
  height: 176px;
  min-height: unset;
  margin: 0 auto;
}


</style>
