<template>
  <div class="index5-container">
    <!-- 右侧内容，根据showRankingTable状态动态调整宽度 -->
    <div class="right-content" :style="{ width: showRankingTable ? '70%' : '100%' }">
      <!-- 第一行：4个图标，每个占据25%宽度 -->
      <div class="icons-row">
        <!-- 修改我的待办卡片的布局和角标位置 -->
        <el-card class="floating-card icon-item" @click="toRoute(1)">
          <div class="todo-content">
            <div class="icon-wrapper">
              <div class="icon-circle bg-color-blue">
                <el-icon class="fa fa-pencil text-primary blue-color"></el-icon>
                <!-- 角标位置调整到卡片右上角 -->
                <div v-if="homePageData.todoNum>0" class="badge">{{ homePageData.todoNum }}</div>
              </div>
            </div>
            <div class="icon-label">我的待办</div>
          </div>
        </el-card>
        <!-- 修改我处理的卡片的布局 -->
        <el-card class="floating-card icon-item" @click="toRoute(3)">
          <div class="todo-content">
            <div class="icon-wrapper">
              <div class="icon-circle bg-color-red">
                <el-icon class="fa fa-check text-danger"></el-icon>
              </div>
            </div>
            <div class="icon-label">我处理的</div>
          </div>
        </el-card>
        <el-card class="floating-card icon-item">
          <div class="todo-content">
            <div class="icon-wrapper">
              <div class="icon-circle bg-color-green">
                <el-icon class="fa fa-wrench green-color"></el-icon>
              </div>
            </div>
            <div>
              <div class="card-header">
                <span class="card-title">维保工单总数</span>
              </div>
              <div class="card-content">
                <div class="data-value green-color">{{ homePageData.workOrderNum }}</div>
              </div>
              <!-- <div class="data-description" :style="{ color: getTextColor(homePageData.workOrderJsy) }">
                <i v-if="homePageData.workOrderJsy > 0">+</i>
                {{ homePageData.workOrderJsy }}% 较上月
              </div> -->
            </div>
          </div>
        </el-card>
        <el-card class="floating-card icon-item">
          <div class="todo-content">
            <div class="icon-wrapper">
              <div class="icon-circle bg-color-yellow">
                <el-icon class="fa fa-cogs deep-yellow-color"></el-icon>
              </div>
            </div>
            <div>
              <div class="card-header">
                <span class="card-title">维修工单总数</span>
              </div>
              <div class="card-content">
                <div class="data-value deep-yellow-color">{{ homePageData.repairOrderNum }}</div>
              </div>
              <!-- <div class="data-description" :style="{ color: getTextColor(homePageData.repairOrderJsy) }">
                <i v-if="homePageData.repairOrderJsy > 0">+</i>
                {{ homePageData.repairOrderJsy }}% 较上月
              </div> -->
            </div>
          </div>
        </el-card>
      </div>

      <!-- 第二行：3个表单，工时和工分卡片各占据20%宽度，个人排名卡片占据60%宽度 -->
      <div class="forms-row">
          <el-card class="floating-card form-item work-hour-card">
            <div class="todo-content">
              <div class="icon-wrapper">
                <div class="icon-circle bg-color-purple">
                  <el-icon class="fa fa-clock-o purple-color"></el-icon>
                </div>
              </div>
              <div>
                <div class="card-header">
                  <span class="card-title">本月工时(小时)</span>
                </div>
                <div class="card-content">
                  <div class="data-value purple-color">{{ formatWorkValue(homePageData.wbgs) }}</div>
                </div>
                <!-- <div class="data-description" :style="{ color: getTextColor(homePageData.wbjsy) }">
                  <i v-if="homePageData.wbjsy > 0">+</i>
                  {{ homePageData.wbjsy }}% 较上月
                </div> -->
              </div>
            </div>
          </el-card>
          <el-card class="floating-card form-item work-score-card">
            <div class="todo-content">
              <div class="icon-wrapper">
                <div class="icon-circle bg-color-orange">
                  <el-icon class="fa fa-star orange-color"></el-icon>
                </div>
              </div>
              <div>
                <div class="card-header">
                  <span class="card-title">本月工分</span>
                </div>
                <div class="card-content">
                  <div class="data-value orange-color">{{ formatWorkValue(homePageData.score) }}</div>
                </div>
                <!-- <div class="data-description" :style="{ color: getTextColor(homePageData.gfjsy) }">
                  <i v-if="homePageData.gfjsy > 0">+</i>
                  {{ homePageData.gfjsy }}% 较上月
                </div> -->
              </div>
            </div>
          </el-card>
        <div class="form-item ranking-card">
          <el-card class="data-card floating-card">
            <div class="card-header">
              <span class="sort-title">个人排名</span>
            </div>
            <div class="card-content">
              <!-- 添加个人排名内容 -->
              <div class="ranking-container">
                <!-- 场站排名 -->
                <div class="ranking-info horizontal-ranking">
                  <div class="ranking-section">
                    <!-- 第一行：东山风电场 -->
                    <div class="ranking-row" @click="showRankingList('dept')">{{ homePageData.deptName }}</div>

                    <!-- 第二行：3/15 和 第3名 -->
                    <div class="ranking-row" @click="showRankingList('dept')">
                      <div class="ranking-item">
                        <div class="circle bg-light-blue">
                          <span class="circle-text blue-bold">{{ homePageData.deptSort+'/'+homePageData.scoreDept.length }}</span>
                        </div>
                        <span class="black-bold" style="margin-right: 5px;">第{{ homePageData.deptSort }}名</span>
                        <i
                          v-if="homePageData.deptSort < 4"
                          class="fa fa-trophy"
                          :style="{ color: homePageData.deptSort === 1 ? '#FFD700' : homePageData.deptSort === 2 ? '#C0C0C0' : '#CD7F32' , 'font-size': '20px'} "
                        ></i>
                      </div>
                    </div>
                  </div>
                </div>

                <!-- 中心排名 -->
                <div class="ranking-info horizontal-ranking">
                  <div class="ranking-section">
                    <!-- 第三行：陆上设备维保中心 -->
                    <div class="ranking-row" @click="showRankingList('center')">{{ homePageData.center }}</div>

                    <!-- 第四行：12/86 和 第12名 -->
                    <div class="ranking-row" @click="showRankingList('center')">
                      <div class="ranking-item">
                        <div class="circle bg-light-blue">
                          <span class="circle-text blue-bold">{{ homePageData.centerSort+'/'+homePageData.scoreCenter.length }}</span>
                        </div>
                        <span class="black-bold" style="margin-right: 5px;">第{{ homePageData.centerSort }}名</span>
                        <i
                          v-if="homePageData.centerSort < 4"
                          class="fa fa-trophy"
                          :style="{ color: homePageData.centerSort === 1 ? '#FFD700' : homePageData.centerSort === 2 ? '#C0C0C0' : '#CD7F32' , 'font-size': '20px'}"
                        ></i>
                      </div>
                    </div>
                  </div>
                </div>

                <!-- 公司排名 -->
                <div class="ranking-info horizontal-ranking">
                  <div class="ranking-section">
                    <!-- 第五行：公司 -->
                    <div class="ranking-row" @click="showRankingList('company')">{{ homePageData.companyName }}</div>

                    <!-- 第六行：45/320 和 第45名 -->
                    <div class="ranking-row" @click="showRankingList('company')">
                      <div class="ranking-item">
                        <div class="circle bg-light-blue">
                          <span class="circle-text blue-bold">{{ homePageData.companySort+'/'+homePageData.scoreCompany.length }}</span>
                        </div>
                        <span class="black-bold" style="margin-right: 5px;">第{{ homePageData.companySort }}名</span>
                        <i
                          v-if="homePageData.companySort < 4"
                          class="fa fa-trophy"
                          :style="{ color: homePageData.companySort === 1 ? '#FFD700' : homePageData.companySort === 2 ? '#C0C0C0' : '#CD7F32' , 'font-size': '20px'}"
                        ></i>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </el-card>
        </div>

      </div>      <!-- 第三行：工单数据列表 -->
      <div class="list-row">
        <el-card class="list-card floating-card">
          <template #header>
            <div class="list-header">
              <i class="fa fa-table blue-color" style="margin-right: 10px;"></i>
              <span>工分明细列表</span>
              <div class="header-buttons">
                <el-input
                  v-model="queryParams.orderCode"
                  placeholder="搜索工单编码..."
                  @keyup.enter="handleQuery"
                  style="width: 200px; margin-right: 10px;"
                  prefix-icon="search"
                  clearable
                />
              </div>
            </div>
          </template>
          <el-table :data="orderPersonList" style="width: 100%">
            <el-table-column prop="orderCode" label="工单编码" header-align="center" align="center"></el-table-column>
            <el-table-column prop="center" label="维保中心" header-align="center" align="center"></el-table-column>
            <el-table-column prop="parent" label="所属场站" header-align="center" align="center"></el-table-column>
            <el-table-column prop="pcs" label="作业场站" header-align="center" align="center"></el-table-column>
            <el-table-column prop="orderType" label="工单类型" header-align="center" align="center"></el-table-column>
            <el-table-column prop="finishDate" label="完成日期" header-align="center" align="center"></el-table-column>
            <el-table-column prop="score" label="得分" header-align="center" align="center" :formatter="formatScore"></el-table-column>
          </el-table>
          <pagination
              v-show="total > 0"
              :total="total"
              v-model:page="queryParams.pageNum"
              v-model:limit="queryParams.pageSize"
              @pagination="applyFilter"
            />
        </el-card>
      </div>
    </div>
    <div class="sort-form" v-if="showRankingTable">
      <!-- 新增的排名列表卡片 -->
        <div style="width: 100%;height: 100%;">
          <el-card class="floating-card ranking-table-card">
            <div class="card-content">
              <el-table :data="currentRankingData" style="width: 100%;" height="800">
                <el-table-column prop="rank" label="排名" width="80" align="center"></el-table-column>
                <el-table-column prop="name" label="名字" width="120" align="center">
                  <template #default="scope">
                    <span :style="{ color: scope.row.name === homePageData.nickName ? 'red' : '' }">{{ scope.row.name }}</span>
                  </template>
                </el-table-column>
                <el-table-column prop="station" label="场站" align="center"></el-table-column>
                <el-table-column prop="finalScore" label="工分" width="80" align="center"></el-table-column>
              </el-table>
            </div>
          </el-card>
        </div>
    </div>
  </div>
</template>

<script>
import { ref, reactive } from 'vue';
import { selectHomePageData } from '@/api/gxt/repairOrder';
import { listMyTodo } from '@/api/gxt/orderMine';
import { listGxtOrderPerson } from '@/api/gxt/gxtOrderPerson';
import { encryptParams } from '@/utils/encrypt';
import { getConfigKey } from '@/api/system/config';

export default {
  name: 'Index5',
  data() {
    return {
      // 添加时间筛选相关数据
      selectedPeriod: '本月', // 选中的时间段（本月、上月、本季度）
      startDate: '', // 开始日期
      endDate: '', // 结束日期
      // 添加查询参数
      total: 0,
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        orderCode: null,
      },
      orderPersonList: [],
      // 添加首页统计数据
      homePageData: {
        workOrderNum: 120, // 维保工单总数
        workOrderJsy: 15,  // 维保工单较上月增长百分比
        repairOrderNum: 85, // 维修工单总数
        repairOrderJsy: 8,  // 维修工单较上月增长百分比
        wbgs: 168,         // 本月工时
        wbjsy: 12,         // 本月工时较上月增长百分比
        score: 92,         // 本月工分
        gfjsy: 5,           // 本月工分较上月增长百分比
        repairPending: 0,
        workPending: 0,
        pendingNum: 0,
        todoNum: 0,        // 我的待办数量
        hasCenter: null,
        timeOutNum: 0,
        scoreCompany: [],
        companySort: null,
        scoreCenter: [],
        centerSort: null,
        scoreDept: [],
        deptSort: null,
        deptName: null,
        center: null,
        companyName: null,
      },
      // 新增的数据属性
      showRankingTable: false, // 控制排名列表卡片显示
      currentRankingType: '', // 当前显示的排名类型
      currentRankingData: [], // 当前显示的排名数据
      // 定时器
      timer: null
    }
  },
  created() {
    this.loadHomePageData(); // 首次加载首页统计数据
    this.applyFilter();

    // 设置定时器，每3秒执行一次loadHomePageData函数
    this.timer = setInterval(() => {
      this.loadHomePageData();
    }, 3000);
  },
  methods: {
    // 在组件销毁前清除定时器
    beforeDestroy() {
      if (this.timer) {
        clearInterval(this.timer);
        this.timer = null;
      }
    },
    // 新增的方法：显示排名列表
    showRankingList(type) {
      // 如果点击的是同一个排名类型，则隐藏列表卡片
      if (this.currentRankingType === type) {
        this.showRankingTable = false;
        this.currentRankingType = '';
        this.currentRankingData = [];
      } else {
        // 否则显示对应类型的排名列表
        this.currentRankingType = type;
        this.showRankingTable = true;

        // 根据类型设置数据并按finalScore排序实现RANK模式
        let rankingData = [];
        if (type === 'dept') {
          rankingData = [...this.homePageData.scoreDept];
        } else if (type === 'center') {
          rankingData = [...this.homePageData.scoreCenter];
        } else if (type === 'company') {
          rankingData = [...this.homePageData.scoreCompany];
        }

        // 按finalScore降序排序
        rankingData.sort((a, b) => (b.finalScore || 0) - (a.finalScore || 0));

        // 实现RANK模式排名
        const rankedData = [];
        rankingData.forEach((item, index) => {
          // 计算RANK排名
          let rank = index + 1;
          // 如果当前项的finalScore与前一项相同，则排名也相同
          if (index > 0 && item.finalScore === rankingData[index - 1].finalScore) {
            rank = rankedData[index - 1].rank;
          }

          rankedData.push({
            rank: rank,
            name: item.nickName,
            station: item.deptName,
            finalScore: item.finalScore || 0
          });
        });

        this.currentRankingData = rankedData;
      }
    },
    applyFilter() {
      // 获取工单人员列表数据
      listGxtOrderPerson(this.queryParams).then(response => {
        if (response.code === 200) {
          this.total = response.total;
          this.orderPersonList = response.rows;
        }
      });
    },
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.applyFilter();
    },
    formatScore(row, column, cellValue) {
      if (cellValue == null || cellValue === '') return '--'; // 处理空值
      return parseFloat(cellValue).toFixed(2); // 保留两位小数
    },
    // 格式化工时和工分显示，0显示为0，小数位超过两位时四舍五入
    formatWorkValue(value) {
      if (value == null || value === '') return '--'; // 处理空值
      const num = parseFloat(value);
      // 四舍五入保留两位小数
      const rounded = num.toFixed(2);
      // 去掉不必要的末尾0
      return parseFloat(rounded).toString();
    },
    // 加载首页统计数据
    loadHomePageData() {
      selectHomePageData().then(response => {
        if (response.code === 200) {
          this.homePageData.nickName = response.data.nickName;
          this.homePageData.workOrderNum = response.data.workOrderNum || 0;
          this.homePageData.workOrderJsy = response.data.workOrderJsy || 0;
          this.homePageData.repairOrderNum = response.data.repairOrderNum || 0;
          this.homePageData.repairOrderJsy = response.data.repairOrderJsy || 0;
          this.homePageData.wbgs = response.data.wbgs || 0;
          this.homePageData.wbjsy = response.data.wbjsy || 0;
          this.homePageData.score = response.data.score || 0;
          this.homePageData.gfjsy = response.data.gfjsy || 0;
          this.homePageData.repairPending = response.data.repairPending || 0;
          this.homePageData.workPending = 0;
          this.homePageData.pendingNum = this.homePageData.repairPending + this.homePageData.workPending;
          this.homePageData.hasCenter = response.data.hasCenter;
          this.homePageData.timeOutNum = response.data.timeOutNum;
          this.homePageData.scoreCompany = response.data.scoreCompany || [];
          this.homePageData.companySort = response.data.companySort || null;
          this.homePageData.scoreCenter = response.data.scoreCenter || [];
          this.homePageData.centerSort = response.data.centerSort || null;
          this.homePageData.scoreDept = response.data.scoreDept || [];
          this.homePageData.deptSort = response.data.deptSort || null;
          this.homePageData.deptName = null;
          this.homePageData.center = null;
          this.homePageData.companyName = null;
          if(response.data.scoreDept.length>0){
            this.homePageData.deptName = response.data.scoreDept[0].deptName;
            this.homePageData.center = response.data.scoreDept[0].center;
            this.homePageData.companyName = response.data.scoreDept[0].companyName;
          }
        }
      });

      // 获取我的待办数量
      listMyTodo({ pageNum: 1, pageSize: 1 }).then(response => {
        if (response.code === 200) {
          this.homePageData.todoNum = response.total || 0;
        }
      });
    },
    getTextColor(jsy) {
      if(jsy>0) {
        return '#22c55e';
      }else if(jsy<0) {
        return '#ef4444';
      }else{
        return 'gray';
      }
    },
    toRoute(num) {
      if(num==0) {
        // 获取系统配置中的超时时间参数
        getConfigKey("gxt.order.timeout").then(response => {
          let timeoutValue = 30; // 默认值
          if (response && response.msg) {
            timeoutValue = parseInt(response.msg) || 30;
          }

          // 加密参数并传递到目标路由页面
          const params = {
            timeOutNum: timeoutValue,
            workOrderStatus: 'assigned'
          };
          const encryptedParams = encryptParams(params);
          this.$router.push({
            path: "/workOrder/repairOrder",
            query: {
              data: encryptedParams
            }
          });
        }).catch(() => {
          // 如果获取配置失败，使用默认值
          const params = {
            timeOutNum: 30,
            workOrderStatus: 'assigned'
          };
          const encryptedParams = encryptParams(params);
          this.$router.push({
            path: "/workOrder/repairOrder",
            query: {
              data: encryptedParams
            }
          });
        });
      }else if(num==1) {
        this.$router.push("/mine/orderMyTodo");
      }else if (num==2) {
        this.$router.push("/mine/orderMyCreate");
      }else if (num==3) {
        this.$router.push("/mine/orderMyDone");
      }else{
        this.$router.push("/mine/orderMyRelate");
      }
    },
  }
}
</script>

<style scoped>
.index5-container {
  display: flex;
  padding: 20px;
  min-height: calc(100vh - 84px);
  position: relative;
}

.right-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.right-content.full-width {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sort-form {
  width: 30%;
  height: 100%;
  box-sizing: border-box;
  margin-left: 10px;
}

.form-card {
  height: 100%;
}

.form-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 20px;
  text-align: center;
}

.form-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
  width: 100%;
}

.form-button {
  text-align: center;
}

.filter-button {
  color: white;
  border: none;
  width: 100%;
  margin-bottom: 10px;
}

.filter-button:hover {
  opacity: 0.9;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.reset-button {
  background-color: #165dff;
}

.apply-button {
  background-color: #165dff;
}

/* 图标行样式 */
.icons-row {
  display: flex;
  justify-content: space-between;
}

.icon-item {
  width: 24%;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.icon-item:hover {
  transform: scale(1);
}

.icon-wrapper {
  position: relative;
}

.icon-circle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  font-size: 18px;
  position: relative;
  margin: 10px;
}

.icon-size {
  width: 18px;
  height: 18px;
}

.blue-color {
  color: #165dff;
}

.green-color {
  color: #00b42a;
}

.purple-color {
  color: #a855f7;
}

.deep-yellow-color {
  color: #c98701;
}

.orange-color {
  color: #f97316;
}

.bg-color-blue {
  background-color: #dbeafe;
}

.bg-color-yellow {
  background-color: #fef9c3;
}

.bg-color-red {
  background-color: #fee2e2;
}

.bg-color-green {
  background-color: #dcfce7;
}

.bg-color-orange {
  background-color: #ffedd5;
}

.bg-color-purple {
  background-color: #f3e8ff;
}

.icon-label {
  font-size: 14px;
  color: #606266;
}

.badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background-color: #ff4d4f;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 10;
}

/* 表单行样式 */
.forms-row {
  display: flex;
  justify-content: space-between;
}

.form-item {
  width: 32.5%; /* 留一些间距 */
}
.work-hour-card {
  width: 24%;
}

.work-score-card {
  width: 24%;
}

.ranking-card {
  width: 49.3%;
}
.data-card {
  min-height: 120px;
  height: auto;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.card-title {
  font-size: 14px;
}

.sort-title {
  /* 字体大小：比内容大一号，视觉层级突出 */
  font-size: 18px;
  /* 字体粗细：加粗，强化标题属性 */
  font-weight: 600;
  /* 颜色：深色主色调，与内容浅灰色区分 */
  color: #2c3e50;
  /* 间距：底部留白，与内容拉开距离 */
  margin: 0 0 5px 0;
  /* 装饰：底部短横线，增强视觉区分 */
  /* padding-bottom: 8px; */
  /* border-bottom: 2px solid #3498db; */
  /* 行高：保证垂直居中，视觉舒适 */
  /* line-height: 1.4; */
  /* 可选：文字不换行，避免标题折行影响美观 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.card-content {
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
}

.data-value {
  font-size: 32px;
  font-weight: bold;
  margin-bottom: 5px;
}

.data-description {
  font-size: 13px;
  color: #909399;
}

/* 列表行样式 */
.list-row {
  flex: 1;
}

.list-header {
  font-weight: bold;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-buttons {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

/* 表头加粗 */
.el-table th {
  font-weight: bold !important;
}

/* 悬浮卡片通用样式 */
.floating-card {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.3s ease;
}

.floating-card:hover {
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

/* 时间筛选标题样式 */
.time-filter-title {
  font-size: 16px;
  margin: 20px 0 10px 0;
  text-align: left;
  color: #303133;
}

/* 时间段按钮容器 */
.period-buttons {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
}

/* 时间段按钮样式 */
.period-button {
  flex: 1;
  padding: 5px;
  background-color: #f5f7fa;
  color: #606266;
  border: 1px solid #dcdfe6;
}

.todo-content {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin: 8px;
  gap: 10px;
}

/* 选中的时间段按钮样式 */
.period-button.active {
  background-color: #165dff;
  color: white;
  border-color: #165dff;
}

/* 日期选择器容器 */
.date-picker-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
}

/* 日期选择器 */
.date-picker {
  flex: 1;
}

/* 日期分隔符 */
.date-separator {
  margin: 0 3px;
  color: #606266;
}

/* 表单卡片调整 */
.form-card {
  height: auto;
}

/* 维度筛选样式 */
.filter-card {
  background: white;
  border-radius: 8px;
}

/* 修改复选框选中时的颜色 */
.el-checkbox :deep(.el-checkbox__input.is-checked .el-checkbox__inner) {
  background-color: #165dff;
  border-color: #165dff;
}

.tree-select {
  margin-bottom: 0px;
}

.tree-header {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 0;
  cursor: pointer;
  user-select: none;
}

.tree-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.tree-content.show {
  max-height: 500px;
  transition: max-height 0.3s ease-in;
}

.checkbox-item {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.checkbox-input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.rotate-90 {
  transform: rotate(-90deg);
}

.rotate-180 {
  transform: rotate(180deg);
}

.hidden {
  display: none;
}

.flex {
  display: flex;
}

.justify-between {
  justify-content: space-between;
}

.items-center {
  align-items: center;
}

.mb-4 {
  margin-bottom: 1rem;
}

.ml-2 {
  margin-left: 0.5rem;
}

.mt-1 {
  margin-top: 0.25rem;
}

.pl-2 {
  padding-left: 0.5rem;
}

.border-l-2 {
  border-left-width: 2px;
}

.border-neutral-200 {
  border-color: #e5e5e5;
}

.cursor-pointer {
  cursor: pointer;
}

.font-semibold {
  font-weight: 600;
}

.font-medium {
  font-weight: 100;
}

.text-lg {
  font-size: 1.125rem;
}

.text-neutral-700 {
  color: #404040;
}

.text-neutral-400 {
  color: #a3a3a3;
}

.transition-transform {
  transition: transform 0.3s ease;
}

.duration-300 {
  transition-duration: 300ms;
}

.flex-1 {
  flex: 1 1 0%;
}

/* 添加个人排名相关的样式 */
.ranking-container {
  display: flex;
  width: 100%;
  justify-content: space-between;
}
.horizontal-ranking {
  flex: 1;
  width: 33%;
  padding: 0 5px;
  box-sizing: border-box;
}
.ranking-section {
  width: 100%;
}

.ranking-info {
  width: 100%;
}

.ranking-row {
  display: flex;
  align-items: center;
  width: 100%;
  margin-bottom: 8px;
  font-size: 14px;
  cursor: pointer; /* 添加指针样式表示可点击 */
}
.ranking-row:hover {
  background-color: #f5f7fa; /* 添加hover效果 */
}

.ranking-row:last-child {
  margin-bottom: 0;
}

.ranking-item {
  display: flex;
  align-items: center;
}

.circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
}

.bg-light-blue {
  background-color: #dbeafe;
}

.circle-text {
  font-size: 12px;
}

.blue-bold {
  color: #165dff;
  font-weight: bold;
}

.black-bold {
  color: #000;
  font-weight: bold;
}

/* 工时和工分卡片靠上对齐样式 */
  .top-aligned {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .top-aligned .card-header {
    align-self: stretch;
  }

  .top-aligned .card-content {
    align-self: stretch;
    justify-content: flex-start;
  }

  .top-aligned .data-description {
    align-self: stretch;
  }

  /* 新增的排名列表卡片样式 */
  .ranking-table-card {
    width: 100%;
    height: 100%;
  }
</style>