From 7298d5354963a88643a543b51b90192dc9fc934c Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期四, 11 九月 2025 18:43:14 +0800
Subject: [PATCH] 最新版本541200007

---
 admin/src/views/business/carStatistics.vue |  111 +++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 82 insertions(+), 29 deletions(-)

diff --git a/admin/src/views/business/carStatistics.vue b/admin/src/views/business/carStatistics.vue
index 473fc94..6d31df8 100644
--- a/admin/src/views/business/carStatistics.vue
+++ b/admin/src/views/business/carStatistics.vue
@@ -52,7 +52,7 @@
                         :clearable="false"
                         @change="getRataLists()"
                         :value-format="dateType === 'month' ? 'yyyy-MM' : 'yyyy'"
-                        style="margin-left: 20px; width: 130px;"
+                        style="margin-left: 10px; width: 120px;"
                         placeholder="璇烽�夋嫨">
                     </el-date-picker>
                 </div>
@@ -77,35 +77,37 @@
                             :clearable="false"
                             @change="getReportLists()"
                             :value-format="radio === 'month' ? 'yyyy-MM' : 'yyyy'"
-                            style="margin-left: 20px; width: 130px;"
+                            style="margin-left: 10px; width: 120px;"
                             placeholder="璇烽�夋嫨">
                         </el-date-picker>
                     </div>
                     <el-button type="primary" style="margin-left: 20px;" icon="el-icon-upload2" @click="daochu">瀵煎嚭</el-button>
                 </div>
-                <div class="list_head">
-                    <div class="list_head_item" v-for="(item, index) in column" :key="index">{{item}}</div>
-                </div>
-                <div class="table_box">
-                    <div class="list_content" v-for="(item, index) in list" :key="index">
-                        <div class="list_head_item" v-for="(child, i) in item" :key="i">{{child}}</div>
-                    </div>
-                </div>
+                <template v-if="column.length > 0">
+                    <el-table
+                        style="width: 100%; margin-top: 15px;"
+                        :data="list"
+                        header-row-style="background-color: #F7F7F7;"
+                        border
+                    >
+                        <el-table-column :prop="item" :label="item" align="center" :fixed="index === 0 ? true : index === column.length - 1 ? 'right' : false" v-for="(item, index) in column" :key="index"></el-table-column>
+                    </el-table>
+                </template>
+                <div class="list_wu" v-else>鏆傛棤鏁版嵁</div>
             </div>
             <div class="main_table_list1">
                 <div class="title">
                     <span>鏈勾杞﹁締绱鍏ュ洯缁熻</span>
                 </div>
-                <div class="list_head">
-                    <div class="list_head_item">杞﹁締鍒嗙被</div>
-                    <div class="list_head_item">鍏ュ洯娆℃暟</div>
-                </div>
-                <div class="table_box">
-                    <div class="list_content" v-for="(item, index) in info.yearSortList" :key="index">
-                        <div class="list_head_item">{{item.name}}</div>
-                        <div class="list_head_item">{{item.total}}</div>
-                    </div>
-                </div>
+                <el-table
+                    style="width: 100%; margin-top: 15px;"
+                    :data="info.yearSortList"
+                    header-row-style="background-color: #F7F7F7;"
+                    border
+                >
+                    <el-table-column prop="name" label="杞﹁締鍒嗙被" align="center"></el-table-column>
+                    <el-table-column prop="total" label="鍏ュ洯娆℃暟" align="center"></el-table-column>
+                </el-table>
             </div>
         </div>
     </div>
@@ -166,12 +168,39 @@
       getReportLists() {
         getReportList({ dateStr: this.date1, isGroupBy: this.isGroupBy, type: 0 })
             .then(res => {
-              if (res.length === 0) return
 
               this.column = res[0]
-              this.list = res.slice(1, res.length);
 
-              console.log(res)
+              this.list = res.slice(1).map(row => {
+                const obj = {};
+                this.column.forEach((header, index) => {
+                  obj[header] = row[index];
+                });
+                return obj;
+              });
+              // const keys = res.map(row => row[0]); // 鑾峰彇閿悕
+              // const values = res.map(row => row.slice(1, row.length)); // 鑾峰彇鍊�
+              //
+              // this.list = values[0].map((_, index) => {
+              //   return keys.reduce((obj, key, i) => {
+              //     obj[key] = values[i][index];
+              //     return obj;
+              //   }, {});
+              // });
+
+              console.log(this.column)
+              console.log(this.list)
+
+              // if (res.length === 0) {
+              //   this.column = []
+              //   this.list = []
+              //   return
+              // }
+              //
+              // this.column = res[0]
+              // this.list = res.slice(1, res.length);
+              //
+              // console.log(res)
             })
       },
       changeDateType() {
@@ -223,7 +252,10 @@
 
         let option = {
           tooltip: {
-            trigger: 'item'
+            trigger: 'axis',
+            axisPointer: {
+              type: 'line'
+            }
           },
           legend: {
             show: false,
@@ -259,6 +291,12 @@
             type: 'value',
             axisLine: {
               show: true
+            },
+            axisLabel: {
+              formatter: function (value) {
+                // 鍥涜垗浜斿叆鍒版渶杩戠殑鏁存暟
+                return Math.round(value);
+              }
             }
           },
           series: [
@@ -347,7 +385,7 @@
               labelLine: {
                 normal: {
                   length: 30,
-                  length2: 100,
+                  length2: 70,
                 }
               },
               label: {
@@ -489,7 +527,7 @@
                 background-color: #ffffff;
                 padding: 20px;
                 box-sizing: border-box;
-                flex: 1;
+                width: 69%;
                 .title {
                     display: flex;
                     align-items: center;
@@ -498,6 +536,14 @@
                         font-size: 18px;
                         color: #222222;
                     }
+                }
+                .list_wu {
+                    width: 100%;
+                    height: 100px;
+                    line-height: 100px;
+                    text-align: center;
+                    font-size: 16px;
+                    color: #222222;
                 }
                 .list_head {
                     width: 100%;
@@ -544,8 +590,7 @@
                 }
             }
             .main_table_list1 {
-                margin-left: 10px;
-                width: 520px;
+                width: 30%;
                 padding: 20px;
                 box-sizing: border-box;
                 flex-shrink: 0;
@@ -553,6 +598,14 @@
                 .title {
                     font-weight: 500;
                     font-size: 18px;
+                    color: #222222;
+                }
+                .list_wu {
+                    width: 100%;
+                    height: 100px;
+                    line-height: 100px;
+                    text-align: center;
+                    font-size: 16px;
                     color: #222222;
                 }
                 .list_head {
@@ -637,7 +690,7 @@
             }
 
             .dept_wrap {
-                width: 520px;
+                width: 420px;
                 flex-shrink: 0;
                 height: 100%;
                 background-color: #ffffff;

--
Gitblit v1.9.3