186 lines
4.4 KiB
Vue
186 lines
4.4 KiB
Vue
<template>
|
|
<div id="wind-pressure">
|
|
<div class="name">风压</div>
|
|
<div class="list">
|
|
<wind-pressure-item v-for="(item,index) in wpList" :key="item.equipmentId" :wp="item" :index="index+1" @click="handleOpenChart(index+1)"/>
|
|
</div>
|
|
<div class="digital-tunnel">
|
|
<el-dialog v-model="isVisited" :title="windSort+'号风压监控数据'" width="2400px" :modal="false">
|
|
<div class="left-top-icon"></div>
|
|
<div class="right-top-icon"></div>
|
|
<div class="chat-dialog">
|
|
<div id="container"></div>
|
|
<div style="width: 1px;"></div>
|
|
</div>
|
|
<div class="time-select">
|
|
<time-range-btn
|
|
:buttonList="timeList"
|
|
v-model="selectTimeButton"
|
|
@select="timeSelect"
|
|
/>
|
|
</div>
|
|
<div class="left-bottom-icon"></div>
|
|
<div class="right-bottom-icon"></div>
|
|
</el-dialog>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import WindPressureItem from "./childComps/WindPressureItem.vue";
|
|
import TimeRangeBtn from "@/components/timeRangeBtn/index.vue"
|
|
import * as echarts from 'echarts';
|
|
const props = defineProps({
|
|
list: Array,
|
|
winData: Array
|
|
});
|
|
const windSort=ref(1)
|
|
const timeList = ref(["年", "月", "日"]);
|
|
const selectTimeButton = ref(2);
|
|
const isVisited = ref(false);
|
|
let myEcharts = reactive({});
|
|
const wpList = ref([]);
|
|
watch(() => props.list, (now) => {
|
|
wpList.value.forEach(item=>{
|
|
now.forEach(newItem=>{
|
|
if(item.equipmentId === newItem.equipmentId){
|
|
item.value = newItem.value
|
|
}
|
|
})
|
|
})
|
|
}, {deep: true});
|
|
|
|
watch(() => props.winData, (now) => {
|
|
getScreenInfo(now.windPressureSensorList)
|
|
}, {deep: true});
|
|
const handleOpenChart = (index) => {
|
|
console.log('用电量弹窗')
|
|
isVisited.value = true
|
|
windSort.value=index
|
|
nextTick(() => {
|
|
initChart()
|
|
})
|
|
}
|
|
const timeSelect = (index) => {
|
|
console.log('选择时间', index)
|
|
if(index===0){
|
|
console.log('--年')
|
|
}else if(index===1){
|
|
console.log('--月')
|
|
}else if(index===2){
|
|
console.log('--日')
|
|
}
|
|
};
|
|
const getScreenInfo = (now) => {
|
|
let windPressureObj = {}
|
|
let windPressureArr = []
|
|
now.map(item => {
|
|
windPressureObj = {
|
|
equipmentId:item.equipmentId,
|
|
max: 120,
|
|
value: item.value,
|
|
point: item.valueThreshold,
|
|
unit: item.unit
|
|
}
|
|
windPressureArr.push(windPressureObj)
|
|
})
|
|
wpList.value = windPressureArr
|
|
}
|
|
/**
|
|
* 初始化echarts实例方法
|
|
*/
|
|
const initChart = () => {
|
|
//3.初始化container容器
|
|
myEcharts = echarts.init(document.getElementById('container'));
|
|
//5.传入数据
|
|
let option = {
|
|
//图例
|
|
legend: {
|
|
left: 0,
|
|
textStyle: {
|
|
color: '#FFFFFF',
|
|
fontSize: 40
|
|
},
|
|
// itemWidth: 20,
|
|
// itemHeight: 20
|
|
},
|
|
//离容器四侧的距离
|
|
grid: {
|
|
left: 0, // 左边距
|
|
right: 20, // 右边距
|
|
top: 80, // 顶边距
|
|
bottom: 0, // 底边距
|
|
containLabel: true,
|
|
},
|
|
//提示框组件
|
|
tooltip: {
|
|
show: true,
|
|
trigger: 'axis'
|
|
},
|
|
//X轴
|
|
xAxis: {
|
|
type: 'category',
|
|
data: ['00:00', '01:00', '02:00', '03:00', '04:00', '05:00', '06:00','07:00', '08:00', '09:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00','19:00', '20:00', '21:00', '22:00', '23:00','24:00'],
|
|
axisLabel: {
|
|
textStyle: {
|
|
fontSize: 45,
|
|
color: '#D6F1FA'
|
|
},
|
|
},
|
|
},
|
|
//Y轴
|
|
yAxis: {
|
|
type: 'value',
|
|
axisLabel: {
|
|
textStyle: {
|
|
fontSize: 45,
|
|
color: '#D6F1FA'
|
|
},
|
|
},
|
|
},
|
|
//配置项
|
|
series: [
|
|
{
|
|
data: [56, 12, 89, 34, 71, 43, 67, 20, 98, 72, 19, 61, 3, 85, 47, 92, 17, 76, 69, 25, 31, 49, 81, 63],
|
|
type: 'line',
|
|
smooth: true,
|
|
symbolSize: 24,
|
|
lineStyle: {
|
|
width: 5
|
|
}
|
|
}
|
|
]
|
|
}
|
|
myEcharts.setOption(option);
|
|
//图表大小自适应窗口大小变化
|
|
window.onresize = () => {
|
|
myEcharts.resize();
|
|
}
|
|
}
|
|
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
#wind-pressure {
|
|
width: 830px;
|
|
height: 779px;
|
|
position: absolute;
|
|
top: 185px;
|
|
right: 68px;
|
|
background-image: url(../../../assets/images/windPressure/bg.png);
|
|
padding: 22px 17px 0 23px;
|
|
|
|
.name {
|
|
width: 64px;
|
|
height: 42px;
|
|
font-size: 32px;
|
|
font-family: MicrosoftYaHei, MicrosoftYaHei;
|
|
font-weight: bold;
|
|
color: #38cafb;
|
|
line-height: 42px;
|
|
margin-left: 62px;
|
|
margin-bottom: 38px;
|
|
}
|
|
}
|
|
</style>
|