From a080bc96952bff153be3fc1e8de9b080d942886c Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Fri, 28 Mar 2025 11:09:56 +0800
Subject: [PATCH] feat:调整头部组件

---
 src/views/Home/components/HomeLeft/InspectionRaskDetails.vue |  117 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 108 insertions(+), 9 deletions(-)

diff --git a/src/views/Home/components/HomeLeft/InspectionRaskDetails.vue b/src/views/Home/components/HomeLeft/InspectionRaskDetails.vue
index ff3dc53..3c80ed1 100644
--- a/src/views/Home/components/HomeLeft/InspectionRaskDetails.vue
+++ b/src/views/Home/components/HomeLeft/InspectionRaskDetails.vue
@@ -1,5 +1,6 @@
 <!-- 巡检任务详情 -->
 <template>
+    <common-title title="巡检任务情况" style="margin-left: 14px;" @details="detailsFun"></common-title>
     <div class="inspection-rask-details">
         <div class="inspection-num">
             <div class="total">
@@ -13,11 +14,15 @@
                </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 CommonTitle from '@/components/CommonTitle.vue';
+import CommonDateTime from '@/components/CommonDateTime.vue';
 
 const list = ref([
   { name: '计划执行', value: 89, color: '#FFFFFF' },
@@ -27,56 +32,150 @@
   { name: '执行失败', value: 10, color: '#FF8E8E' },
 ]);
 
+const detailsFun = () => {
+  console.log('details');
+};
+
+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">
 .inspection-rask-details {
     margin-left: 29px;
-    padding: hToV(16) 16px;
+    padding: 16px 16px;
     width: 390px;
-    height: hToV(414);
+    height: 414px;
     background: linear-gradient( 270deg, rgba(31,62,122,0) 0%, rgba(31,62,122,0.35) 21%, #1F3E7A 100%);
     border-radius: 0px 0px 0px 0px;
     opacity: 0.85;
     .inspection-num {
         background: url('@/assets/images/inspection-num.png') no-repeat center / 100% 100%;
         width: 360px;
-        height: hToV(118);
+        height: 118px;
         position: relative;
         .total {
             position: absolute;
             left: 34px;
-            top: hToV(34);
+            top: 44px;
             font-weight: 500;
             font-size: 14px;
             color: #FFFFFF;
+            font-family: Source Han Sans CN, Source Han Sans CN;
+            line-height: 19px;
             .value {
+                font-family: YouSheBiaoTiHei, YouSheBiaoTiHei;
                 margin-left: 8px;
                 font-size: 26px;
             }
         }
         .status {
             position: absolute;
-            top: hToV(8);
+            top: 8px;
             right: 10px;
             width: 200px;
             display: flex;
             flex-wrap: wrap;
             gap: 8px;
             justify-content: flex-start;
-            line-height: hToV(22);
+            line-height: 22px;
             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>
\ No newline at end of file
+</style>

--
Gitblit v1.9.3