<template> <div class="dashboard-container" style="background-color: white"> <panel-group ref="panelgroup"/> <el-row> <el-col :span="16"> <el-card shadow="never"> <device-count/> </el-card> </el-col> <el-col :span="8"> <el-card shadow="never"> <gas-note /> </el-card> </el-col> </el-row> <el-row> <el-col :span="12"> <el-card shadow="never"> <gas-count-by-day title="CO₂气体用量走势图" device-type="15" /> </el-card> </el-col> <!-- 用气走势图 --> <el-col :span="12"> <el-card shadow="never"> <gas-count-by-day title="O₂气体用量走势图" device-type="16" /> </el-card> </el-col> <!--设备在线数量统计--> <el-col :span="12"> <el-card shadow="never"> <gas-count-by-day title="燃气气体用量走势图" device-type="17" /> </el-card> </el-col> <el-col :span="12"> <el-card shadow="never"> <gas-count-by-device-bar/> </el-card> </el-col> <el-col :span="12"> <el-card shadow="never"> <alarm-gas-count-by-type/> </el-card> </el-col> <!--报警饼图统计--> <el-col v-if="hasPerm('/statics/alarmsByDay')" :span="12"> <el-card shadow="never"> <alarm-leak-count-pie/> </el-card> </el-col> <!--燃气报警统计,柱状图--> <el-col :span="12"> <el-card shadow="never"> <gas-alarm-trend/> </el-card> </el-col> <!--报警饼图统计--> <el-col :span="12"> <el-card shadow="never"> <corrode-count-by-day :query="listQuery1" /> </el-card> </el-col> </el-row> </div> </template> <script> import { mapGetters } from 'vuex' import PanelGroup from './components/PanelGroup' import DeviceCount from './components/DeviceCount' import gasCountByDept from './components/gasCountByDept' import gasCountByDay from './components/gasCountByDay' import gasCountByDeviceBar from './components/gasCountByDeviceBar' import WatchAlarmBar from './components/watchAlarmBar' import gasNote from './components/gasNote' import AlarmCountByDept from './components/AlarmCountByDept' import gasCompare from './components/gasCompare' import watchGasAlarmBar from './components/watchGasAlarmBar' import alarmGasCountByType from './components/alarmGasCountByType' import corrodeCountByDay from './components/corrodeCountByDay' import AlarmLeakCountPie from './components/alarmLeakCountPie' import GasAlarmTrend from './components/gasAlarmTrend' export default { name: 'Dashboard', components: { GasAlarmTrend, AlarmLeakCountPie, gasCountByDeviceBar, gasCountByDept, gasCountByDay, gasNote, PanelGroup, gasCompare, DeviceCount, WatchAlarmBar, AlarmCountByDept, watchGasAlarmBar, alarmGasCountByType, corrodeCountByDay }, data() { return { listQuery1: { areaId: '110000', startTime: new Date().Format('yyyy-MM-dd'), endTime: new Date().Format('yyyy-MM-dd') }, // 分区用气量查询条件 listQuery2: { areaId: '110000', startTime: new Date().Format('yyyy-MM-dd'), endTime: new Date().Format('yyyy-MM-dd') }, // 分区报警查询条件 listQuery3: { areaId: '110000', startTime: new Date().Format('yyyy-MM-dd'), endTime: new Date().Format('yyyy-MM-dd') } // 分区报警查询条件 } }, computed: { ...mapGetters([ 'name', 'roleNames', 'roleTips', 'wellTypes', 'deviceTypes', 'communications', 'area' ]) }, mutations: { SET_WEBSOCKET: (state, websocket) => { state.websocket = websocket }, SET_WS_STATUS: (state, wsStatus) => { state.wsStatus = wsStatus }, SET_NEED_REFRESH: (state, needRefresh) => { state.needRefresh = needRefresh } }, watch: { needRefresh(val) { // 需要刷新 if (val) { console.log('refresh dashboard') this.$refs.panelgroup.refresh() } } }, mounted() { // this.webSocket() }, methods: { webSocket() { this.$store.dispatch('initWebSocket') }, // 切换分区查询条件 changeWaterQuery(listQuery1) { this.listQuery1 = listQuery1 }, // 切换报警查询条件 changeAlarmQuery(listQuery2) { this.listQuery2 = listQuery2 }, // 切换报警查询条件 changeAlarmGasQuery(listQuery3) { this.listQuery3 = listQuery3 } } } </script> <style rel="stylesheet/scss" lang="scss" scoped> .dashboard-container{ .el-row{ .el-col{ margin-bottom: 10px; } } } .dashboard { &-container { padding: 10px 20px; } &-text { font-size: 30px; line-height: 46px; } } </style>