首页、能耗对比

master
wj 2 years ago
parent ad0d7ac973
commit 6f78d99111
  1. 154
      psdc-ui/src/views/analyse/nhdb/index.vue
  2. 34
      psdc-ui/src/views/bigview/index.vue

@ -1,7 +1,7 @@
<template> <template>
<div class="app-container home"> <div class="app-container home">
<div class="overflow"> <div class="overflow">
<el-card class="box-card" v-for="item in data.celueInfoList"> <el-card class="box-card" v-for="(item,index) in data.celueInfoList" :key="index">
<template #header> <template #header>
<div class="card-header"> <div class="card-header">
<img :src="imgSrc" alt=""> <img :src="imgSrc" alt="">
@ -38,7 +38,9 @@
<el-input v-model="item.sceneUseEnergy" readonly/> <el-input v-model="item.sceneUseEnergy" readonly/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<!-- <div class="echart"></div>--> <div class="echartBox">
<div class="echart" :id="`forId${index}`"></div>
</div>
</div> </div>
</el-card> </el-card>
</div> </div>
@ -46,8 +48,9 @@
</template> </template>
<script name="Index" setup> <script name="Index" setup>
import {getCelueList} from '@/api/analyse/nhdb/nhdb'
import {ref,reactive,onMounted} from 'vue' import {ref,reactive,onMounted} from 'vue'
import * as echarts from "echarts";
import {getCelueList} from '@/api/analyse/nhdb/nhdb'
const imgSrc = ref('../src/assets/images/策略icon.png') const imgSrc = ref('../src/assets/images/策略icon.png')
const data = reactive({ const data = reactive({
@ -212,9 +215,25 @@ const data = reactive({
}) })
onMounted(()=>{ onMounted(()=>{
getCelueListFun() getCelueListFun();
forId();
setTimeout(()=>{
indoorChartFun();
},300)
}) })
/** 使用rem的思想实现图表字体等其他样式的自适应*/
function fontSize(px) { //
let clientWidth = window.innerWidth || document.body.clientWidth; //
if (!clientWidth) {
return 0;
}
let fontSize = clientWidth / 1920; //稿
return px * fontSize; // rem
}
//
function getCelueListFun(){ function getCelueListFun(){
getCelueList().then((res)=>{ getCelueList().then((res)=>{
for(let i = 0;i < res.data.length;i++){ for(let i = 0;i < res.data.length;i++){
@ -230,6 +249,110 @@ function getCelueListFun(){
}) })
} }
//ID
function forId(index){
return 'chart' + index;
}
//线
let indoorChart;
function indoorChartFun(){
for(let i = 0;i < data.celueInfoList.length;i++){
var temp = 'forId' + i;
console.log(temp)
const chartDom = document.getElementById(temp)
indoorChart = echarts.init(chartDom);
const option = {
legend: {
data: ["室内温度"],
// selectedMode: 'single',
textStyle: {
color: "#b6bee7",
fontSize:fontSize(12)
}
},
tooltip: {
trigger: "axis",
formatter: '',
// borderColor: '#00fcff',
borderWidth: 1
},
grid:{
show: true,
top: '20%',
bottom:'15%',
left:'8%',
right:'4%',
borderWidth: 0,
borderColor: '#767da1',
},
xAxis: {
type: 'category',
data: [1,1,11,1,11,1,1,1],
axisLabel: {
textStyle: {
color: "#b6bee7",
fontSize:fontSize(10)
}
},
axisLine: {
lineStyle: {
color: '#767da180' // x线
}
},
axisTick: {
show: true // x
},
splitArea: {
show: false,
interval:0,
areaStyle: {
color: ['rgb(54,68,148,.8)', 'rgb(37,51,133,.8)'] //
//
}
}
},
yAxis: {
type: 'value',
// name:'',
nameTextStyle: {
color: "#b6bee7",
fontSize:fontSize(10),
nameLocation: "start"
},
axisLabel: {
textStyle: {
color: "#b6bee7",
fontSize:fontSize(10)
}
},
splitLine: {
show: true,
lineStyle: {color: "#767da180", type: "dashed"} //dashed
} //s线
},
series: [
{
name: "室内温度",
data: [1,1,11,1,11,1,1,1],
type: 'line',
smooth: true,
symbol: "none", //
itemStyle: { //线
color: '#F5901A',
}
}
]
};
option && indoorChart.setOption(option);
window.addEventListener("resize", function () {
indoorChart.resize();
});
}
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@ -242,16 +365,10 @@ function getCelueListFun(){
overflow-y: auto; overflow-y: auto;
} }
.box-card { .box-card {
width: 830px; width: 100%;
color: #fff; color: #fff;
border: none; border: none;
margin-bottom: 20px; margin-bottom: 20px;
&:nth-child(odd){
margin-right: 20px;
}
&:nth-child(even){
margin-right: 0px;
}
.card-header{ .card-header{
display: flex; display: flex;
align-items: center; align-items: center;
@ -265,7 +382,20 @@ function getCelueListFun(){
font-size: 14px; font-size: 14px;
} }
.item { .item {
display: flex;
justify-content: space-between;
flex-wrap: nowrap;
//margin-bottom: 18px; //margin-bottom: 18px;
.echartBox{
width: 230%;
height: 160px;
padding: 10px 0;
border: 1px solid #ffffff50;
.echart{
width: 100%;
height: 100%;
}
}
} }
} }
.echart{ .echart{
@ -296,10 +426,10 @@ function getCelueListFun(){
} }
::v-deep .el-form-item--default{ ::v-deep .el-form-item--default{
margin-bottom: 0px; margin-bottom: 0px;
margin-right: 0px;
} }
::v-deep .el-card{ ::v-deep .el-card{
background-color: #2F3D8A; background-color: #2F3D8A;
height: 260px;
} }
@media (max-width:960px) { @media (max-width:960px) {
.app-container{ .app-container{

@ -115,7 +115,7 @@
import * as echarts from 'echarts' import * as echarts from 'echarts'
import {HomeFilled} from '@element-plus/icons-vue' import {HomeFilled} from '@element-plus/icons-vue'
import Screenfull from '@/components/Screenfull' import Screenfull from '@/components/Screenfull'
import {ref, reactive, onMounted, onBeforeUnmount} from 'vue' import {ref, onMounted, onBeforeUnmount} from 'vue'
import {getDevicesInfo,getZdb} from '../../api/bigview/bigview' import {getDevicesInfo,getZdb} from '../../api/bigview/bigview'
import {getWdcgq} from '../../api/emonitor/api' import {getWdcgq} from '../../api/emonitor/api'
@ -1127,19 +1127,25 @@ function outdoorChartFun(){
/** 页面销毁时*/ /** 页面销毁时*/
onBeforeUnmount(() => { onBeforeUnmount(() => {
if(dcglChart) { if(dcglChart) {
dcglChart.dispose(); // } dcglChart.dispose(); //
if (xrglChart) { }
xrglChart.dispose(); if (xrglChart) {
} xrglChart.dispose();
if (kqyrbChart) { }
kqyrbChart.dispose(); if (kqyrbChart) {
} kqyrbChart.dispose();
if (frdlChart) { }
frdlChart.dispose(); if (frdlChart) {
} frdlChart.dispose();
if (dqglChart) { }
dqglChart.dispose(); if (dqglChart) {
} dqglChart.dispose();
}
if (indoorChart) {
indoorChart.dispose();
}
if (outdoorChart) {
outdoorChart.dispose();
} }
}); });
</script> </script>

Loading…
Cancel
Save