From ffa22cc18c75c0a73a3fd987e2b62fbf55316db2 Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期四, 25 六月 2026 15:22:46 +0800
Subject: [PATCH] 测试完成

---
 src/components/StatisticsCards/index.vue |   76 +++++++++++++++++++++----------------
 1 files changed, 43 insertions(+), 33 deletions(-)

diff --git a/src/components/StatisticsCards/index.vue b/src/components/StatisticsCards/index.vue
index 4ffa324..3f44f00 100644
--- a/src/components/StatisticsCards/index.vue
+++ b/src/components/StatisticsCards/index.vue
@@ -6,8 +6,8 @@
         :key="index"
         :xs="12"
         :sm="8"
-        :md="colSpan"
-        :lg="colSpan"
+        :md="dynamicColSpan"
+        :lg="dynamicColSpan"
       >
         <el-tooltip
           :content="getTooltipContent(item.name)"
@@ -20,15 +20,16 @@
             :body-style="item.router ? 'cursor: pointer' : 'cursor: default'"
             :class="getCardClass(item.name)"
           >
-            <div
-              class="card-content"
-              @click="handleCardClick(item)"
-            >
+            <div class="card-content" @click="handleCardClick(item)">
               <div class="card-label">
                 <span class="label-text">{{ item.name }}</span>
               </div>
               <div class="card-value">
-                {{ item.value !== undefined && item.value !== null ? item.value : 0 }}
+                {{
+                  item.value !== undefined && item.value !== null
+                    ? item.value
+                    : 0
+                }}
               </div>
             </div>
           </el-card>
@@ -44,28 +45,28 @@
   props: {
     cardlist: {
       type: Array,
-      default: () => []
+      default: () => [],
     },
     colSpan: {
       type: Number,
-      default: 4
+      default: 4,
     },
     showExtra: {
       type: Boolean,
-      default: true
+      default: true,
     },
     ycvalue: {
       type: Number,
-      default: 0
+      default: 0,
     },
     jgvalue: {
       type: Number,
-      default: 0
+      default: 0,
     },
     showWarningCondition: {
       type: Boolean,
-      default: false
-    }
+      default: false,
+    },
   },
   computed: {
     mergedCardList() {
@@ -74,43 +75,52 @@
       if (this.showExtra) {
         list.push({
           name: "寮傚父",
-          value: this.ycvalue
+          value: this.ycvalue,
         });
       }
 
       if (this.showWarningCondition) {
         list.push({
           name: "璀﹀憡",
-          value: this.jgvalue
+          value: this.jgvalue,
         });
       }
 
       return list;
-    }
+    },
+    // 鍔ㄦ�佽绠楁瘡鍒楀崰鐨勬爡鏍兼暟
+    dynamicColSpan() {
+      const totalCards = this.mergedCardList.length;
+
+      if (totalCards <= 4) return 6; // 涓�琛�4涓�
+      if (totalCards <= 6) return 4; // 涓�琛�6涓�
+      if (totalCards <= 8) return 3; // 涓�琛�8涓�
+      return 2; // 涓�琛�12涓�
+    },
   },
   methods: {
     getCardClass(name) {
       const classMap = {
-        "鎮h�呮湇鍔℃�婚噺": "total-card",
-        "鏃犻渶闅忚": "no-follow-card",
-        "闇�闅忚": "need-follow-card",
-        "寰呴殢璁�": "pending-card",
-        "宸插畬鎴�": "completed-card",
-        "寮傚父": "error-card",
-        "璀﹀憡": "warning-card"
+        鎮h�呮湇鍔℃�婚噺: "total-card",
+        鏃犻渶闅忚: "no-follow-card",
+        闇�闅忚: "need-follow-card",
+        寰呴殢璁�: "pending-card",
+        宸插畬鎴�: "completed-card",
+        寮傚父: "error-card",
+        璀﹀憡: "warning-card",
       };
       return classMap[name] || "default-card";
     },
 
     getTooltipContent(name) {
       const tooltips = {
-        "鎮h�呮湇鍔℃�婚噺": "鎮h�呮湇鍔℃�婚噺 = 鏃犻渶闅忚 + 闇�闅忚",
-        "鏃犻渶闅忚": "鏃犻渶闅忚锛氫笉闇�瑕佽繘琛岄殢璁跨殑鎮h�呮暟閲�",
-        "闇�闅忚": "闇�闅忚 = 寰呴殢璁� + 宸插畬鎴�",
-        "寰呴殢璁�": "寰呴殢璁匡細绛夊緟杩涜闅忚鐨勬偅鑰呮暟閲�",
-        "宸插畬鎴�": "宸插畬鎴愶細宸插畬鎴愰殢璁跨殑鎮h�呮暟閲�",
-        "寮傚父": "寮傚父鏁版嵁缁熻",
-        "璀﹀憡": "璀﹀憡鏁版嵁缁熻"
+        鎮h�呮湇鍔℃�婚噺: "鎮h�呮湇鍔℃�婚噺 = 鏃犻渶闅忚 + 闇�闅忚",
+        鏃犻渶闅忚: "鏃犻渶闅忚锛氫笉闇�瑕佽繘琛岄殢璁跨殑鎮h�呮暟閲�",
+        闇�闅忚: "闇�闅忚 = 寰呴殢璁� + 宸插畬鎴�",
+        寰呴殢璁�: "寰呴殢璁匡細绛夊緟杩涜闅忚鐨勬偅鑰呮暟閲�",
+        宸插畬鎴�: "宸插畬鎴愶細宸插畬鎴愰殢璁跨殑鎮h�呮暟閲�",
+        寮傚父: "寮傚父鏁版嵁缁熻",
+        璀﹀憡: "璀﹀憡鏁版嵁缁熻",
       };
       return tooltips[name] || "";
     },
@@ -120,8 +130,8 @@
         this.$router.push(item.router);
       }
       this.$emit("card-click", item);
-    }
-  }
+    },
+  },
 };
 </script>
 

--
Gitblit v1.9.3