实时运行图标更新

This commit is contained in:
2025-09-27 14:50:20 +08:00
parent 408ba489ca
commit b421d11bc2
5 changed files with 293 additions and 244 deletions

View File

@ -1,96 +1,109 @@
<template>
<el-card shadow="always" class="common-card-container common-card-container-body-no-padding">
<el-card
shadow="always"
class="common-card-container common-card-container-body-no-padding"
>
<div slot="header">
<span class="card-title">PCS平均温度</span>
<span class="card-title">PCS最高温度</span>
</div>
<div style="height: 360px" id="pocpjwdChart"/>
<div style="height: 360px" id="pocpjwdChart" />
</el-card>
</template>
<style scoped lang="scss"></style>
<script>
import * as echarts from 'echarts'
import resize from '@/mixins/ems/resize'
import {formatDate} from "@/filters/ems";
import {stackAveTemp} from '@/api/ems/dzjk'
import * as echarts from "echarts";
import resize from "@/mixins/ems/resize";
import { formatDate } from "@/filters/ems";
import { pcsMaxTemp } from "@/api/ems/dzjk";
export default {
mixins: [resize],
data() {
return {
chart: null
}
chart: null,
};
},
mounted() {
this.chart = echarts.init(document.querySelector('#pocpjwdChart'))
this.chart = echarts.init(document.querySelector("#pocpjwdChart"));
},
beforeDestroy() {
if (!this.chart) {
return
return;
}
this.chart.dispose()
this.chart = null
this.chart.dispose();
this.chart = null;
},
methods: {
init(siteId){
this.chart.showLoading()
const x = []
const data =[]
stackAveTemp(siteId).then(response => {
const source = response?.data?.stackAveTempList || []
source.forEach(item=>{
x.push(formatDate(item.createDate,false,true))
data.push(item.temp)
init(siteId) {
this.chart.showLoading();
const x = [];
const data = [];
pcsMaxTemp(siteId)
.then((response) => {
this.setOption(response?.data?.pcsMaxTempList || []);
})
this.setOption(x,data)
}).finally(()=>{
this.chart.hideLoading()
})
.finally(() => {
this.chart.hideLoading();
});
},
setOption(x,data) {
setOption(data) {
let xdata = [],
series = [];
data.forEach((element, index) => {
if (index === 0) {
xdata = (element.maxTempVoList || []).map((i) => i.createDate);
}
series.push({
type: "line",
name: `${element.deviceId}最高温度`,
areaStyle: {
// color:'#FFBD00'
},
data: (element.maxTempVoList || []).map((i) => i.temp),
});
});
this.chart.setOption({
color:['#FFBD00','#3C81FF'],
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
legend: {
left: "center",
top: "5",
itemWidth: 10,
itemHeight: 5,
textStyle: {
fontSize: 9,
},
},
grid: {
containLabel: true
containLabel: true,
},
textStyle:{
color:"#333333",
tooltip: {
trigger: "axis",
axisPointer: {
// 坐标轴指示器,坐标轴触发有效
type: "shadow", // 默认为直线,可选为:'line' | 'shadow'
},
},
xAxis: {type:'category',data:x},
textStyle: {
color: "#333333",
},
xAxis: { type: "category", data: xdata },
yAxis: {
type: 'value',
type: "value",
},
dataZoom: [
{
type: 'inside',
type: "inside",
start: 0,
end: 100
end: 100,
},
{
start: 0,
end: 100
}
end: 100,
},
],
series: [
{
name:'PCS平均温度',
data: data,
type: 'line',
areaStyle: {
color:'#FFBD00'
}
}]
})
}
}
}
series,
});
},
},
};
</script>