From 89373b8431f8bf4b88288b1dd9de342aab8c468f Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期四, 12 十二月 2024 00:13:52 +0800
Subject: [PATCH] 首页抓拍量按钮

---
 src/views/home/data-face/index.vue    |   34 +++++++++++++----
 src/views/home/data-table/index.vue   |    4 +-
 src/views/home/data-car/index.vue     |   34 +++++++++++++----
 src/views/system/work-order/index.vue |    3 +
 4 files changed, 56 insertions(+), 19 deletions(-)

diff --git a/src/views/home/data-car/index.vue b/src/views/home/data-car/index.vue
index f613634..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,9 +44,14 @@
       date: '',
       params: {
         month: '',
+        category: 1
       },
       options: [
         {label: '鐪佸巺', value: 1},
+      ],
+      categories: [
+        {label: '绱鏁版嵁', value: 1},
+        {label: '姣忔棩鏁版嵁', value: 2},
       ],
       dataList: [],
     }
@@ -77,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'));
@@ -96,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,
@@ -189,7 +207,7 @@
             axisLabel: {
               formatter: function (value) {
                 // 杩斿洖鏁存暟閮ㄥ垎锛屾垨浣跨敤鍏朵粬閫昏緫鏉ユ牸寮忓寲鏍囩
-                return Math.floor(value);
+                return Math.floor(value / interval) * interval;ge
               }
             }
           }
@@ -328,7 +346,7 @@
 }
 
 .select-container {
-  margin: 0 20px;
+  margin-left: 20px;
   width: 180px;
 }
 </style>
diff --git a/src/views/home/data-face/index.vue b/src/views/home/data-face/index.vue
index c6d051f..d55da51 100644
--- a/src/views/home/data-face/index.vue
+++ b/src/views/home/data-face/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>
@@ -39,7 +45,12 @@
       date: '',
       params: {
         month: '',
+        category: 1
       },
+      categories: [
+        {label: '绱鏁版嵁', value: 1},
+        {label: '姣忔棩鏁版嵁', value: 2},
+      ],
       options: [
         {label: '鐪佸巺', value: 1}
       ],
@@ -78,10 +89,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 +111,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,
@@ -191,7 +209,7 @@
             axisLabel: {
               formatter: function (value) {
                 // 杩斿洖鏁存暟閮ㄥ垎锛屾垨浣跨敤鍏朵粬閫昏緫鏉ユ牸寮忓寲鏍囩
-                return Math.floor(value);
+                return Math.floor(value / interval) * interval;
               }
             }
           }
@@ -330,7 +348,7 @@
 }
 
 .select-container {
-  margin: 0 20px;
+  margin-left: 20px;
   width: 180px;
 }
 </style>
diff --git a/src/views/home/data-table/index.vue b/src/views/home/data-table/index.vue
index c567654..e9e4bbf 100644
--- a/src/views/home/data-table/index.vue
+++ b/src/views/home/data-table/index.vue
@@ -5,7 +5,7 @@
       <div class="card-content">
         <div class="title-container">
           <h1>杩愮淮鍒版湡棰勮</h1>
-          <div class="more-button" @click="$router.push({ path: '/point-manage/point' })">
+          <div class="more-button" @click="$router.push({ path: '/point-manage' })">
             <span>鏇村</span>
             <i class="el-icon-arrow-right"></i>
           </div>
@@ -78,4 +78,4 @@
     padding: 0 10px;
   }
 }
-</style>
\ No newline at end of file
+</style>
diff --git a/src/views/system/work-order/index.vue b/src/views/system/work-order/index.vue
index 1b5ef1f..9142161 100644
--- a/src/views/system/work-order/index.vue
+++ b/src/views/system/work-order/index.vue
@@ -1112,7 +1112,8 @@
       this.imageQueryParams.workOrderNo= row.workOrderNo
       this.imageQueryParams.serialNumber= row.serialNumber
       checkWorkOrder(this.imageQueryParams).then((res) => {
-        this.imageUrl = res.data
+        this.imageUrl = this.$img + res.data
+        console.log( "鍥剧墖鍦板潃"+this.imageUrl )
         this.imageLoading = false
       }).catch(() => {
         this.imageLoading = false

--
Gitblit v1.8.0