From 2800fa4f32f3900509cb4d6eefaf2bfaf54efdd7 Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Mon, 21 Apr 2025 18:29:09 +0800
Subject: [PATCH] fix: 天气显示
---
src/views/Home/HomeLeft/InspectionRaskDetails/InspectionRaskDetails.vue | 89 ++++++++++++++++++++++++--------------------
1 files changed, 48 insertions(+), 41 deletions(-)
diff --git a/src/views/Home/HomeLeft/InspectionRaskDetails/InspectionRaskDetails.vue b/src/views/Home/HomeLeft/InspectionRaskDetails/InspectionRaskDetails.vue
index d16606a..78115f9 100644
--- a/src/views/Home/HomeLeft/InspectionRaskDetails/InspectionRaskDetails.vue
+++ b/src/views/Home/HomeLeft/InspectionRaskDetails/InspectionRaskDetails.vue
@@ -1,7 +1,6 @@
<!-- 巡检任务详情 -->
<template>
- <common-title title="巡检任务情况" :style="{ marginLeft: pxToRem(14) }" @details="detailsFun">
- </common-title>
+ <common-title title="巡检任务情况" :style="{ marginLeft: pxToRem(14) }" @details="detailsFun"></common-title>
<div class="inspection-rask-details">
<div class="inspection-num">
<div class="total">
@@ -9,11 +8,14 @@
<div class="name">总任务数</div>
</div>
<div class="status">
- <div v-for="item in list">
- <div :style="{ color: item.color }" class="value">
- {{ jobStatistics[item.field] }}
+ <div class="item" v-for="(item, index) in list" :key="index">
+ <div>
+ <div :style="{ color: item.color }" class="value">
+ {{ jobStatistics[item.field] }}
+ </div>
+ <div class="name">{{ item.name }}</div>
</div>
- <div class="name">{{ item.name }}</div>
+ <div v-if="index !== 2 && index !== 4" class="right-line"></div>
</div>
</div>
</div>
@@ -31,14 +33,15 @@
import { getJobNumBar, getJobStatistics, getTotalJobNum } from '@/api/home'
import dayjs from 'dayjs'
import InspectionRaskDetailsDialog from '@/views/Home/HomeLeft/InspectionRaskDetails/InspectionRaskDetailsDialog.vue'
+import useEchartsResize from '@/hooks/useEchartsResize'
const currenDate = dayjs().format('YYYY-MM-DD')
const newTime = ref([currenDate, currenDate])
const list = ref([
- { name: '计划执行', value: 89, color: '#FFFFFF', field: 'planned_executions' },
- { name: '执行中', value: 100, color: '#FFA768', field: 'running_num' },
- { name: '待执行', value: 66, color: '#FFE17E', field: 'pending_executions' },
- { name: '已执行', value: 10, color: '#8EFFAC', field: 'executed' },
- { name: '执行失败', value: 10, color: '#FF8E8E', field: 'failed_executions' },
+ { name: '计划执行', value: 0, color: '#FFFFFF', field: 'planned_executions' },
+ { name: '执行中', value: 0, color: '#FFA768', field: 'running_num' },
+ { name: '待执行', value: 0, color: '#FFE17E', field: 'pending_executions' },
+ { name: '已执行', value: 0, color: '#8EFFAC', field: 'executed' },
+ { name: '执行失败', value: 0, color: '#FF8E8E', field: 'failed_executions' },
])
const option = {
grid: {
@@ -104,15 +107,14 @@
},
},
}
+
// 是否展示巡检任务详情
const isShowDetailsDialog = ref(false)
const detailsFun = () => {
-console.log(isShowDetailsDialog.value)
isShowDetailsDialog.value = true
-
}
-
-let chart = null
+const chartRef = ref(null)
+let { chart } = useEchartsResize(chartRef)
// TODAY,CURRENT_WEEK,CURRENT_MONTH,CURRENT_YEAR
const getData = (value, date_enum) => {
@@ -127,11 +129,10 @@
getJobNumBar(params).then(res => {
option.xAxis.data = res.data?.data.map(item => item.name)
option.series.data = res.data?.data.map(item => item.value)
- chart.setOption(option)
+ chart.value.setOption(option)
})
}
-const chartRef = ref(null)
const total = ref(0)
const jobStatistics = ref({
planned_executions: 0,
@@ -142,11 +143,6 @@
})
onMounted(() => {
- chart = echarts.init(chartRef.value)
- // 监听窗口大小变化
- window.addEventListener('resize', () => {
- chart?.resize()
- })
getTotalJobNum().then(res => {
total.value = res.data?.data || 0
})
@@ -160,25 +156,20 @@
padding: 16px 16px;
width: 390px;
height: 414px;
- background: linear-gradient(
- 270deg,
- rgba(31, 62, 122, 0) 0%,
- rgba(31, 62, 122, 0.35) 21%,
- #1f3e7a 100%
- );
+ 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/home/homeLeft/inspection-num.png') no-repeat center / 100% 100%;
- width: 360px;
- height: 118px;
+ width: 378px;
+ height: 110px;
position: relative;
.total {
position: absolute;
- left: 34px;
- top: 44px;
+ left: 20px;
+ top: 36px;
font-weight: 500;
font-size: 14px;
color: #ffffff;
@@ -194,24 +185,40 @@
.status {
position: absolute;
- top: 8px;
- right: 10px;
- width: 200px;
- display: flex;
- flex-wrap: wrap;
- gap: 8px;
- justify-content: flex-start;
- line-height: 22px;
- padding: 0 10px 10px 0;
+ left: 115px;
+ width: 250px;
+ height: 110px;
+ display: grid;
+ grid-template-columns: repeat(3, 1fr);
+ grid-template-rows: repeat(1, 30px); // 设置每行高度
+ gap: 10px 0; // 调整行间距
+ align-content: center;
+ .item {
+ display: flex;
+ align-items: center;
+ }
+ .right-line {
+ width: 0px;
+ height: 36px;
+ border-radius: 0px 0px 0px 0px;
+ border: 1px solid;
+ border-image: linear-gradient(180deg, rgba(27, 148, 255, 0), rgba(27, 148, 255, 1), rgba(27, 148, 255, 0)) 1 1;
+ margin-left: 10px;
+ }
.name {
+ width: 56px;
+ text-align: center;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 14px;
color: #ffffff;
+ margin-top: -4px;
}
.value {
+ width: 56px;
+ text-align: center;
font-family: YouSheBiaoTiHei, YouSheBiaoTiHei;
font-weight: 400;
font-size: 26px;
--
Gitblit v1.9.3