zhaobao 2 年 前
コミット
f1e1abe14e

+ 9 - 0
src/api/goaf/check.js

@@ -70,3 +70,12 @@ export function updateChecklistItem(data) {
     data
   })
 }
+
+// 统计接口
+export function goaftaskstatis(data) {
+  return request({
+    url: '/goaf/goaftaskstatis',
+    method: 'GET',
+    data
+  })
+}

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

@@ -38,3 +38,12 @@ export function updateSensor(data) {
     data
   })
 }
+
+
+export function goafdevstatis(data) {
+  return request({
+    url: '/goaf/goafdevinfo/goafdevstatis',
+    method: 'GET',
+    data
+  })
+}

+ 9 - 0
src/utils/index.js

@@ -72,4 +72,13 @@ export function NumConvertLM(num) {
     CorrectArr.unshift(Roman[i][ReverseArr[i]])
   }
   return CorrectArr.join('')
+}
+
+export function getTime(day=0) {
+  let date =new Date();
+  let y=date.getFullYear()
+  let m=date.getMonth()
+  let d=date.getDate()
+  let today=new Date(`${y}-${m+1}-${d}`)
+  return parseTime(new Date(today.getTime()+day*60*60*24*1000))
 }

+ 50 - 8
src/views/home/components/SensorStatus.vue

@@ -1,8 +1,8 @@
 <template>
 <div class="item">
     <div class="title">
-        <span class="name">传感器在线状况</span>
-        <span class="number">24</span>
+        <span class="name">传感器状况</span>
+        <span class="number">{{total}}</span>
     </div>
     <div class="container">
         <div id="sensor-status-chart" v-if="status"></div>   
@@ -10,6 +10,7 @@
 </div>
 </template>
 <script>
+import { goafdevstatis} from '@/api/goaf/sensor'
  import * as echarts from 'echarts';
   export default {
     name:"SensorStatus",
@@ -17,6 +18,7 @@
         return{
             myChart:null,
             status:true,
+            total:0,
             option :{
                 tooltip: {
                     trigger: 'axis',
@@ -63,26 +65,26 @@
                     {
                         name: '压力',
                         type: 'bar',
-                        data: [63,19, 23, 31, 12, 13]
+                        data: [0,0]
                     },
                     {
                         name: '位移',
                         type: 'bar',
-                        data: [19, 23, 31, 12, 13, 68]
+                        data: [0,0]
                     },
                     {
                         name: '有害气体',
                         type: 'bar',
-                        data: [19, 23, 31, 12, 13, 68]
+                        data: [0,0]
                     }
                 ]
             }
         }
     },
     created(){
-        // this.$nextTick(()=>{
-        //     this.init()
-        // })
+        this.$nextTick(()=>{
+            this.reload()
+        })
     },
     methods:{
         init(){
@@ -94,6 +96,46 @@
                 console.log("SensorStatus",params)
             }); 
             this.myChart=myChart                     
+        },
+        reload(){      
+            this.$nextTick(()=>{
+              this.goafdevstatis()
+            })                 
+        },
+        goafdevstatis(){
+            let   option  =JSON.parse(JSON.stringify(this.option))
+            goafdevstatis().then((res)=>{
+
+                this.total=res.data.goafDevTotalNum
+
+                let pressureSensorNum=res.data.pressureSensorNum
+                let displacementSensorNum=res.data.displacementSensorNum
+                let harmfulGasSensorNum=res.data.harmfulGasSensorNum
+
+                let pressureSensorOnlineNum=res.data.pressureSensorOnlineNum
+                let displacementSensorOnlineNum=res.data.displacementSensorOnlineNum
+                let 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] 
+                
+                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'
+                        }
+                    })
+                }); 
+                                 
+            })
         }
     },
     destroyed() {

+ 4 - 4
src/views/home/components/TodayCheckTask.vue

@@ -23,7 +23,7 @@
 <script>
 import { Vue3SeamlessScroll } from "vue3-seamless-scroll";
 import { goaftaskList } from '@/api/goaf/task'
-import {parseTime} from '@/utils'
+import {getTime} from '@/utils'
 export default {
     name:"TodayCheckTask",
     components:{
@@ -49,11 +49,11 @@ export default {
             let y= date.getFullYear()
             let m=date.getMonth()+1
             let d=date.getDate()
-            let expectedStartDate=parseTime(new Date(`${y}-${m}-${d}`))
-            let expectedEndDate=parseTime(new Date(`${y}-${m}-${d+1}`))
+            let expectedStartDate=getTime()
+            let expectedEndDate=getTime(1)
             goaftaskList({
                 expectedStartDate,
-                expectedEndDate              
+                expectedEndDate         
             }).then((res)=>{
                 let complete=res.data.filter(item=>item.status===1).length
                 let unfinished=res.data.length-complete

+ 1 - 1
src/views/home/index.vue

@@ -75,7 +75,7 @@ import {
             this.reportData=reportData
             /**更新chart */
             this.$nextTick(()=>{
-                this.$refs['sensor-status'].init();
+                this.$refs['sensor-status'].reload();
                 this.$refs['sensor-info-statistics'].init();
             })            
         },

+ 29 - 8
src/views/particulars/check.vue

@@ -105,15 +105,15 @@
                 <div class="head-info">
                     <div class="item total">
                         <div class="name">总数</div>
-                        <div class="number">123</div>                    
+                        <div class="number">{{statistics.total}}</div>                    
                     </div>
                     <div class="item normal">                        
                         <div class="name">正常</div>
-                        <div class="number">120</div>                    
+                        <div class="number">{{statistics.normal}}</div>                    
                     </div>
                     <div class="item error">
                         <div class="name">异常</div>
-                        <div class="number">3</div>                    
+                        <div class="number">{{statistics.error}}</div>                    
                     </div>
                 </div>
                 <div class="chart-wrap">
@@ -133,6 +133,9 @@ import Abnormal  from './components/Abnormal.vue'
 import WarnChart from './components/WarnChart.vue'
 import { getCheckTaskByPage } from '@/api/goaf/task'
 import {  getGoafBaseInfo } from '@/api/goaf/info'
+import {goaftaskstatis} from '@/api/goaf/check'
+
+import {getTime} from '@/utils'
  export default {
     name:"check",
     components:{
@@ -153,8 +156,8 @@ import {  getGoafBaseInfo } from '@/api/goaf/info'
                 limit: 10,
                 status:0,
                 taskTitle:"",
-                expectedStartDate:new Date(),
-                expectedEndDate:"",
+                expectedStartDate:getTime(),
+                expectedEndDate:getTime(1),
                 goafId: '',
                 goafOrebelt: '',
                 goafOrebody: '',
@@ -179,7 +182,12 @@ import {  getGoafBaseInfo } from '@/api/goaf/info'
                 {label:'否',value:0},
             ],
             dataList:[],
-            total:0                
+            total:0 ,
+            statistics:{
+                total:0,
+                normal:0,
+                error:0
+            }               
         }
     },
     created(){
@@ -196,12 +204,25 @@ import {  getGoafBaseInfo } from '@/api/goaf/info'
                 this.$refs['warn-chart'].init();
                 this.getData()
             })
+            this.getGoafBaseInfo()
+            this.goaftaskstatis()
+        },
+        getGoafBaseInfo(){
             getGoafBaseInfo().then((res) => {
                 const goafOrebelts = res.data.map(item => item.goafOrebelt)
                 this.goafOrebelts = [...new Set(goafOrebelts)]
                 this.goafList = res.data
             })  
         },
+        goaftaskstatis(){
+            goaftaskstatis().then((res)=>{
+                this.statistics={
+                    total:res.data.goafTaskCompletedNum,
+                    normal:res.data.goafTaskPassNum,
+                    error:res.data.goafTaskNopassdNum
+                }  
+            })
+        },
         changeHead(item){
             this.activeId=item.id
         },
@@ -230,8 +251,8 @@ import {  getGoafBaseInfo } from '@/api/goaf/info'
                 limit: 10,
                 status:0,
                 taskTitle:"",
-                expectedStartDate:new Date(),
-                expectedEndDate:"",
+                expectedStartDate:getTime(),
+                expectedEndDate:getTime(1),
                 goafId: '',
                 goafOrebelt: '',
                 goafOrebody: '',

+ 16 - 7
src/views/particulars/sensor.vue

@@ -101,20 +101,20 @@
             <div class="rt">
                 <div class="head">
                     <div class="name">传感器数据统计</div>
-                    <div class="number">123</div>
+                    <div class="number">{{statistics.total}}</div>
                 </div>
                 <div class="head-info">
                     <div class="item total">
                         <div class="name">总数</div>
-                        <div class="number">123</div>                    
+                        <div class="number">{{statistics.total}}</div>                    
                     </div>
                     <div class="item normal">                        
                         <div class="name">正常</div>
-                        <div class="number">120</div>                    
+                        <div class="number">{{statistics.normal}}</div>                    
                     </div>
                     <div class="item error">
                         <div class="name">异常</div>
-                        <div class="number">3</div>                    
+                        <div class="number">{{statistics.error}}</div>                    
                     </div>
                 </div>
                 <div class="chart-wrap">
@@ -134,7 +134,7 @@ import AlertChart from './components/AlertChart.vue'
 import WarnChart from './components/WarnChart.vue'
 import { getSensorByPage } from '@/api/goaf/sensor'
 import {  getGoafBaseInfo } from '@/api/goaf/info'
-import { NumConvertLM } from '@/utils'
+import { NumConvertLM ,getTime} from '@/utils'
  export default {
     name:"sensor",
     components:{
@@ -155,7 +155,9 @@ import { NumConvertLM } from '@/utils'
                 goafName:"",
                 goafDevName:"",
                 hdangerLevel:"",
-                goafDevTypename:""
+                goafDevTypename:"",
+                expectedStartDate:getTime(),
+                expectedEndDate:getTime(1),
                 // start:0,
                 // end:0
             }, 
@@ -183,7 +185,12 @@ import { NumConvertLM } from '@/utils'
                 {label:"危急",value:3}
             ],   
             dataList:[],
-            total:0                  
+            total:0 ,
+            statistics:{
+                total:0,
+                normal:0,
+                error:0
+            }                 
         }
     },
     created(){
@@ -244,6 +251,8 @@ import { NumConvertLM } from '@/utils'
                 goafDevName:"",
                 hdangerLevel:"",
                 goafDevTypename:"",
+                expectedStartDate:getTime(),
+                expectedEndDate:getTime(1),
                 // start:0,
                 // end:0           
             }