邓洁 : 修改监控数据弹窗

This commit is contained in:
邓洁
2023-12-17 02:47:11 +08:00
parent 2d413876d4
commit c25aaa9ec8
4 changed files with 235 additions and 12 deletions

View File

@@ -2,7 +2,7 @@
<div id="air-info">
<div class="fan-speed">
<img src="@/assets/images/airInfo/fan-v-icon.png" alt=""/>
<div class="fan-info">
<div class="fan-info" @click="handleOpenChart">
<div class="input-fan"><span>风速</span><span>进风{{ windSpeed }}m/s</span></div>
<div class="output-fan"><span>出风{{windSpeed}}m/s</span></div>
</div>
@@ -14,19 +14,67 @@
:icon="item.icon"
:name="item.name"
:unit="item.unit"
@click="handleOpenAirChart(item)"
/>
<div class="digital-tunnel">
<el-dialog v-model="isWindSpeedVisited" :title="'风速监控数据'" width="2175px" :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 class="digital-tunnel">
<el-dialog v-model="isAirVisited" :title="airTitle+'监控数据'" width="2175px" :modal="false">
<div class="left-top-icon"></div>
<div class="right-top-icon"></div>
<div class="chat-dialog">
<div id="containerEle"></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 ItemInfo from "./childComps/ItemInfo.vue";
import TimeRangeBtn from "@/components/timeRangeBtn/index.vue"
import * as echarts from 'echarts';
let myEcharts = reactive({});
let myAirEcharts = reactive({});
const props = defineProps({
list: Array,
airData: Array
});
const windSpeed=ref('')
const airTitle=ref('')
const airList = ref([])
const timeList = ref(["年", "月", "日"]);
const selectTimeButton = ref(2);
const isWindSpeedVisited = ref(false);
const isAirVisited = ref(false);
watch(() => props.list, (now) => {
airList.value.forEach(item=>{
now.forEach(newItem=>{
@@ -39,7 +87,29 @@ watch(() => props.list, (now) => {
watch(() => props.airData, (now) => {
getAirInfo(now.sensorList)
}, {deep: true});
const handleOpenChart = () => {
isWindSpeedVisited.value = true
nextTick(() => {
initChart()
})
}
const handleOpenAirChart = (item) => {
isAirVisited.value = true
airTitle.value=item.name
nextTick(() => {
initAirChart()
})
}
const timeSelect = (index) => {
console.log('选择时间', index)
if(index===0){
console.log('--年')
}else if(index===1){
console.log('--月')
}else if(index===2){
console.log('--日')
}
};
const changeData = (item) => {
return {
equipmentId: item.equipmentId,
@@ -64,19 +134,172 @@ const changeIcon = (type) => {
}
}
const getAirInfo = (now) => {
let windPressureObj = {}
let windPressureArr = []
let airObj = {}
let airArr = []
now.map(item => {
if (item.equipmentType === "dust" || item.equipmentType === "oxygen" || item.equipmentType === "temperature" || item.equipmentType === "humidness") {
windPressureObj = changeData(item)
windPressureArr.push(windPressureObj)
airObj = changeData(item)
airArr.push(airObj)
}else if(item.equipmentType === "windDirection"){
windSpeed.value = item.value
}
})
windPressureArr.push(windPressureArr.shift())
airList.value = windPressureArr
airArr.push(airArr.shift())
airList.value = airArr
}
const initChart = () => {
//3.初始化container容器
myEcharts = echarts.init(document.getElementById('container'));
//5.传入数据
let option = {
//图例
legend: {
// left: 0,
textStyle: {
color: '#FFFFFF',
fontSize: 40
},
itemWidth: 70,
itemHeight:5,
icon: "rect",
},
//离容器四侧的距离
grid: {
left: 0, // 左边距
right: 20, // 右边距
top: 80, // 顶边距
bottom: 0, // 底边距
containLabel: true,
},
//提示框组件
tooltip: {
show: true,
trigger: 'axis',
textStyle: {
fontSize: 40
}
},
//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: [
{
name:'进风口',
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
}
},
{
name:'出风口',
data: [3, 85, 47, 92, 17, 76, 69, 25,56, 12, 89, 34, 71, 43, 67, 20, 98, 72, 19, 61, 31, 49, 81, 63],
type: 'line',
smooth: true,
symbolSize: 24,
lineStyle: {
width: 5
}
}
]
}
myEcharts.setOption(option);
//图表大小自适应窗口大小变化
window.onresize = () => {
myEcharts.resize();
}
}
const initAirChart = () => {
//3.初始化container容器
myAirEcharts = echarts.init(document.getElementById('containerEle'));
//5.传入数据
let option = {
//图例
legend: {
// left: 0,
textStyle: {
color: '#FFFFFF',
fontSize: 40
}
},
//离容器四侧的距离
grid: {
left: 0, // 左边距
right: 20, // 右边距
top: 80, // 顶边距
bottom: 0, // 底边距
containLabel: true,
},
//提示框组件
tooltip: {
show: true,
trigger: 'axis',
textStyle: {
fontSize: 40
}
},
//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
}
}
]
}
myAirEcharts.setOption(option);
//图表大小自适应窗口大小变化
window.onresize = () => {
myAirEcharts.resize();
}
}
</script>
<style lang="scss" scoped>

View File

@@ -17,7 +17,7 @@
<el-dialog
v-model="isVisited"
title="有害气体监控数据"
width="2400px"
width="2175px"
:modal="false"
>
<div class="left-top-icon"></div>

View File

@@ -11,7 +11,7 @@
</div>
</div>
<div class="digital-tunnel">
<el-dialog v-model="isVisited" width="2400px" :modal="false">
<el-dialog v-model="isVisited" width="2175px" :modal="false">
<div class="left-top-icon"></div>
<div class="right-top-icon"></div>
<div class="top-tag">

View File

@@ -5,7 +5,7 @@
<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">
<el-dialog v-model="isVisited" :title="windSort+'号风压监控数据'" width="2175px" :modal="false">
<div class="left-top-icon"></div>
<div class="right-top-icon"></div>
<div class="chat-dialog">