<template>
  <div class="dashboard-container">
    <!-- 顶部导航栏 -->
    <header class="dashboard-header">
      <div class="logo">
        <div class="logo_header">
          <i class="icon-dashboard">
            <img src="@/assets/images/headers/config_header.png" alt="" style="width: 20px; height: 20px;">
          </i>
          <span class="logo_header_content">通信曲线</span>
        </div>
        <div class="logo_header_right">
          <span class="logo_header_right_content">[区域一特事故]</span>
        </div>
      </div>

      <div class="logo logo_right">
        <hr class="divider">
      </div>
      <div class="header-controls">
        <button class="close-btn" @click="emits('handleScreenConfigeClose')">×</button>
      </div>
    </header>

    <!-- 主体内容区 -->
    <main class="dashboard-main">
      <!-- 标签页导航 -->
      <div class="tabs-container">
        <div class="tab-item" :class="{ 'active': activeTab === 'equipmentCount' }"
          @click="activeTab = 'equipmentCount'">
          对象选取
        </div>
        <div class="tab-item" :class="{ 'active': activeTab === 'failureStatus' }" @click="activeTab = 'failureStatus'">
          模板列表
        </div>
        <div class="tab-indicator" :style="indicatorStyle"></div>
      </div>

      <!-- 标签页内容区域 -->
      <div class="tab-content">
        <!-- 根据选中的标签显示不同内容 -->
        <div v-if="activeTab === 'equipmentCount'" class="tab-panel">
          <!-- 地面站设备数量内容 -->
          <div class="equipment-content">
            <!-- 下拉选择器区域 -->
            <div class="selector-container">
              <div class="selector-item">
                <label class="selector-label">{{ keliSelector.label }}</label>
                <div class="custom-select">
                  <!-- 地面粒度 -->
                  <el-select v-model="keliSelector.value" placeholder="" style="width: 100%;" @change="keliOnChange">
                    <el-option v-for="item in keliSelector.options" :key="item.value" :label="item.label"
                      :value="item.value" />
                  </el-select>
                </div>
              </div>

              <div class="selector-item" v-if="!isGlobal">
                <label class="selector-label" style="visibility: hidden;">占位符</label>
                <div class="custom-select">
                  <el-select v-model="childrenSelector.value" placeholder="" style="width: 100%;" :disabled="isGlobal"
                    @change="childrenOnChange">
                    <el-option v-for="item in childrenSelector.options" :key="item.value" :label="item.label"
                      :value="item.value" />
                  </el-select>
                </div>
              </div>


              <div class="selector-item">
                <label class="selector-label">模板列表</label>
                <div class="custom-select">
                  <!-- 模版列表下拉框 -->
                  <el-select v-model="templateSelector" placeholder="请选择模板列表" @change="templateOnChange"
                    style="width: 100%;">
                    <el-option v-for="item in templateSelectorOptions" :key="item.value" :label="item.label"
                      :value="item.value" />
                  </el-select>
                </div>
              </div>
            </div>
            <!-- 弹框中展示两种 -->
            <div class="content-item" style="height: 480px;">

              <!-- <KeepAlive> -->
              <component :is="currentComponent1" :data="[capacityData, trafficData]" :title="titles[0]" slogan="容量/流量"
                :yName="yName1" :legendName="['链路层容量', '用户实际流量']" :lineArray="true" :istemplate="true">
              </component>
              <!-- </KeepAlive> -->


              <!-- <KeepAlive> -->
              <component :is="currentComponent2" :data="[availabilityData, actualAvailabilityData]" :title="titles[1]"
                slogan="可用性" :yName="yName2" :legendName="['规划可用性', '实际可用性']" :lineArray="true" :istemplate="true">
              </component>
              <!-- </KeepAlive> -->

              <!-- <KeepAlive> -->
              <component :is="currentComponent3" :data="[delayData, lossRateData]" :title="titles[2]" slogan="网络时延/丢包"
                :yName="yName3" :legendName="['搜星时延', '丢包率']" :lineArray="false" :istemplate="true">
              </component>
              <!-- </KeepAlive> -->

            </div>
            <div>
              <el-button type="primary" @click="handleConfigApplay" class="apply-btn apply-btn-right">应用</el-button>
            </div>
          </div>
        </div>

        <div v-if="activeTab === 'failureStatus'" class="tab-panel">
          <!-- 模板案例情况内容 -->
          <div class="failure-content">
            <div class="templateCase_left templateCase">
              <div class="templateCase_left_header">
                <div class="templateCase_left_header_item_title">模板列表</div>
                <div class="templateCase_left_header_item_tool">
                  <el-icon @click="handleDelete" title="删除" style="cursor: pointer">
                    <Delete />
                  </el-icon>
                  <el-icon @click="handleAdd" title="添加" style="cursor: pointer">
                    <Plus />
                  </el-icon>

                </div>
              </div>
              <div class="templateCase_left_content">
                <div class="templateCase_left_content_item" v-for="(item, index) in templateCaseList"
                  :key="item.templateId" @click="templateCaseClickFn(item, index)"
                  :class="{ 'CaseClickActive': activeTemplateIndex === index }">
                  {{ item.templateName }}
                </div>
              </div>
            </div>
            <div class="templateCase_right templateCase">
              <screenConfigCase ref="screenConfigCaseRef" :settingConfig="currentSettingConfig"></screenConfigCase>
            </div>

          </div>
          <el-button type="primary" class="apply-btn" @click="handleApply">应用</el-button>
        </div>
      </div>
    </main>
  </div>
</template>

<script setup>

import { ref, computed, onMounted, watch, markRaw, nextTick } from 'vue';
import hotMapComponent from '@/pages/all/components/hotMapComponents/index.vue';
import cdf from '@/pages/all/components/cdf/index.vue';
import instant from '@/pages/all/components/instant/index.vue';
import screenConfigCase from './screenConfigCase.vue';
import Loading from '@/pages/all/components/loadingComponent/index.js'
import {
  getAvailability, getTemplateList, templateAdd, templateDel,
  templateDetail, templateuUpdate, templateConfigAdd, templateConfigQuery, getCapacity, getTraffic,
  getDelay, getLossRate, getPanelCurve, getGridInfoList,
  getPaneldetailApi,//选择下拉框模版时获取这个模版的信息用于回显信息
} from '@/api/Zodiac';
import useAppStore from '@/store/module/app'
import { ElMessage, ElMessageBox } from 'element-plus'

// istemplate---弹框配置模版时要有模版数据,正常右边显示时没数据时不显示模版数据
let currentComponent1 = ref(markRaw(hotMapComponent))   //容量流量  热力图
let currentComponent2 = ref(markRaw(cdf))  //可用性 CDF曲线  
let currentComponent3 = ref(markRaw(instant))  //let  瞬时值曲线组件   //前面那个人写的好乱更屎一样，我服了，在这里偷偷吐槽一下嘿嘿

let capacityData = ref([])
let trafficData = ref([])
let delayData = ref([])
let lossRateData = ref([])
let availabilityData = ref([])
let actualAvailabilityData = ref([])

const resetData = () => {
  capacityData.value = []
  trafficData.value = []
  delayData.value = []
  lossRateData.value = []
  availabilityData.value = []
  actualAvailabilityData.value = []
}
// y轴单位
const yName1 = ref({
  type: true,
  value: ["Mbps", 'Mbps']
})
const yName2 = ref({
  type: false,
  value: ['s', 'dB']
})
const yName3 = ref({
  type: true,
  value: ["ms", ""]
})
const screenConfigCaseRef = ref()

const currentSettingConfig = ref()
const templateCaseList = ref([])


const appStore = useAppStore();

const emits = defineEmits(['handleScreenConfigeClose']);
// 标签页状态管理
const activeTab = ref('equipmentCount'); // 默认选中"地面站设备数量"

watch(activeTab, (newVal) => {
  templateSelector.value = '' // 切换标签页时重置模板选择
});
const titles = ref(['', '', '']);
let currentHotMapCountry = null

const keliSelector = ref(
  {
    label: '地面粒度',
    value: 'global',
    options: [
      {
        value: 'global',
        label: '全球',
      },
      {
        value: 'region',
        label: '区域',
      },
      {
        value: 'station',
        label: '信关站',
      },
      {
        value: 'grid',
        label: '格网',
      }
    ]
  });

//根据前选择器决定后选择器
const childrenSelector = ref(
  {
    label: '',
    value: '',
    options: []
  }
)

const isGlobal = computed(() => keliSelector.value.value === 'global');

const templateSelector = ref()
const templateSelectorOptions = ref([])

watch(() => templateCaseList.value, () => {
  // console.log('templateCaseList', templateCaseList.value)
  templateSelectorOptions.value = templateCaseList.value.map(item => ({
    label: item.templateName,
    value: item.templateId
  }))
})


const dropdownVisible = ref([false, false, false]);
const handleDelete = () => {
  if (!currentSettingConfig.value.templateId) {
    ElMessage({
      type: 'error',
      message: '请先选择一个模板',
    })
    return
  }
  console.log(currentSettingConfig.value, '删除信息', templateCaseList.value);

  ElMessageBox.confirm(
    `您确定删除 [${currentSettingConfig.value.templateName}] ?`,
    'Warning',
    {
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: 'warning',
    }
  )
    .then(async () => {
      //判断是新加的模版还是接口返回的模版
      if (currentSettingConfig.value.templateAdd) {
        templateCaseList.value = templateCaseList.value.filter(it => it.templateId != currentSettingConfig.value.templateId)
        ElMessage({
          type: 'success',
          message: '删除成功',
        })
        return
      }
      const ret = await templateDel({
        templateId: currentSettingConfig.value.templateId // 模板id 
      })
      if (ret.code == 200) {
        await handleList() // 刷新列表获取最新数据
        currentSettingConfig.value = templateCaseList.value[0] || {} // 删除后默认选中第一个模板
        activeTemplateIndex.value = 0;
      }
      ElMessage({
        type: 'success',
        message: '删除成功',
      })
    })
};
const handleAdd = () => {
  screenConfigCaseRef.value.resetConfig() // 重置配置项
  currentSettingConfig.value = null // 新增时清空当前配置，避免影响新增模板的添加
  const templateId = Date.now();
  templateCaseList.value.push({
    //新增模板
    templateName: '新增模板', //模板名
    templateId,   // 模板id，后端生成的应该是uuid，这里先用时间戳模拟
  })

  currentSettingConfig.value = {
    templateName: '新增模板',
    templateAdd: true,
    templateId,
  }

  activeTemplateIndex.value = templateCaseList.value.length - 1; // 设置当前选中为新增的模板

};
// 初始化选中值
onMounted(async () => {
  await handleConfigData()
  await handleList();
  await getPanelCurveData(
    {
      granularity: keliSelector.value.value,//类型
      // startTime: '2026-01-03 23:59:59',
      // endTime: '2026-01-04 23:59:59',
      regionName: keliSelector.value.value == 'region' ? childrenSelector.value.value : null,//区域名称
      signalSiteCode: keliSelector.value.value == 'station' ? childrenSelector.value.value : null,//信关站编码
      gridCodes: keliSelector.value.value == 'grid' ? childrenSelector.value.value : null,//格网编码
    }
  )

  // await handleConfigData()
  // await getCapacityAndTrafficData()
  // await getAvailabilityData();
});

// 切换下拉菜单显示
const toggleDropdown = (index) => {
  // 关闭其他下拉菜单
  dropdownVisible.value = dropdownVisible.value.map((val, i) => i === index ? !val : false);
};

// 容量
const getCapacityData = async (data) => {
  const obj = {
    startTime: '2025-11-03 23:59:59',
    endTime: '2025-11-04 23:59:59',

  }

  const res = await getCapacity({ ...data, ...obj })
  if (res.code == 200) {
    CapacityAndTrafficData.value.push(res.data)
  }
}

// //流量

const getTrafficData = async (data) => {
  data.startTime = '2026-01-03 23:59:59'
  data.endTime = '2026-01-04 23:59:59'
  const res = await getTraffic(data)
  if (res.code == 200) {
    CapacityAndTrafficData.value.push(res.data)
  }
}

const getDelayData = async (data) => {
  data.startTime = '2025-01-03 23:59:59'
  data.endTime = '2025-01-04 23:59:59'
  data = {
    ...data,
    curveType: currentSettingConfig.value.latencyCurveType,
    standard: currentSettingConfig.value.latencyGeoStandard,
    timeStandard: currentSettingConfig.value.latencyTimeStandard
  }
  const res = await getDelay(data)
  if (res.code == 200) {
    delayAndLossData.value.push(res.data)
  }
}

const getLossRateData = async (data) => {
  data.startTime = '2026-01-03 23:59:59'
  data.endTime = '2026-01-04 23:59:59'
  const res = await getLossRate(data)
  if (res.code == 200) {
    delayAndLossData.value.push(res.data)
  }
}

const getAvailabilityData = async (data) => {
  const res = await getAvailability(data)
  if (res.code == 200) {
    // AvailabilityData.value.push(res.data)
  }
  console.log('可用性', res)
}
//初始时调取当亲模版信息
const getPanelCurveData = async (data) => {
  const res = await getPanelCurve(data)
  if (res.code == 200) {
    console.log('所有曲线数据', res.data)
    capacityData.value = res.data.capacity
    trafficData.value = res.data.traffic
    delayData.value = res.data.delay
    lossRateData.value = res.data.lossRate
    availabilityData.value = res.data.availability
    actualAvailabilityData.value = res.data?.actualAvailability || []
  }
}
// 下拉框选中模版时自动回显对应模版信息接口
const getPaneldetailApiFn = async (data) => {
  const res = await getPaneldetailApi(data)
  if (res.code == 200) {
    console.log('所有曲线数据', res.data)
    capacityData.value = res.data.capacity
    trafficData.value = res.data.traffic
    delayData.value = res.data.delay
    lossRateData.value = res.data.lossRate
    availabilityData.value = res.data.availability
    actualAvailabilityData.value = res.data?.actualAvailability || []
  }
}
const activeTemplateIndex = ref(0);
const templateCaseClickFn = (item, index) => {
  activeTemplateIndex.value = index;
  currentSettingConfig.value = item;
};
// 点击外部关闭下拉菜单
document.addEventListener('click', (e) => {
  if (!e.target.closest('.custom-select')) {
    dropdownVisible.value = [false, false, false];
  }
});

// 计算指示器位置
const indicatorStyle = computed(() => {
  return activeTab.value === 'equipmentCount'
    ? { left: '0%', width: '50%' }
    : { left: '50%', width: '50%' };
});

const keliOnChange = () => {
  childrenSelector.value.value = ''
  switch (keliSelector.value.value) {
    case 'region':
      console.log('appStore.regionPanelData', appStore.regionPanelData)
      childrenSelector.value.options = appStore.regionPanelData;

      break;
    case 'grid':
      childrenSelector.value.options = appStore.gridPanelData
      break;
    case 'station':
      childrenSelector.value.options = appStore.signalSitePanelData
      break;
  }
  console.log('childrenSelector.value', childrenSelector.value)
}

const childrenOnChange = (item) => {
  // console.log(item)
  if (keliSelector.value.value == 'region') {
    currentHotMapCountry = item
  }

}

watch(() => keliSelector.value.value, keliOnChange)
// 模版列表--确认
const handleApply = async () => {
  let ret = null
  Loading.show()
  if (currentSettingConfig.value.templateAdd) { // 如果是新增的模板，先调用新增接口，再调用修改接口
    ret = await templateAdd({
      // templateName: currentSettingConfig.value.templateName, // 模板名
      ...screenConfigCaseRef.value.configData() // 获取当前配置
    })
  } else {
    ret = await templateuUpdate({
      templateId: currentSettingConfig.value.templateId, // 模板id
      ...screenConfigCaseRef.value.configData() // 获取当前配置
    })
  }

  if (ret.code == 200) {
    await handleList() // 刷新列表获取最新数据
    Loading.hide();
    ElMessage({
      message: '模板设置成功',
      type: 'success',
    })
  }
}

const handleConfigApplay = async () => {

  if (templateSelector.value == null || templateSelector.value == '') {
    ElMessage({
      message: '请先选择一个模板',
      type: 'error',
    })
    return
  }
  Loading.show()
  const ret = await templateConfigAdd({
    granularity: keliSelector.value.value,
    granularityValue: childrenSelector.value.value,
    selectedTemplate: templateSelector.value
  })
  if (ret.code == 200) {
    const data = {
      granularity: keliSelector.value.value,
      // startTime: '2026-01-03 23:59:59',
      // endTime: '2026-01-04 23:59:59',
      regionName: keliSelector.value.value == 'region' ? childrenSelector.value.value : null,
      signalSiteCode: keliSelector.value.value == 'station' ? childrenSelector.value.value : null,
      gridCodes: keliSelector.value.value == 'grid' ? childrenSelector.value.value : null,

    }
    await getPanelCurveData(data);
    Loading.hide()
    appStore.chartConfig = {
      _capacityData: capacityData.value,
      _trafficData: trafficData.value,
      _delayData: delayData.value,
      _availabilityData: availabilityData.value,
      _lossRateData: lossRateData.value,
      _actualAvailabilityData: actualAvailabilityData.value,
      component1: currentComponent1.value,
      component2: currentComponent2.value,
      component3: currentComponent3.value,
      _titles: titles.value
    }
    appStore.currentHotMapCountry = currentHotMapCountry
    emits('handleScreenConfigeClose')//关闭弹窗
    // console.log('appStore.chartConfig 传递的时候', appStore.chartConfig)

    // Promise.all([
    //   // getCapacityData(data),
    //   // getTrafficData(data),
    //   // getAvailabilityData(data),
    //   getDelayData(data),
    //   // getLossRateData(data)
    // ]).then(() => {
    //   ElMessage({
    //     message: '曲线数据获取成功',
    //     type: 'success',
    //   })
    // }).catch(() => {
    //   ElMessage({
    //     message: '曲线数据获取失败',
    //     type: 'error',
    //   })
    // })
    // const ret = await getCapacityData(data)
    // await getTrafficData(data)
  }

}

const handleConfigData = async () => {
  const ret = await templateConfigQuery()
  if (ret.code == 200 && ret.data !== null && ret.data?.templateConfigResponse !== null) {
    keliSelector.value.value = ret.data.granularity
    setTimeout(() => {
      childrenSelector.value.value = ret.data.granularityValue
      templateSelector.value = ret.data.templateConfigResponse.templateId
    }, 0);
    currentSettingConfig.value = ret.data.templateConfigResponse
    calculateConfig(ret.data.templateConfigResponse)


    // getPanelCurveData({
    //   granularity: ret.data.granularity,
    //   regionName: ret.data.granularity == 'region' ? ret.data.granularityValue : null,
    //   signalSiteCode: ret.data.granularity == 'station' ? ret.data.granularityValue : null,
    //   gridCodes: ret.data.granularity == 'grid' ? ret.data.granularityValue : null,
    // })
    // nextTick(() => {
    //   childrenSelector.value.value = ret.data.granularityValue
    //   templateSelector.value = ret.data.templateConfigResponse.templateId
    // })
    // calculateTitle(ret.data.templateConfigResponse)
  }
  // console.log('ret', ret)
}

const handleList = async () => {
  const ret = await getTemplateList()
  if (ret.code == 200) {
    templateCaseList.value = ret.data;
    currentSettingConfig.value = ret.data[activeTemplateIndex.value]
    Loading.hide()
  }
}

const templateOnChange = async (val) => {
  const selectedTemplate = templateCaseList.value.find(item => item.templateId === val)
  currentSettingConfig.value = selectedTemplate
  console.log('切换模版', templateSelectorOptions);

  resetData() // 切换模板时重置数据，避免数据混乱
  // console.log('selectedTemplate', selectedTemplate)
  // availabilityCurveType
  // capacityCurveType
  // latencyCurveType
  await getPaneldetailApiFn(
    {
      granularity: keliSelector.value.value,//类型
      selectedTemplate: templateSelector.value,//模版编码
      // startTime: '2026-01-03 23:59:59',
      // endTime: '2026-01-04 23:59:59',
      regionName: keliSelector.value.value == 'region' ? childrenSelector.value.value : null,//区域名称
      signalSiteCode: keliSelector.value.value == 'station' ? childrenSelector.value.value : null,//信关站编码
      gridCodes: keliSelector.value.value == 'grid' ? childrenSelector.value.value : null,//格网编码
    }
  )
  calculateConfig();

}

const calculateConfig = (selectedTemplate = currentSettingConfig.value) => {
  const obj = {
    '2': cdf,
    '3': hotMapComponent,
    '1': instant
  }

  currentComponent1.value = obj[selectedTemplate.capacityCurveType]
  currentComponent2.value = obj[selectedTemplate.availabilityCurveType]
  currentComponent3.value = obj[selectedTemplate.latencyCurveType]

  const curveType = {
    '1': '瞬时值曲线',
    '2': 'CDF曲线',
    '3': '热力图'
  }

  const geoTimeStandard = {
    '1': '最小值',
    '2': '平均值',
    '3': '最大值',
  }


  titles.value[0] = curveType[selectedTemplate.capacityCurveType] + '-' + geoTimeStandard[selectedTemplate.capacityGeoStandard] + '-' + geoTimeStandard[selectedTemplate.capacityTimeStandard]
  titles.value[1] = curveType[selectedTemplate.availabilityCurveType] + '-' + geoTimeStandard[selectedTemplate.availabilityGeoStandard] + '-' + geoTimeStandard[selectedTemplate.availabilityTimeStandard]
  titles.value[2] = curveType[selectedTemplate.latencyCurveType] + '-' + geoTimeStandard[selectedTemplate.latencyGeoStandard] + '-' + geoTimeStandard[selectedTemplate.latencyTimeStandard]

}








</script>

<style scoped>
/* 基础样式设置 */
.dashboard-container {
  /* width: 900px; */

  background-color: #000000;
  color: #080606;
  /* display: flex;
  flex-direction: column; */




  position: fixed;
  /* 改为fixed定位 */
  left: 10%;
  top: 10%;

  width: 1550px;

  z-index: 1001;
  overflow: hidden;
}

/* 头部样式 */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 50px;
  padding: 0rem 1rem;
}

.logo {
  display: flex;
  align-items: center;
  height: 100%;
  width: 200px;
  justify-content: space-between;
  color: #ffffff;
}

.logo_header {
  width: 90px;
  height: 100%;
  align-items: center;
  justify-content: space-between;
  display: flex;
}

.icon-dashboard {
  width: 10px;
  height: 10px;
  display: flex;
  align-items: center;
}

.logo_header_content {
  font-weight: 900;
  font-size: 16px;
  /* font-family: 'Consolas', monospace;  */
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.logo_header_right {
  display: flex;
  padding-left: 10px;
  align-items: center;
  width: 100px;
  height: 100%;
}

.logo_header_right_content {
  color: #000000;
  padding: 2px;
  font-size: 12px;
  border-radius: 5px;
  font-weight: 200;
  background-color: #6ffcba;
}

.logo_right {
  width: 80%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.divider {
  width: 100%;
  border: none;
  border-top: 1px solid #3e3f3f;
  margin: 0;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.close-btn {
  background: none;
  border: none;
  color: #8890a6;
  cursor: pointer;
  font-size: 1.2rem;
  transition: color 0.2s;
}

.close-btn:hover {
  color: #ffffff;
}

/* 主内容区域 */
.dashboard-main {
  flex: 1;
  padding: 1rem;
  overflow-y: hidden;
}

/* 标签页样式 */
.tabs-container {
  display: flex;
  width: 300px;
  background-color: #0f172a;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  /* margin-bottom: 5px; */
}

.tab-item {
  flex: 1;
  padding: 8px 0;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #cbd5e1;
  font-size: 14px;
  position: relative;
  z-index: 1;
}

.tab-item.active {
  color: #ffffff;
  font-weight: 500;
}

/* 标签页激活指示器 */
.tab-indicator {
  position: absolute;
  height: 100%;
  background: linear-gradient(to bottom, #2c78f5, #000000);
  border-bottom: 1px solid #2c78f5;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 标签页内容区域 */
.tab-content {
  background-color: rgba(15, 23, 42, 0.5);
  border-radius: 8px;
  padding: 5px 15px;
}

.equipment-content {
  height: 600px;
}

.tab-panel {
  /* min-height: 600px; */
  height: 600px;
  /* max-height: 700px; */
  color: #e2e8f0;
}

.failure-content {
  display: flex;
  flex-direction: row;
  font-size: 15px;
  width: 1500px;
  height: 500px;
  /* gap: 20px; 添加间距 */
  /* height: 500px; */
  /* background-color: rgba(1, 73, 241, 0.5); */
  /* padding: 15px; 添加内边距 */
  border-radius: 8px;
  /* 添加圆角 */
}

.templateCase {
  flex: 1;
  height: 100%;
  /* width: 500px; */
  /* background-color: rgba(241, 1, 81, 0.5); */
  /* border-radius: 6px; 添加圆角 */
  /* border: 1px solid rgba(255, 255, 255, 0.1); 添加边框 */
  /* padding: 10px; 添加内边距 */
  overflow: hidden;
  /* 防止内容溢出 */
}

/* 可以为左右两侧添加不同样式 */
.templateCase_left {
  flex: 0.151;
  height: 100%;

  /* background-color: rgba(241, 1, 81, 0.5); */
  /* border-radius: 6px; */
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  /* padding: 10px; */
  overflow: hidden;
}

.templateCase_right {
  flex: 1;
  height: 100%;
  background-color: rgba(2, 2, 2, 0.5);
  /* border-radius: 6px; */
  /* border: 1px solid rgba(255, 255, 255, 0.1); */
  /* padding: 10px; */
  /* overflow: hidden; */
}


.templateCase_right_content {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  /* background-color: #2b70df; */
  /* padding: 10px 10px; */
}


/* 新增样式 */
.horizontal-sections {
  display: flex;
  height: 100%;
  /* gap: 10px; 可选：段落之间的间距 */
}

.section-item {
  flex: 1;
  height: 100%;
  background-color: #1e293b;
  /* 您可以选择合适的背景色 */
  border: 1px solid rgba(255, 255, 255, 0.1);
  /* 可选：边框 */
  padding: 10px 10px;
  /* border-radius: 4px; 可选：圆角 */
}

.templateCase_right_content_header_item {

  height: 100%;
  width: 8%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* background-color: #6ffcba; */

}

.templateCase_left_header {
  display: flex;
  padding: 10px 0;
}

.templateCase_left_header_item_title {
  flex: 0.61;
  padding-left: 10px;
  /* background-color: #2c60b4; */
}

.templateCase_left_header_item_tool {
  display: flex;
  justify-content: flex-end;
  flex: 0.39;
  gap: 15px;
  padding-right: 10px;
  align-items: center;
  /* 垂直居中对齐 */
}





.templateCase_left_content {
  /* background-color: #6ffcba; */
  width: 100%;
  height: 100%;
  overflow-y: auto;
}

.templateCase_left_content_item {
  height: 40px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: left;
  padding: 10px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
  /* background-color: #2c78f5; */
}

.CaseClickActive {
  background: linear-gradient(to right, #193d77 0, rgba(0, 0, 0, 1) 100%);
}

.templateCase_left_content_item:hover {
  background: linear-gradient(to right, #2b70df 0, rgba(0, 0, 0, 1) 100%);
}

/* 下拉选择器样式 */
.selector-container {
  display: flex;
  gap: 20px;
  /* padding: 10px 0; */

}

.selector-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 15px;
}

.selector-label {
  font-size: 14px;
  color: #94a3b8;
}

.custom-select {
  position: relative;
  width: 160px;
  /* color: #ffffff; */
  border: 1px solid #000000;
}

:deep(.custom-select .el-select__wrapper) {
  height: 12.5px;
}

:deep(.custom-select .el-select) {
  background: #000000;
  border: 1px solid #000000;
  /* color: #ffffff; */
}

:deep(.custom-select .el-select .el-select__wrapper) {
  background: #000000;
  border: 1px solid #000000;
  box-shadow: 0 0 2px rgba(131, 131, 131, 0.95);
  /* color: #ffffff; */
}

:deep(.custom-select.el-range-input) {
  color: #ffffff;
  /* font-size: 10px; */
}

:deep(.el-popper) {
  background-color: #000000 !important;
}

:deep(.el-select-dropdown) {
  background: #000000 !important;
}

:deep(.el-select-dropdown) {
  background-color: #000000 !important;
}

.select-trigger {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background-color: #91380f;
  border: 1px solid #334155;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  color: #e2e8f0;
}

.select-value {
  flex: 1;
  text-align: left;
}

.select-arrow {
  font-size: 10px;
  color: #94a3b8;
  transition: transform 0.2s;
}

.custom-select:hover .select-arrow {
  color: #e2e8f0;
}

.select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 2px;
  background-color: #1e293b;
  border: 1px solid #334155;
  border-radius: 4px;
  z-index: 10;
  max-height: 150px;
  overflow-y: auto;
}

.dropdown-option {
  padding: 6px 12px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
}

.dropdown-option:hover {
  background-color: #334155;
  color: #ffffff;
}

.content-item {
  display: flex;
  flex-direction: row;
  height: 440px;
  gap: 20px;
  padding: 10px 5px;
  /* background-color: #1c5abe; */
}

.content-item>* {
  flex: 1;
  min-width: 0;
}

.content-item>*:not(:last-child) {
  padding-right: 10px;
  border-right: 1px solid #1b1b1b;
  /* 右边框样式 */
}

.apply-btn-right {
  position: absolute;
  bottom: 16px;
}

:deep(.apply-btn) {
  width: 100px;
  height: 30px;
  /* margin-top: 10%; */
  border: none;
  border-radius: 0px;
  background: linear-gradient(to bottom, #2c78f5 0, rgba(0, 0, 0, 1));
  color: #ffffff;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 1px solid #2c78f5;
}

/* 滚动条样式 */
.select-dropdown::-webkit-scrollbar {
  width: 6px;
}

.select-dropdown::-webkit-scrollbar-track {
  background: #1e293b;
}

.select-dropdown::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 3px;
}

.select-dropdown::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* 下拉框禁止和正常的文字颜色 */
:deep(.custom-select .el-select__wrapper) .el-select__placeholder {
  color: #ffffff;
}

:deep(.custom-select .el-select__wrapper.is-disabled) .el-select__placeholder {
  color: #cccccc91 !important;
}
</style>