Commit 99130408 authored by xinzhedeai's avatar xinzhedeai

add环境实时数据

parent 6de2505b
...@@ -54,14 +54,18 @@ const initChart = () => { ...@@ -54,14 +54,18 @@ const initChart = () => {
axisLabel: { color: "#a0b3d6", interval: 2 }, axisLabel: { color: "#a0b3d6", interval: 2 },
}, },
yAxis: { yAxis: {
name:'mm', // name:'mm',
// nameLocation:'end', // nameLocation:'end',
// nameGap: 10, // 单位与Y轴轴线的间距 // nameGap: 10, // 单位与Y轴轴线的间距
nameAlign:'left', // nameAlign:'left',
// axisLabel: {
// offset: 200 // 向左移动10像素
// },
// nameTextStyle: { padding: [-30, 0, 0, 0] },
type: "value", type: "value",
max: 300, max: 300,
axisLine: { lineStyle: { color: "#4f6b95" } }, axisLine: { lineStyle: { color: "#4f6b95" } },
axisLabel: { color: "#a0b3d6"}, // axisLabel: { color: "#a0b3d6"},
splitLine: { lineStyle: { color: "rgba(79, 107, 149, 0.2)" } }, splitLine: { lineStyle: { color: "rgba(79, 107, 149, 0.2)" } },
// // 添加警戒线标记 // // 添加警戒线标记
// axisTick: { // axisTick: {
...@@ -75,6 +79,7 @@ const initChart = () => { ...@@ -75,6 +79,7 @@ const initChart = () => {
data, data,
type: "line", type: "line",
smooth: true, smooth: true,
showSymbol: false, // 显示数据点显示
areaStyle: { areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: "rgba(54, 162, 235, 0.4)" }, { offset: 0, color: "rgba(54, 162, 235, 0.4)" },
...@@ -82,21 +87,27 @@ const initChart = () => { ...@@ -82,21 +87,27 @@ const initChart = () => {
]), ]),
}, },
lineStyle: { color: "rgba(54, 162, 235, 1)", width: 2 }, lineStyle: { color: "rgba(54, 162, 235, 1)", width: 2 },
markPoint: { // markPoint: {// 气泡
data: [ // data: [
{ type: 'max', name: 'Max' }, // { type: 'max', name: 'Max' },
{ type: 'min', name: 'Min' } // { type: 'min', name: 'Min' }
] // ]
}, // },
markLine: { markLine: {
symbol: 'none',
// data: [{ type: 'average', name: 'Avg' }] // data: [{ type: 'average', name: 'Avg' }]
data: warningLines.map(line => ({ data: warningLines.map(line => ({
label: {
show: false
},
name: line.name, name: line.name,
yAxis: line.value, yAxis: line.value,
lineStyle: { lineStyle: {
color: line.color, color: line.color,
width: 1, width: 1,
type: 'dashed' type: 'dashed',
} }
})) }))
} }
......
<template> <template>
<n-card :bordered="false" class="env-monitor-card"> <div class="chart-container wrapper">
<div class="card-header"> <h2 class="card-title">环境监测实时数据</h2>
<h2 class="card-title">环境监测实时数据</h2>
<n-button size="small" type="text" class="collapse-btn">
<n-icon><ChevronUp /></n-icon> 收起
</n-button>
</div>
<div class="env-grid"> <div class="env-grid">
<div class="item"> <div class="row1">
<n-icon color="#6dd230" size="0.25rem"><CheckCircle /></n-icon> <div class="item">
<div class="name">在线</div> <img src="@/assets/jinrun/wendu.png" alt="" />
</div> <div class="name">温度 25°C</div>
<div class="item"> </div>
<n-icon color="#ff6384" size="0.25rem"><ThermometerHalf /></n-icon> <div class="item">
<div class="name">温度</div> <img src="@/assets/jinrun/shidu.png" alt="" />
<div class="value">25°C</div> <div class="name">湿度 25%RH</div>
</div> </div>
<div class="item"> <div class="item">
<n-icon color="#36a2eb" size="0.25rem"><Tint /></n-icon> <img src="@/assets/jinrun/pm25.png" alt="" />
<div class="name">湿度</div> <div class="name">PM2.5 2.5μg/m³</div>
<div class="value">25%RH</div> </div>
</div>
<div class="item">
<n-icon color="#a0b3d6" size="0.25rem"><Cloud /></n-icon>
<div class="name">PM2.5</div>
<div class="value">2.5μg/m³</div>
</div>
<div class="item">
<n-icon color="#4bc0c0" size="0.25rem"><LocationArrow /></n-icon>
<div class="name">风向</div>
<div class="value"></div>
</div>
<div class="item">
<n-icon color="#9c27b0" size="0.25rem"><Wind /></n-icon>
<div class="name">风速</div>
<div class="value">25m/s</div>
</div> </div>
<div class="item"> <div class="row2">
<n-icon color="#facc15" size="0.25rem"><Speedometer /></n-icon> <div class="item">
<div class="name">气压</div> <img src="@/assets/jinrun/fengxiang.png" alt="" />
<div class="value">8Kpa</div> <div class="name">风向 东</div>
</div> </div>
<div class="item"> <div class="item">
<n-icon color="#ff9f40" size="0.25rem"><Cloud /></n-icon> <img src="@/assets/jinrun/fengsu.png" alt="" />
<div class="name">PM10</div> <div class="name">风速 25m/s</div>
<div class="value">10μg/m³</div> </div>
<div class="item">
<img src="@/assets/jinrun/qiya.png" alt="" />
<div class="name">气压 8Kpa</div>
</div>
<div class="item">
<img src="@/assets/jinrun/pm10.png" alt="" />
<div class="name">PM10 10μg/m³</div>
</div>
</div> </div>
</div> </div>
</n-card> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
...@@ -55,51 +43,53 @@ ...@@ -55,51 +43,53 @@
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.env-monitor-card { .wrapper {
flex: 1; overflow: visible;
width: 4.6rem;
height: 3rem;
position: relative;
padding: 0.15rem; padding: 0.15rem;
background: var(--n-bg-color-secondary); padding-top: 0.45rem;
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 0.15rem;
.card-title {
font-size: 0.18rem;
font-weight: 600;
color: var(--n-text-color-primary);
}
.collapse-btn { .card-title {
font-size: 0.14rem; position: absolute;
color: var(--n-primary-color); left: 0.25rem;
} top: -0.15rem;
font-weight: 500;
font-size: 0.2rem;
color: #ffffff;
text-shadow: 0rem 0rem 0rem rgba(5, 38, 68, 0.5);
} }
width: 100%;
margin-top: 0.3rem;
background-image: url("@/assets/jinrun/module-bg.png");
background-repeat: no-repeat;
}
.env-grid { .env-grid {
display: grid; .row1{
grid-template-columns: 1fr 1fr; margin-bottom: .2rem;
}
.row1,
.row2 {
display: flex;
justify-content: space-between;
gap: 0.1rem; gap: 0.1rem;
font-weight: 400;
font-size: 0.16rem;
color: #ffffff;
.item { .item {
display: flex;
flex-direction: column;
justify-content: center;
}
.name {
text-align: center; text-align: center;
padding: 0.1rem; }
background: rgba(10, 25, 71, 0.6); img {
border-radius: 0.05rem; width: 0.88rem;
height: 0.71rem;
.name { margin-bottom: .1rem;
font-size: 0.14rem;
color: var(--n-text-color-secondary);
margin: 0.05rem 0;
}
.value {
font-size: 0.18rem;
font-weight: bold;
color: var(--n-text-color-primary);
}
} }
} }
} }
......
...@@ -89,8 +89,9 @@ ...@@ -89,8 +89,9 @@
<transition name="slide-right"> <transition name="slide-right">
<div class="right-modules" v-show="isRightModulesVisible"> <div class="right-modules" v-show="isRightModulesVisible">
<RightAiWarning /> <RightAiWarning />
<!--
<RightEnvMonitor /> <RightEnvMonitor />
<!--
<RightTodayAlarm /> --> <RightTodayAlarm /> -->
</div> </div>
</transition> </transition>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment