zhaobao 1 ano atrás
pai
commit
3848bbd0ea

+ 7 - 0
src/api/goaf/sensor.js

@@ -123,3 +123,10 @@ export function getSensorlist(params) {
     params
   })
 }
+export function getSensorStatus(params) {
+  return request({
+    url: '/goaf/goafsensoralarm/bigscreen/alarmstatis',
+    params
+  })
+}
+

+ 2 - 2
src/settings.js

@@ -36,8 +36,8 @@ module.exports = {
   /**
   * 服务API地址
   */
-  // devServerUrl: 'http://113.141.93.143:1788', // 正式环境
-  devServerUrl: 'http://192.168.3.5:1788', // 开发环境 qu
+  devServerUrl: 'http://113.141.93.143:1788',
+  // devServerUrl: 'http://192.168.3.5:1788', // 开发环境 qu
   serverUrl: 'http://113.141.93.143:1788', // 正式环境
   mqttUrl: 'ws://113.141.93.143:8894/mqtt', // mqtt地址
   /**

+ 31 - 36
src/views/bigScreen/home/components/SensorStatus.vue

@@ -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() {