|
@@ -13,7 +13,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import { goafdevstatis } from '@/api/goaf/sensor'
|
|
|
+import { getSensorStatus } from '@/api/goaf/sensor'
|
|
|
import * as echarts from 'echarts'
|
|
|
export default {
|
|
|
name: 'SensorStatus',
|
|
@@ -37,12 +37,17 @@ export default {
|
|
|
grid: {
|
|
|
top: '20%',
|
|
|
left: '3%',
|
|
|
- right: '4%',
|
|
|
+ right: '2%',
|
|
|
bottom: '3%',
|
|
|
containLabel: true
|
|
|
},
|
|
|
xAxis: {
|
|
|
type: 'category',
|
|
|
+ // name: '天/时间',
|
|
|
+ nameTextStyle: {
|
|
|
+ fontSize: 10,
|
|
|
+ color: '#fff'
|
|
|
+ },
|
|
|
boundaryGap: [0, 0.01],
|
|
|
axisLabel: {
|
|
|
color: '#fff',
|
|
@@ -60,6 +65,10 @@ export default {
|
|
|
},
|
|
|
yAxis: {
|
|
|
type: 'value',
|
|
|
+ // name: '次/天',
|
|
|
+ nameTextStyle: {
|
|
|
+ color: '#fff'
|
|
|
+ },
|
|
|
axisLine: {
|
|
|
show: true
|
|
|
},
|
|
@@ -96,11 +105,11 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- created() {
|
|
|
- this.$nextTick(() => {
|
|
|
- this.reload()
|
|
|
- })
|
|
|
- },
|
|
|
+ // created() {
|
|
|
+ // this.$nextTick(() => {
|
|
|
+ // this.reload()
|
|
|
+ // })
|
|
|
+ // },
|
|
|
destroyed() {
|
|
|
this.status = false
|
|
|
},
|
|
@@ -138,11 +147,8 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
this.option.xAxis.data = xAxis
|
|
|
- this.option.series[0].data = level_1
|
|
|
- this.option.series[1].data = level_2
|
|
|
- this.option.series[2].data = level_3
|
|
|
- this.myChart.setOption(this.option)
|
|
|
- // this.goafdevstatis()
|
|
|
+
|
|
|
+ this.getSensorStatus()
|
|
|
})
|
|
|
},
|
|
|
|
|
@@ -153,37 +159,26 @@ export default {
|
|
|
var d = new Date(year, month, 0)
|
|
|
return d.getDate()
|
|
|
},
|
|
|
- goafdevstatis() {
|
|
|
+ getSensorStatus() {
|
|
|
const option = JSON.parse(JSON.stringify(this.option))
|
|
|
- goafdevstatis().then((res) => {
|
|
|
- this.total = res.data.goafDevTotalNum
|
|
|
-
|
|
|
- const pressureSensorNum = res.data.pressureSensorNum
|
|
|
- const displacementSensorNum = res.data.displacementSensorNum
|
|
|
- const harmfulGasSensorNum = res.data.harmfulGasSensorNum
|
|
|
-
|
|
|
- const pressureSensorOnlineNum = res.data.pressureSensorOnlineNum
|
|
|
- const displacementSensorOnlineNum = res.data.displacementSensorOnlineNum
|
|
|
- const harmfulGasSensorOnlineNum = res.data.harmfulGasSensorOnlineNum
|
|
|
-
|
|
|
- option.series[0].data = [pressureSensorOnlineNum, pressureSensorNum - pressureSensorOnlineNum]
|
|
|
- option.series[1].data = [displacementSensorOnlineNum, displacementSensorNum - displacementSensorOnlineNum]
|
|
|
- option.series[2].data = [harmfulGasSensorOnlineNum, harmfulGasSensorNum - harmfulGasSensorOnlineNum]
|
|
|
-
|
|
|
+ getSensorStatus().then((res) => {
|
|
|
+ option.series[0].data = res.data.sensorNormalNum
|
|
|
+ option.series[1].data = res.data.sensorGenAlarmNum
|
|
|
+ option.series[2].data = res.data.sensorCriAlarmNum
|
|
|
if (!this.myChart) {
|
|
|
var chartDom = document.getElementById('sensor-status-chart')
|
|
|
var myChart = echarts.init(chartDom)
|
|
|
this.myChart = myChart
|
|
|
}
|
|
|
this.myChart.setOption(option)
|
|
|
- this.myChart.on('click', (params) => {
|
|
|
- this.$router.push({
|
|
|
- path: '/particulars/sensor',
|
|
|
- query: {
|
|
|
- id: '0'
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
+ // this.myChart.on('click', (params) => {
|
|
|
+ // this.$router.push({
|
|
|
+ // path: '/particulars/sensor',
|
|
|
+ // query: {
|
|
|
+ // id: '0'
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // })
|
|
|
})
|
|
|
},
|
|
|
linkTo() {
|