From 3d0b8d97cb710dc8659cbe4440629542a8d8b92b Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期五, 16 一月 2026 14:35:48 +0800
Subject: [PATCH] 更新

---
 pages/index/index.vue |   87 +++++++++++++++++++++++++++++++++++++------
 1 files changed, 74 insertions(+), 13 deletions(-)

diff --git a/pages/index/index.vue b/pages/index/index.vue
index 87e9d47..8e38c80 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -70,7 +70,13 @@
       <text class="chart-title">椤圭洰鏉愭枡杩涘害缁熻</text>
       <!-- 鍥捐〃瀹瑰櫒 -->
       <view class="chart-box">
-        <qiun-data-charts type="bar" :opts="opts" :chartData="chartData" :tooltipShow="false" />
+        <qiun-data-charts 
+          type="bar" 
+          :opts="opts" 
+          :chartData="chartData" 
+          :tooltipShow="false" 
+          @getIndex="handleChartTap"
+        />
       </view>
     </view>
     <!-- 椤圭洰闃舵鎶樼嚎鍥� -->
@@ -107,7 +113,7 @@
         </view>
         <view class="quick-item" @click="goSchedule">
           <view class="quick-icon quick-purple">
-            <uni-icons type="folder" color="#fff" size="36"></uni-icons>
+            <uni-icons type="wallet" color="#fff" size="36"></uni-icons>
           </view>
           <text class="quick-label">鏃ョ▼</text>
         </view>
@@ -206,14 +212,34 @@
       chartData: {},
       opts: {
         color: ["#73C0DE", "#91CB74", "#EE6666"],
-        padding: [15, 30, 0, 10],
+        padding: [15, 45, 0, 10],
         enableScroll: true,
+        dataLabel: false,
         legend: {},
-        xAxis: { boundaryGap: "justify", disableGrid: false, min: 0, axisLine: false },
-        yAxis: { data: [{ type: 'categories', disabled: false, fontSize: 10, formatter: (val) => val.length > 6 ? (val.substring(0, 6) + '...') : val }] },
+        xAxis: { 
+          boundaryGap: "justify", 
+          disableGrid: false, 
+          min: 0, 
+          axisLine: false,
+          format: 'int' 
+        },
+        yAxis: { 
+          data: [{ 
+            type: 'categories', 
+            disabled: false, 
+            fontSize: 12, // 澧炲ぇ杞存枃瀛楀ぇ灏�
+            formatter: (val) => val.length > 8 ? (val.substring(0, 8) + '...') : val // 澧炲姞鍚嶇О鏄剧ず闀垮害
+          }] 
+        },
         extra: {
-          bar: { type: "stack", width: 32, categoryGap: 2, dataLabel: true, labelPosition: "right", labelWidth: 40 },
-
+          bar: { 
+            type: "stack", 
+            width: 30, 
+            categoryGap: 8, 
+            dataLabel: false, // 涓嶅湪琛ㄦ牸鍥句笂鐩存帴鏄剧ず鏁板��
+            labelPosition: "center", 
+            labelWidth: 40 
+          },
         }
       },
       // 椤圭洰闃舵鎶樼嚎鍥炬暟鎹笌閰嶇疆
@@ -475,18 +501,53 @@
       const base = this.selectedIds.length ? this.projectList.filter(p => this.selectedIds.includes(Number(p.id))) : this.projectList
       console.log("绛涢�夊悗:{}", base)
       const categories = base.map(p => p.projectName)
-      const completed = base.map(p => p.co)
-      const inProgress = base.map(p => p.co2)
-      const notStarted = base.map(p => p.co3)
+      
+      // 澶勭悊鏁版嵁锛氬皢 0 杞崲涓� null锛岄伩鍏嶅湪鍥捐〃涓樉绀� "0" 瀵艰嚧鏍囩鎸ゅ湪涓�璧�
+      const formatData = (val) => (val === 0 || val === '0') ? null : Number(val);
+      
+      const completed = base.map(p => formatData(p.co))
+      const inProgress = base.map(p => formatData(p.co2))
+      const notStarted = base.map(p => formatData(p.co3))
+      
       this.chartData = {
         categories,
         series: [
-          { name: '宸插鐞�', data: completed },
-          { name: '寰呭鐞�', data: inProgress },
-          { name: '鏈鐞�', data: notStarted }
+          { name: '宸插鐞�', data: completed, dataLabel: false },
+          { name: '寰呭鐞�', data: inProgress, dataLabel: false },
+          { name: '鏈鐞�', data: notStarted, dataLabel: false }
         ]
       };
     },
+    handleChartTap(e) {
+      // 鍏煎涓嶅悓骞冲彴鍜岀増鏈殑浜嬩欢缁撴瀯锛屽皾璇曚粠涓嶅悓浣嶇疆鑾峰彇 currentIndex
+      let index = -1;
+      if (e && typeof e.currentIndex !== 'undefined') {
+        index = e.currentIndex;
+      } else if (e && e.detail && typeof e.detail.currentIndex !== 'undefined') {
+        index = e.detail.currentIndex;
+      }
+      // 鍙湁鐐瑰嚮鍒版湁鏁堢殑鏌辩姸鍥撅紙绱㈠紩 >= 0锛夋椂鎵嶅鐞�
+      if (index.index >= 0) {
+        const projectName = this.chartData.categories[index.index];
+        let content = '';
+        if (this.chartData.series) {
+          this.chartData.series.forEach(serie => {
+      
+            if (serie.data && serie.data[index.index] !== null && serie.data[index.index] !== undefined) {
+              content += `${serie.name}锛�${serie.data[index.index]}\r\n`;
+            }
+          });
+        }
+        if (content.trim()) {
+          uni.showModal({
+            title: projectName,
+            content: content.trim(),
+            showCancel: false,
+            confirmText: '纭畾'
+          });
+        }
+      }
+    },
     // 椤圭洰闃舵鎶樼嚎鍥撅細x杞翠负 鍦ㄥ簱銆佸墠鏈熴�佸疄鏂姐�佺宸ワ紝妯℃嫙鐧惧垎姣旇秼鍔�
     async buildPhaseChart() {
       let categories = ['鍦ㄥ簱', '鍓嶆湡', '瀹炴柦', '绔e伐'];

--
Gitblit v1.8.0