Commit bbb317a3 authored by liuyangyang's avatar liuyangyang

布袋周期页面开发合并

parents ad0197af ac7fcb14
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
"preview": "vite preview" "preview": "vite preview"
}, },
"dependencies": { "dependencies": {
"@element-plus/icons-vue": "^2.3.1",
"axios": "^1.9.0", "axios": "^1.9.0",
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",
"echarts": "^5.6.0", "echarts": "^5.6.0",
......
...@@ -3,6 +3,8 @@ import { createWebHistory, createRouter } from 'vue-router' ...@@ -3,6 +3,8 @@ import { createWebHistory, createRouter } from 'vue-router'
import Dashboard from '../views/dashboard/index.vue' import Dashboard from '../views/dashboard/index.vue'
import DustOverview from '../views/dustOverview/index.vue' import DustOverview from '../views/dustOverview/index.vue'
import AboutView from '../views/AboutView.vue' import AboutView from '../views/AboutView.vue'
import CollectorList from '../views/collectorList/collectorList.vue'
import User from '../views/user.vue'
import Layout from '../layout/index.vue' import Layout from '../layout/index.vue'
import Login from '../views/login/index.vue' import Login from '../views/login/index.vue'
import equipmentManagement from '../views/equipmentManagement/index.vue' import equipmentManagement from '../views/equipmentManagement/index.vue'
...@@ -35,6 +37,11 @@ const routes = [ ...@@ -35,6 +37,11 @@ const routes = [
path: '/monitor', path: '/monitor',
component: dustMonitoring, component: dustMonitoring,
meta: { title: '除尘器监控' }, meta: { title: '除尘器监控' },
},
{
path: '/collectorList',
component: CollectorList,
meta: { title: '布袋周期' },
}, },
{ {
path: '/bag-monitor', path: '/bag-monitor',
......
...@@ -2,133 +2,188 @@ import { color } from "echarts"; ...@@ -2,133 +2,188 @@ import { color } from "echarts";
export const getLineOption = (xData = [], seriesData = []) => ({ export const getLineOption = (xData = [], seriesData = []) => ({
tooltip: { tooltip: {
trigger: 'axis', trigger: "axis",
}, },
grid: { grid: {
left: '3%', left: "3%",
right: '4%', right: "4%",
bottom: '15%', bottom: "15%",
top: '5%', top: "5%",
containLabel: true, containLabel: true,
}, },
legend: { legend: {
data: ['健康度指数(%)'], data: ["健康度指数(%)"],
bottom: '0%', bottom: "0%",
icon:"circle", icon: "circle",
itemWidth: 10, itemWidth: 10,
itemHeight: 10, itemHeight: 10,
itemGap: 10, itemGap: 10,
}, },
xAxis: { xAxis: {
type: 'category', type: "category",
axisTick: { axisTick: {
show: false, show: false,
}, },
axisLine: { axisLine: {
lineStyle: { lineStyle: {
color: '#E9ECF2', color: "#E9ECF2",
}, },
}, },
axisLabel: { axisLabel: {
color: 'rgba(0,0,0,0.6)', color: "rgba(0,0,0,0.6)",
}, },
data: xData, data: xData,
}, },
yAxis: { yAxis: {
type: 'value', type: "value",
axisLabel: { axisLabel: {
color: 'rgba(0,0,0,0.6)', color: "rgba(0,0,0,0.6)",
}, },
splitLine: { splitLine: {
lineStyle: { lineStyle: {
color: '#E9ECF2', color: "#E9ECF2",
type: 'dashed', type: "dashed",
},
}, },
}, },
series: [
{
name: "健康度指数(%)",
type: "line",
color: "#399DFA",
data: seriesData,
smooth: true,
},
],
});
export const getDustLineOption = (xData = [], seriesData = []) => ({
tooltip: {
trigger: "axis",
},
grid: {
left: "3%",
right: "4%",
bottom: "15%",
top: "5%",
containLabel: true,
},
legend: {
data: ["健康度指数(%)"],
bottom: "0%",
icon: "circle",
itemWidth: 10,
itemHeight: 10,
itemGap: 10,
},
xAxis: {
type: "category",
axisTick: {
show: false,
},
axisLine: {
lineStyle: {
color: "#E9ECF2",
},
},
axisLabel: {
color: "rgba(0,0,0,0.6)",
},
data: xData,
},
yAxis: {
type: "value",
axisLabel: {
color: "rgba(0,0,0,0.6)",
},
splitLine: {
lineStyle: {
color: "#E9ECF2",
type: "dashed",
},
},
}, },
series: [ series: [
{ {
name: '健康度指数(%)', name: "",
type: 'line', type: "line",
color: '#399DFA', color: "#399DFA",
data: seriesData, data: seriesData,
smooth: true, smooth: true,
}, },
], ],
}); });
// 布袋监测图表配置 // 布袋监测图表配置
export const getBagMonitoringChartOption = (xData = [], seriesData = []) => ({ export const getBagMonitoringChartOption = (xData = [], seriesData = []) => ({
tooltip: { tooltip: {
trigger: 'axis', trigger: "axis",
axisPointer: { axisPointer: {
type: 'line', type: "line",
lineStyle: { lineStyle: {
color: '#6E7079', color: "#6E7079",
width: 1 width: 1,
} },
} },
}, },
grid: { grid: {
left: '20', left: "20",
right: '20', right: "20",
bottom: '30', bottom: "30",
top: '3%', top: "3%",
containLabel: true containLabel: true,
}, },
xAxis: { xAxis: {
type: 'category', type: "category",
boundaryGap: false, boundaryGap: false,
axisLine: { axisLine: {
lineStyle: { lineStyle: {
color: '#E9ECF2' color: "#E9ECF2",
} },
}, },
axisLabel: { axisLabel: {
color: 'rgba(0,0,0,0.6)', color: "rgba(0,0,0,0.6)",
fontSize: 12, fontSize: 12,
interval: 'auto', interval: "auto",
rotate: 0 rotate: 0,
}, },
axisTick: { axisTick: {
show: false show: false,
}, },
data: xData data: xData,
}, },
yAxis: { yAxis: {
type: 'value', type: "value",
min: 0, min: 0,
max: 600, max: 600,
interval: 200, interval: 200,
axisLabel: { axisLabel: {
color: 'rgba(0,0,0,0.6)', color: "rgba(0,0,0,0.6)",
formatter: '{value}' formatter: "{value}",
}, },
splitLine: { splitLine: {
lineStyle: { lineStyle: {
color: '#E9ECF2', color: "#E9ECF2",
type: 'dashed' type: "dashed",
} },
} },
}, },
series: [ series: [
{ {
name: '监测值', name: "监测值",
type: 'line', type: "line",
smooth: false, smooth: false,
symbol: 'none', symbol: "none",
sampling: 'average', sampling: "average",
itemStyle: { itemStyle: {
color: '#7B68EE' color: "#7B68EE",
}, },
lineStyle: { lineStyle: {
width: 1 width: 1,
}, },
areaStyle: { areaStyle: {
color: { color: {
type: 'linear', type: "linear",
x: 0, x: 0,
y: 0, y: 0,
x2: 0, x2: 0,
...@@ -136,16 +191,16 @@ export const getBagMonitoringChartOption = (xData = [], seriesData = []) => ({ ...@@ -136,16 +191,16 @@ export const getBagMonitoringChartOption = (xData = [], seriesData = []) => ({
colorStops: [ colorStops: [
{ {
offset: 0, offset: 0,
color: 'rgba(123, 104, 238, 0.4)' color: "rgba(123, 104, 238, 0.4)",
}, },
{ {
offset: 1, offset: 1,
color: 'rgba(123, 104, 238, 0.1)' color: "rgba(123, 104, 238, 0.1)",
} },
] ],
} },
}, },
data: seriesData, data: seriesData,
} },
] ],
}); });
This diff is collapsed.
<template>
<div ref="chartDustRef" class="chart-line"></div>
</template>
<script setup>
import { onMounted, onBeforeUnmount, ref, watch, nextTick } from "vue";
import * as echarts from "echarts";
import { getDustLineOption } from "@/utils/chart";
const props = defineProps({
// 表格数据
dustLineInfo: {
type: Array,
required: true,
default: () => [],
},
});
const chartDustRef = ref(null);
let chartInstance = null;
const initChart = () => {
if (chartDustRef.value) {
let xData = [];
let seriesData = [];
if (props.dustLineInfo) {
props.dustLineInfo.forEach((i) => {
xData.push(i.time);
seriesData.push(i.value);
});
}
chartInstance = echarts.init(chartDustRef.value);
const option = getDustLineOption(xData, seriesData);
nextTick(() => {
// DOM 更新完成后执行
chartInstance.setOption(option);
});
}
};
watch(
() => props.dustLineInfo,
() => {
initChart();
console.log("props.dustLineInfo", props.dustLineInfo);
},
{ deep: true }
);
onMounted(() => {
initChart();
window.addEventListener("resize", () => {
chartInstance?.resize();
});
});
onBeforeUnmount(() => {
chartInstance?.dispose();
});
</script>
<style lang="scss" scoped>
.chart-line {
canvas {
width: 100%;
height: 100%;
}
}
</style>
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