From 2792c95710da351547c85cc21ee82b233c5bec83 Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Fri, 28 Mar 2025 10:37:11 +0800
Subject: [PATCH] feat: 更新日期组件

---
 package-lock.json                                            |   28 +++++++
 src/components/CommonDateTime.vue                            |   83 ++++++++++++++++++++
 src/views/Home/components/HomeLeft/OverviewNext.vue          |    7 +
 package.json                                                 |    1 
 src/views/Home/components/HomeLeft/InspectionRaskDetails.vue |   95 +++++++++++++++++++++++
 5 files changed, 211 insertions(+), 3 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index 79c0200..8a112a0 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -21,6 +21,7 @@
         "crypto-js": "^4.1.1",
         "dayjs": "^1.10.6",
         "disable-devtool": "^0.3.8",
+        "echarts": "^5.6.0",
         "element-plus": "^2.9.3",
         "highlight.js": "^11.9.0",
         "js-base64": "^3.7.4",
@@ -2225,6 +2226,20 @@
       "version": "3.0.1",
       "resolved": "https://registry.npmjs.org/earcut/-/earcut-3.0.1.tgz",
       "integrity": "sha512-0l1/0gOjESMeQyYaK5IDiPNvFeu93Z/cO0TjZh9eZ1vyCtZnA7KMZ8rQggpsJHIbGSdrqYq9OhuveadOVHCshw=="
+    },
+    "node_modules/echarts": {
+      "version": "5.6.0",
+      "resolved": "https://registry.npmjs.org/echarts/-/echarts-5.6.0.tgz",
+      "integrity": "sha512-oTbVTsXfKuEhxftHqL5xprgLoc0k7uScAwtryCgWF6hPYFLRwOUHiFmHGCBKP5NPFNkDVopOieyUqYGH8Fa3kA==",
+      "dependencies": {
+        "tslib": "2.3.0",
+        "zrender": "5.6.1"
+      }
+    },
+    "node_modules/echarts/node_modules/tslib": {
+      "version": "2.3.0",
+      "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz",
+      "integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="
     },
     "node_modules/element-plus": {
       "version": "2.9.3",
@@ -6863,6 +6878,19 @@
       "resolved": "https://registry.npmmirror.com/wildcard/-/wildcard-1.1.2.tgz",
       "integrity": "sha512-DXukZJxpHA8LuotRwL0pP1+rS6CS7FF2qStDDE1C7DDg2rLud2PXRMuEDYIPhgEezwnlHNL4c+N6MfMTjCGTng==",
       "license": "MIT"
+    },
+    "node_modules/zrender": {
+      "version": "5.6.1",
+      "resolved": "https://registry.npmjs.org/zrender/-/zrender-5.6.1.tgz",
+      "integrity": "sha512-OFXkDJKcrlx5su2XbzJvj/34Q3m6PvyCZkVPHGYpcCJ52ek4U/ymZyfuV1nKE23AyBJ51E/6Yr0mhZ7xGTO4ag==",
+      "dependencies": {
+        "tslib": "2.3.0"
+      }
+    },
+    "node_modules/zrender/node_modules/tslib": {
+      "version": "2.3.0",
+      "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz",
+      "integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="
     }
   }
 }
diff --git a/package.json b/package.json
index c3c455b..dd2d49b 100644
--- a/package.json
+++ b/package.json
@@ -22,6 +22,7 @@
     "crypto-js": "^4.1.1",
     "dayjs": "^1.10.6",
     "disable-devtool": "^0.3.8",
+    "echarts": "^5.6.0",
     "element-plus": "^2.9.3",
     "highlight.js": "^11.9.0",
     "js-base64": "^3.7.4",
diff --git a/src/components/CommonDateTime.vue b/src/components/CommonDateTime.vue
new file mode 100644
index 0000000..e0e5d52
--- /dev/null
+++ b/src/components/CommonDateTime.vue
@@ -0,0 +1,83 @@
+<template>
+    <div class="common-date-time">
+        <el-date-picker
+            v-model="newTime"
+            type="daterange"
+            range-separator="-"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期">
+         </el-date-picker>
+         <div class="time-card">
+            <div class="card-item" v-for="(item,index) in timeList" @click="timeClick">
+                {{ item }}
+            </div>
+         </div>
+    </div>
+</template>
+
+<script setup>
+const newTime = ref([]);
+let timeList = ['今日','本周','本月','本年' ];
+
+let checked = ref(0);
+let timeClick = (item,index) => {
+    checked.value = index;
+}
+</script>
+
+<style scoped lang="scss">
+    .common-date-time {
+        position: relative;
+        top: 19px;
+        display: flex ;
+        justify-content: space-between;
+        :deep(.el-date-editor) {
+            background: rgba(0,15,34,0.5);
+            border-radius: 0px 0px 0px 0px;
+            border: 1px solid #306FCA;
+            height: 28px;
+            
+            .el-input__wrapper {
+                background-color: transparent;
+                box-shadow: 0 0 0 1px #0070FF;
+                
+                &.is-focus {
+                    box-shadow: 0 0 0 1px #0070FF;
+                }
+            }
+
+            .el-range-input {
+                background-color: transparent;
+                color: #fff;
+                height: 28px;
+                &::placeholder {
+                    color: rgba(255, 255, 255, 0.6);
+                }
+            }
+        }
+        .time-card {
+            width: 156px;
+            height: 28px;
+            background: linear-gradient( 270deg, #195BAD 0%, rgba(25,91,173,0) 100%);
+            border-radius: 0px 0px 0px 0px;
+            border: 1px solid #306FCA;
+            font-family: Source Han Sans CN, Source Han Sans CN;
+            font-weight: 400;
+            font-size: 14px;
+            color: #FFFFFF;
+            display: flex;
+            .card-item {
+                width: 40px;
+                height: 28px;
+                line-height: 28px;
+                cursor: pointer;
+            }
+            .active {
+                background: linear-gradient( 270deg, #19AD8D 0%, rgba(25,173,141,0) 100%);
+                box-shadow: inset 0px 0px 8px 0px rgba(0,255,200,0.6);
+                border-radius: 0px 0px 0px 0px;
+                border: 1px solid #30CAA9;
+            }
+        }
+    }
+</style>
\ No newline at end of file
diff --git a/src/views/Home/components/HomeLeft/InspectionRaskDetails.vue b/src/views/Home/components/HomeLeft/InspectionRaskDetails.vue
index 6179597..6685c69 100644
--- a/src/views/Home/components/HomeLeft/InspectionRaskDetails.vue
+++ b/src/views/Home/components/HomeLeft/InspectionRaskDetails.vue
@@ -13,11 +13,16 @@
                </div>
             </div>
         </div>
+        <CommonDateTime></CommonDateTime>
+        <div class="chart-container" ref="chartRef"></div>
     </div>
 </template>
 
 <script setup>
 import { hToV, wToR } from '@/utils/pxConver';
+import * as echarts from 'echarts';
+import CommonDateTime from '@/components/CommonDateTime.vue';
+// import { ref, onMounted } from 'vue';
 
 const list = ref([
   { name: '计划执行', value: 89, color: '#FFFFFF' },
@@ -27,6 +32,86 @@
   { name: '执行失败', value: 10, color: '#FF8E8E' },
 ]);
 
+const chartRef = ref(null);
+
+onMounted(() => {
+    const chart = echarts.init(chartRef.value);
+    const option = {
+        grid: {
+            top: '15%',
+            left: '3%',
+            right: '4%',
+            bottom: '3%',
+            containLabel: true
+        },
+        tooltip: {
+            trigger: 'axis',
+            backgroundColor: 'rgba(0,0,0,0.7)',
+            borderColor: '#0070FF',
+            borderWidth: 1,
+            textStyle: {
+                color: '#fff'
+            },
+            formatter: '{b}日: {c}次'
+        },
+        xAxis: {
+            type: 'category',
+            data: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', 
+                   '11', '12', '13', '14', '15', '16', '17', '18', '19', 
+                   '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30'],
+            axisLine: {
+                show: false  // 隐藏轴线
+            },
+            axisTick: {
+                show: true,
+                length: 2,
+                lineStyle: {
+                    color: '#ffffff'
+                }
+            },
+            axisLabel: {
+                color: '#ffffff',
+                margin: 8
+            }
+        },
+        yAxis: {
+            type: 'value',
+            axisLine: {
+                lineStyle: {
+                    color: '#ffffff'
+                }
+            },
+            axisLabel: {
+                color: '#ffffff'
+            },
+            splitLine: {
+                lineStyle: {
+                    color: 'rgba(255, 255, 255, 0.1)'
+                }
+            }
+        },
+        series: [{
+            data: [10, 15, 8, 20, 12, 18, 15, 22, 16, 19, 
+                   14, 17, 21, 13, 16, 18, 15, 20, 17, 22, 
+                   19, 16, 14, 18, 21, 15, 17, 20, 16, 18],
+            type: 'bar',
+            barWidth: '60%',
+            itemStyle: {
+                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
+                    { offset: 0, color: '#1EE7E7' },
+                    { offset: 1, color: 'rgba(0, 112, 255, 0.1)' }
+                ])
+            }
+        }]
+    };
+    
+    chart.setOption(option);
+    
+    // 监听窗口大小变化
+    window.addEventListener('resize', () => {
+        chart.resize();
+    });
+});
 </script>
 
 <style scoped lang="scss">
@@ -50,7 +135,9 @@
             font-weight: 500;
             font-size: 14px;
             color: #FFFFFF;
+            font-family: Source Han Sans CN, Source Han Sans CN;
             .value {
+                font-family: YouSheBiaoTiHei, YouSheBiaoTiHei;
                 margin-left: 8px;
                 font-size: 26px;
             }
@@ -67,16 +154,22 @@
             line-height: hToV(22);
             padding: 0 10px 10px 0;
             .name {
+                font-family: Source Han Sans CN, Source Han Sans CN;
                 font-weight: 400;
                 font-size: 14px;
                 color: #FFFFFF;
             }
             .value {
-                font-family: Source Han Sans CN, Source Han Sans CN;
+                font-family: YouSheBiaoTiHei, YouSheBiaoTiHei;
                 font-weight: 400;
                 font-size: 26px;
             }
         }
     }
+    .chart-container {
+        width: 100%;
+        height: 200px;
+        margin-top: 20px;
+    }
 }
 </style>
diff --git a/src/views/Home/components/HomeLeft/OverviewNext.vue b/src/views/Home/components/HomeLeft/OverviewNext.vue
index f28bbb2..e0f0ec0 100644
--- a/src/views/Home/components/HomeLeft/OverviewNext.vue
+++ b/src/views/Home/components/HomeLeft/OverviewNext.vue
@@ -79,7 +79,9 @@
             font-weight: 500;
             font-size: 14px;
             color: #FFFFFF;
+            font-family: Source Han Sans CN, Source Han Sans CN;
             .value {
+                font-family: YouSheBiaoTiHei, YouSheBiaoTiHei;
                 margin-left: 8px;
                 font-size: 26px;
             }
@@ -93,12 +95,12 @@
             justify-content: space-between;
             line-height: 30px;
             .name {
+                font-family: Source Han Sans CN, Source Han Sans CN;
                 font-weight: 400;
                 font-size: 14px;
                 color: #FFFFFF;
             }
             .value {
-                font-family: Source Han Sans CN, Source Han Sans CN;
                 font-weight: 400;
                 font-size: 26px;
 
@@ -132,6 +134,7 @@
         }
     }
     .table-list {
+        font-family: Source Han Sans CN, Source Han Sans CN;
         margin: 16px;
         font-weight: 500;
         font-size: 16px;
@@ -146,7 +149,7 @@
             position: relative;
             .yjzx-img {
                 position: absolute;
-                top: hToV(16);
+                top: hToV(14);
                 left: 10px;
             }
             .status {

--
Gitblit v1.9.3