From 3c6bdb6f439ff7af04765259fd6a91b6d201d095 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期四, 19 六月 2025 17:12:25 +0800
Subject: [PATCH] 工单,数据中心用户查看数据的权限,合同考核每日,以及导出每日和按月

---
 src/views/home/data-car/index.vue |   35 ++++++++++++++++++++++++++---------
 1 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/src/views/home/data-car/index.vue b/src/views/home/data-car/index.vue
index af1c1a7..d860e8c 100644
--- a/src/views/home/data-car/index.vue
+++ b/src/views/home/data-car/index.vue
@@ -10,7 +10,13 @@
               </el-option>
             </el-select>
           </div>
-          <div>
+          <div class="select-container">
+            <el-select v-model="params.category" placeholder="鏁版嵁绫诲瀷" @change="getChart" clearable>
+              <el-option v-for="item in categories" :key="item.label" :label="item.label" :value="item.value">
+              </el-option>
+            </el-select>
+          </div>
+          <div class="select-container">
             <el-date-picker v-model="date" format="yyyy-MM" value-format="yyyy-MM" type="month" placeholder="閫夋嫨鏈堜唤"
                             @change="dateChange">
             </el-date-picker>
@@ -38,10 +44,14 @@
       date: '',
       params: {
         month: '',
+        category: 1
       },
       options: [
         {label: '鐪佸巺', value: 1},
-        {label: '鍏畨閮�', value: 2}
+      ],
+      categories: [
+        {label: '绱鏁版嵁', value: 1},
+        {label: '姣忔棩鏁版嵁', value: 2},
       ],
       dataList: [],
     }
@@ -78,10 +88,13 @@
       return tempArray;
     },
     getAllDay() {
-      const currentDate = this.date.split('-');
-      const currentYear = currentDate[0];
-      const currentMonth = currentDate[1];
+      // 鑾峰彇褰撳墠鏃ユ湡
+      const currentDate = new Date();
+      const currentYear = currentDate.getFullYear();
+      const currentMonth = (currentDate.getMonth() + 1).toString().padStart(2, '0'); // 鏈堜唤浠�0寮�濮嬶紝闇�瑕佸姞1骞惰ˉ闆�
+      // 鑾峰彇褰撳墠鏈堜唤鐨勫ぉ鏁�
       const daysInMonth = new Date(currentYear, currentMonth, 0).getDate();
+      // 瀛樺偍褰撳墠鏈堜唤姣忎竴澶╃殑鏃ユ湡
       const datesOfMonth = [];
       for (var day = 1; day <= daysInMonth; day++) {
         const formattedDate = currentMonth + '-' + (day.toString().padStart(2, '0'));
@@ -97,9 +110,13 @@
       if (!data.list || data.list.length === 0) {
         snapCount = 0;
       }else {
-        snapCount = data.list[data.list.length - 1].snapCount
+        snapCount = data.list.reduce((max, item) => Math.max(max, item.snapCount), 0)
       }
-      const yMax = Math.max(snapCount, baseLine * 1.2);
+      const yMax = Math.max(snapCount * 1.2, baseLine * 1.2);
+      let interval = 1;
+      while ((yMax) / interval > 100) { // 杩欓噷鐨� 100 鏄竴涓槇鍊硷紝鎮ㄥ彲浠ユ牴鎹渶瑕佽皟鏁�
+        interval *= 10;
+      }
       const colors = ['#5470C6', '#66CC99', '#EE6666'];
       option = {
         color: colors,
@@ -190,7 +207,7 @@
             axisLabel: {
               formatter: function (value) {
                 // 杩斿洖鏁存暟閮ㄥ垎锛屾垨浣跨敤鍏朵粬閫昏緫鏉ユ牸寮忓寲鏍囩
-                return Math.floor(value);
+                return Math.floor(value / interval) * interval;ge
               }
             }
           }
@@ -329,7 +346,7 @@
 }
 
 .select-container {
-  margin: 0 20px;
+  margin-left: 20px;
   width: 180px;
 }
 </style>

--
Gitblit v1.8.0