修改温湿度监控

boardTest
夜笙歌 10 months ago
parent 74071ac7d4
commit 3366540113

@ -10,8 +10,9 @@ export default {
watch:{ watch:{
chartOption: { chartOption: {
handler(newVal, oldVal) { handler(newVal, oldVal) {
console.log(newVal) if(newVal){
this.initChart(newVal) this.initChart(newVal)
}
}, },
deep: true, // deep: true, //
} }
@ -24,7 +25,9 @@ export default {
} }
}, },
mounted() { mounted() {
if(this.chartOption){
this.initChart(this.chartOption) this.initChart(this.chartOption)
}
}, },
beforeDestroy() { beforeDestroy() {
if (!this.chart) { if (!this.chart) {

@ -57,6 +57,7 @@
</el-form> </el-form>
<div v-for="item in list" class="chart"> <div v-for="item in list" class="chart">
<Chart ref="Chart1" style="width: 100%;height: 100%" :chartOption="getChart(item)"/> <Chart ref="Chart1" style="width: 100%;height: 100%" :chartOption="getChart(item)"/>
<div class="title">{{item.monitorName}}</div>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
@ -327,6 +328,15 @@ export default {
display: inline-block; display: inline-block;
width: 50%; width: 50%;
height: 40vh; height: 40vh;
position: relative;
}
.chart .title{
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
font-size: 1vw;
font-weight: 700;
} }
.chart2 { .chart2 {

@ -69,10 +69,10 @@ import {
listRecordIOTInstant, listRecordIOTInstant,
getRecordIOTInstant, iotInstantList getRecordIOTInstant, iotInstantList
} from '@/api/ems/record/recordIOTInstant' } from '@/api/ems/record/recordIOTInstant'
import { getMonitorInfoTree } from '@/api/ems/base/baseMonitorInfo' import {getMonitorInfoTree} from '@/api/ems/base/baseMonitorInfo'
import Treeselect from '@riophae/vue-treeselect' import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { parseTime } from '@/utils/ruoyi' import {parseTime} from '@/utils/ruoyi'
import Chart from '@/components/Charts/Chart' import Chart from '@/components/Charts/Chart'
import * as echarts from 'echarts' import * as echarts from 'echarts'
@ -139,25 +139,25 @@ export default {
// //
rules: { rules: {
objId: [ objId: [
{ required: true, message: '编号不能为空', trigger: 'blur' } {required: true, message: '编号不能为空', trigger: 'blur'}
] ]
}, },
columns: [ columns: [
{ key: 0, label: `主键标识`, visible: false }, {key: 0, label: `主键标识`, visible: false},
{ key: 1, label: `计量设备编号`, visible: true }, {key: 1, label: `计量设备编号`, visible: true},
{ key: 2, label: `采集时间`, visible: true }, {key: 2, label: `采集时间`, visible: true},
{ key: 3, label: `温度`, visible: true }, {key: 3, label: `温度`, visible: true},
{ key: 4, label: `湿度`, visible: true }, {key: 4, label: `湿度`, visible: true},
{ key: 5, label: `照度`, visible: true }, {key: 5, label: `照度`, visible: true},
{ key: 6, label: `噪声`, visible: true }, {key: 6, label: `噪声`, visible: true},
{ key: 7, label: `硫化氢浓度`, visible: true }, {key: 7, label: `硫化氢浓度`, visible: true},
{ key: 8, label: `记录时间`, visible: true }, {key: 8, label: `记录时间`, visible: true},
{ key: 9, label: `报警类型`, visible: true }, {key: 9, label: `报警类型`, visible: true},
{ key: 10, label: ``, visible: true }, {key: 10, label: ``, visible: true},
{ key: 11, label: ``, visible: false }, {key: 11, label: ``, visible: false},
{ key: 12, label: ``, visible: false }, {key: 12, label: ``, visible: false},
{ key: 13, label: ``, visible: true }, {key: 13, label: ``, visible: true},
{ key: 14, label: ``, visible: true } {key: 14, label: ``, visible: true}
] ]
} }
}, },
@ -237,7 +237,7 @@ export default {
/** 查询计量设备信息下拉树结构 */ /** 查询计量设备信息下拉树结构 */
getTreeselect() { getTreeselect() {
getMonitorInfoTree({ monitorTypeList: [5,6,7,8,9]}).then(response => { getMonitorInfoTree({monitorTypeList: [5, 6, 7, 8, 9]}).then(response => {
this.monitorInfoOptions = response.data this.monitorInfoOptions = response.data
}) })
}, },
@ -249,7 +249,7 @@ export default {
}, },
/** 节点单击事件 */ /** 节点单击事件 */
handleNodeClick(data,type,a) { handleNodeClick(data, type, a) {
console.log(type.parent.data) console.log(type.parent.data)
console.log(a) console.log(a)
// this.queryParams.monitorTypeList = type // this.queryParams.monitorTypeList = type
@ -264,7 +264,7 @@ export default {
return return
} }
let query = JSON.parse(JSON.stringify(this.queryParams)) let query = JSON.parse(JSON.stringify(this.queryParams))
const { data } = await iotInstantList(query) const {data} = await iotInstantList(query)
let option1 = { let option1 = {
title: { title: {
text: '物联网设备曲线', text: '物联网设备曲线',
@ -340,7 +340,7 @@ export default {
], ],
series: [ series: [
{ {
tooltip:{ tooltip: {
show: data.monitorTypeArr.includes('温度') ? true : false show: data.monitorTypeArr.includes('温度') ? true : false
}, },
name: '温度', name: '温度',
@ -359,10 +359,10 @@ export default {
// areaStyle: { // areaStyle: {
// color: "rgba(5,140,255, 0.2)", // color: "rgba(5,140,255, 0.2)",
// }, // },
data: data.monitorTypeArr.includes('温度')?data.dataList.map(e => e.tempreture):[] data: data.monitorTypeArr.includes('温度') ? data.dataList.map(e => e.tempreture) : []
}, },
{ {
tooltip:{ tooltip: {
show: data.monitorTypeArr.includes('湿度') ? true : false show: data.monitorTypeArr.includes('湿度') ? true : false
}, },
name: '湿度', name: '湿度',
@ -381,10 +381,10 @@ export default {
// areaStyle: { // areaStyle: {
// color: "rgba(5,140,255, 0.2)", // color: "rgba(5,140,255, 0.2)",
// }, // },
data: data.monitorTypeArr.includes('湿度') ?data.dataList.map(e => e.humidity):[] data: data.monitorTypeArr.includes('湿度') ? data.dataList.map(e => e.humidity) : []
}, },
{ {
tooltip:{ tooltip: {
show: data.monitorTypeArr.includes('噪声') ? true : false show: data.monitorTypeArr.includes('噪声') ? true : false
}, },
name: '噪声', name: '噪声',
@ -403,10 +403,10 @@ export default {
// areaStyle: { // areaStyle: {
// color: "rgba(5,140,255, 0.2)", // color: "rgba(5,140,255, 0.2)",
// }, // },
data: data.monitorTypeArr.includes('噪声') ? data.dataList.map(e => e.noise):[] data: data.monitorTypeArr.includes('噪声') ? data.dataList.map(e => e.noise) : []
}, },
{ {
tooltip:{ tooltip: {
show: data.monitorTypeArr.includes('照度') ? true : false show: data.monitorTypeArr.includes('照度') ? true : false
}, },
name: '照度', name: '照度',
@ -425,10 +425,10 @@ export default {
// areaStyle: { // areaStyle: {
// color: "rgba(5,140,255, 0.2)", // color: "rgba(5,140,255, 0.2)",
// }, // },
data: data.monitorTypeArr.includes('照度') ? data.dataList.map(e =>e.illuminance):[] data: data.monitorTypeArr.includes('照度') ? data.dataList.map(e => e.illuminance) : []
}, },
{ {
tooltip:{ tooltip: {
show: data.monitorTypeArr.includes('气体浓度') ? true : false show: data.monitorTypeArr.includes('气体浓度') ? true : false
}, },
name: '气体浓度', name: '气体浓度',
@ -447,14 +447,13 @@ export default {
// areaStyle: { // areaStyle: {
// color: "rgba(5,140,255, 0.2)", // color: "rgba(5,140,255, 0.2)",
// }, // },
data: data.monitorTypeArr.includes('气体浓度') ? data.dataList.map(e =>e.concentration):[] data: data.monitorTypeArr.includes('气体浓度') ? data.dataList.map(e => e.concentration) : []
} }
] ]
} }
console.log(option1)
this.$refs.Chart1.setData(option1) this.$refs.Chart1.setData(option1)
// option1 && Chart1.setOption(option1);
// this.$refs.Chart2.setData(option2)
echarts.connect(this.$refs.Chart1.chart) echarts.connect(this.$refs.Chart1.chart)
// , this.$refs.Chart2.chart // , this.$refs.Chart2.chart
this.$refs.Chart1.chart.on('datazoom', (e) => { this.$refs.Chart1.chart.on('datazoom', (e) => {

Loading…
Cancel
Save