From d75bfbae0212434d84676ae4d9e4a384ac4384df Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Mon, 31 Mar 2025 17:54:28 +0800
Subject: [PATCH] feat: 把== 改成===
---
src/views/Home/components/HomeLeft/InspectionRaskDetails.vue | 253 +++++++++++++++++++++++++++-----------------------
1 files changed, 135 insertions(+), 118 deletions(-)
diff --git a/src/views/Home/components/HomeLeft/InspectionRaskDetails.vue b/src/views/Home/components/HomeLeft/InspectionRaskDetails.vue
index 7e649f8..e061d39 100644
--- a/src/views/Home/components/HomeLeft/InspectionRaskDetails.vue
+++ b/src/views/Home/components/HomeLeft/InspectionRaskDetails.vue
@@ -3,23 +3,23 @@
<common-title
title="巡检任务情况"
:style="{ marginLeft: pxToRem(14) }"
- @details="detailsFun"
- >
-</common-title>
+ @details="detailsFun"
+ >
+ </common-title>
<div class="inspection-rask-details">
<div class="inspection-num">
<div class="total">
- <div class="value">88</div>
+ <div class="value">{{total}}</div>
<div class="name">总任务数</div>
</div>
<div class="status">
<div v-for="item in list">
- <div :style="{ color: item.color }" class="value">{{ item.value }}</div>
+ <div :style="{ color: item.color }" class="value">{{ jobStatistics[item.field] }}</div>
<div class="name">{{ item.name }}</div>
</div>
</div>
</div>
- <CommonDateTime></CommonDateTime>
+ <CommonDateTime :style="{ top: pxToRem(19) }"></CommonDateTime>
<div class="chart-container" ref="chartRef"></div>
</div>
</template>
@@ -29,126 +29,142 @@
import { pxToRem } from '@/utils/rem';
import CommonTitle from '@/components/CommonTitle.vue';
import CommonDateTime from '@/components/CommonDateTime.vue';
+import { getJobNumBar, getJobStatistics, getTotalJobNum } from '@/api/home';
const list = ref([
- { name: '计划执行', value: 89, color: '#FFFFFF' },
- { name: '执行中', value: 100, color: '#FFA768' },
- { name: '待执行', value: 66, color: '#FFE17E' },
- { name: '已执行', value: 10, color: '#8EFFAC' },
- { name: '执行失败', value: 10, color: '#FF8E8E' },
+ { 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' },
]);
+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)' },
+ ]),
+ },
+ },
+ ],
+};
const detailsFun = () => {
console.log('details');
};
const chartRef = ref(null);
+const total = ref(0);
+const jobStatistics = ref({
+ "planned_executions": 0,
+ "executed": 0,
+ "running_num": 0,
+ "failed_executions": 0,
+ "pending_executions": 0
+})
onMounted(() => {
+ getTotalJobNum().then(res => {
+ total.value = res.data?.data || 0
+ })
+ getJobStatistics().then(res => {
+ jobStatistics.value = res.data?.data || {}
+ })
+ getJobNumBar().then(res => {
+ console.log(res.data.data);
+ })
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();
@@ -163,15 +179,15 @@
width: 390px;
height: 414px;
background: linear-gradient(
- 270deg,
- rgba(31, 62, 122, 0) 0%,
- rgba(31, 62, 122, 0.35) 21%,
- #1f3e7a 100%
+ 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%;
+ background: url('@/assets/images/home/homeLeft/inspection-num.png') no-repeat center / 100% 100%;
width: 360px;
height: 118px;
position: relative;
@@ -182,6 +198,7 @@
font-weight: 500;
font-size: 14px;
color: #ffffff;
+ text-align: center;
font-family: Source Han Sans CN, Source Han Sans CN;
line-height: 19px;
.value {
--
Gitblit v1.9.3