Quellcode durchsuchen

于涵——数据优化

wyh vor 1 Jahr
Ursprung
Commit
6bc69581b1

+ 11 - 9
src/views/modules_guAn/visualization/index.vue

@@ -33,8 +33,7 @@
           <!-- <test-information></test-information> -->
           <common-title title="全程曲线" @click="showModal"></common-title>
           <div class="visualization-common-border">
-            <!-- <full-curve :data="curveData"></full-curve> -->
-            <full-curve :data="curveModelData"></full-curve>
+            <full-curve :data="fullData"></full-curve>
           </div>
         </div>
       </div>
@@ -98,7 +97,7 @@
       </div>
       <yuzhi-curve v-if="title==='预制曲线'" :data="yuzhiData" :marks="yuzhiMarkData" ref="yuzhiCurveM"></yuzhi-curve>
       <real-time-curve v-if="title==='实时曲线'" :data="curveData"></real-time-curve>
-      <full-curve-model v-if="title==='全程曲线'" :data="curveModelData" ref="fullCurveModel"></full-curve-model>
+      <full-curve-model v-if="title==='全程曲线'" :data="fullModelData" ref="fullCurveModel"></full-curve-model>
       <template slot="footer">
         <a-button @click="curveClose">关闭</a-button>
       </template>
@@ -152,7 +151,8 @@ export default {
       yuzhiData: [],
       yuzhiMarkData: [],
       curveData: [],
-      curveModelData: [],
+      fullData: [],
+      fullModelData: [],
       websock: null,
       newAlarmData: null,
       title: '',
@@ -252,11 +252,12 @@ export default {
       console.log(66666,redata)
       // 接收数据之后操作
       this.eqRealData = redata['设备实时值']
-      // this.curveData = redata['设备历史值']
+      // this.curveData = redata['设备历史值'] // 原来第一版后端传数格式
       this.curveData = redata['实时曲线']
+      this.fullData = redata['全程曲线']
       if(this.isFullWebSocket){
-        // this.curveModelData = redata['设备历史值']
-        this.curveModelData = redata['全程曲线']
+        // this.fullModelData = redata['设备历史值'] // 原来第一版后端传数格式
+        this.fullModelData = redata['全程曲线']
       }
       // 旧版本
       // this.newAlarmData = redata['最新一条报警信息']
@@ -299,12 +300,13 @@ export default {
     showModal(title){
       this.title = title
       this.visible = true
+      console.log(this.curveData)
     },
     getSearchData(){
       getAction('/datacoll/webaccess/getQcqx', this.queryParam).then(res=>{
         console.log(res)
         if(res.success){
-          this.curveModelData = res.result
+          this.fullModelData = res.result
         }
       })
     },
@@ -321,7 +323,7 @@ export default {
       this.isFullWebSocket = true
       this.visible = false
       this.queryParam = {}
-      this.curveModelData = this.curveData // 再次打开是全部数据状态
+      this.fullModelData = this.fullData // 解除搜索数据状态,保证再次打开是全部数据状态
     },
   }
 }

+ 30 - 18
src/views/modules_guAn/visualization/modules/EquipmentInfo.vue

@@ -183,32 +183,44 @@ export default {
     alarmData: {
       handler(newValue, oldValue){
         console.log(777777,newValue, oldValue)
-        var hasAlarm = newValue
-        var options = { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric' };
-        // this.information = hasAlarm ? newValue.tagname : '暂无数据'
-        // this.alarmTime = hasAlarm ?  new Date(newValue.logtime.time).toLocaleDateString('zh-CN', options) : ''
-        var nInform = this.inform
-        var nTime = this.time
-        // ['原数据']表示按照原来数据进行,数据并未改变;[]和其他有数据的情况进行赋值并重新获取方法
-        // console.log(hasAlarm.length === 1 && hasAlarm[0] === '原数据')
-        var isYuan = hasAlarm.length === 1 && hasAlarm[0] === '原数据'
-        this.inform = !isYuan ? newValue.map(res => {
+
+        var isYuan = newValue.length === 1 && newValue[0] === '原数据'
+        if(isYuan) return
+        this.inform = newValue.map(res => {
           return res.tagname
-        }): nInform
-        this.time = hasAlarm.length > 0 ? newValue.map(res => {
+        })
+        this.time = newValue.map(res => {
           return res.logtime
-        }): nTime
-        // console.log(789, this.inform)
-        if(!isYuan){
-          this.showData()
-        }
+        })
+        this.showData()
+
+
+        // var hasAlarm = newValue
+        // var options = { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric' };
+        // // this.information = hasAlarm ? newValue.tagname : '暂无数据'
+        // // this.alarmTime = hasAlarm ?  new Date(newValue.logtime.time).toLocaleDateString('zh-CN', options) : ''
+        // var nInform = this.inform
+        // var nTime = this.time
+        // // ['原数据']表示按照原来数据进行,数据并未改变;[]和其他有数据的情况进行赋值并重新获取方法
+        // // console.log(hasAlarm.length === 1 && hasAlarm[0] === '原数据')
+        // var isYuan = hasAlarm.length === 1 && hasAlarm[0] === '原数据'
+        // this.inform = !isYuan ? newValue.map(res => {
+        //   return res.tagname
+        // }): nInform
+        // this.time = !isYuan ? newValue.map(res => {
+        //   return res.logtime
+        // }): nTime
+        // // console.log(789, this.inform)
+        // if(!isYuan){
+        //   this.showData()
+        // }
       },
       immediate: true,
       deep: true
     }
   },
   created () {
-    this.showData()
+    // this.showData()
   },
   mounted () {
   },

+ 38 - 11
src/views/modules_guAn/visualization/modules/FullCurve.vue

@@ -301,20 +301,47 @@ export default {
       if(data.length === 0){
         return
       }
-      var wendu = data.find(item => item.name === '温度实值-全程')
-      var shidu = data.find(item => item.name === '湿度实值-全程')
+
+      
+      var wendu = data.find(item => item.name === '温度实值-全程' || item.name === '当前温度值')
+      var shidu = data.find(item => item.name === '湿度实值-全程' || item.name === '当前湿度值')
       var fushe = data.find(item => item.name === '辐射强度值-全程')
       var time = data.find(item => item.name === '全程曲线-时间分布')
+      // var wenduZ = data.find(item => item.name === '当前温度值')
+      // var shiduZ = data.find(item => item.name === '当前湿度值')
       // console.log('1111',wendu,shidu,fushe,time)
-      this.wenduData = wendu ? wendu.subList.map(res =>{
-        return res.tagvalue
-      }) : []
-      this.shiduData = shidu ? shidu.subList.map(res =>{
-        return res.tagvalue
-      }) : []
-      this.timeData = wendu ? wendu.subList.map(res =>{
-        return res.transtime
-      }) : []
+      if(wendu.subList.length >0){
+        var newData = wendu.subList.map(res =>{
+          return res.tagvalue
+        })
+        this.wenduData.push(...newData)
+      }
+      if(shidu.subList.length >0){
+        var newData = shidu.subList.map(res =>{
+          return res.tagvalue
+        })
+        this.shiduData.push(...newData)
+      }
+      if(wendu.subList.length >0){
+        var newData = wendu.subList.map(res =>{
+          return res.transtime
+        })
+        this.timeData.push(...newData)
+      }
+      // this.wenduData = wendu.subList.length >0 ? wendu.subList.map(res =>{
+      //   return res.tagvalue
+      // }) : this.wenduData
+      // this.shiduData = shidu.subList.length >0 ? shidu.subList.map(res =>{
+      //   return res.tagvalue
+      // }) : this.shiduData
+      // this.timeData = wendu.subList.length >0 ? wendu.subList.map(res =>{
+      //   return res.transtime
+      // }) : this.timeData
+      // if(wenduZ || shiduZ){
+      //   this.wenduData.push(wenduZ.subList[0].tagvalue)
+      //   this.shiduData.push(shiduZ.subList[0].tagvalue)
+      //   this.timeData.push(wenduZ.subList[0].transtime)
+      // }
       // this.wenduData = wendu ? wendu.Values : []
       // this.shiduData = shidu ? shidu.Values : []
       // this.fusheData = fushe ? fushe.Values : []

+ 29 - 8
src/views/modules_guAn/visualization/modules/FullCurveModel.vue

@@ -300,14 +300,35 @@ export default {
       if(data.length === 0){
         return
       }
-      var wendu = data.find(item => item.Name === '温度实值-全程')
-      var shidu = data.find(item => item.Name === '湿度实值-全程')
-      var fushe = data.find(item => item.Name === '辐射强度值-全程')
-      var time = data.find(item => item.Name === '全程曲线-时间分布')
-      this.wenduData = wendu ? wendu.Values : []
-      this.shiduData = shidu ? shidu.Values : []
-      this.fusheData = fushe ? fushe.Values : []
-      this.timeData = time ? time.Values : []
+      var wendu = data.find(item => item.name === '温度实值-全程')
+      var shidu = data.find(item => item.name === '湿度实值-全程')
+      var fushe = data.find(item => item.name === '辐射强度值-全程')
+      var time = data.find(item => item.name === '全程曲线-时间分布')
+      var wenduZ = data.find(item => item.name === '当前温度值')
+      var shiduZ = data.find(item => item.name === '当前湿度值')
+      // console.log('1111',wendu,shidu,fushe,time)
+      this.wenduData = wendu.subList.length >0 ? wendu.subList.map(res =>{
+        return res.tagvalue
+      }) : this.wenduData
+      this.shiduData = shidu.subList.length >0 ? shidu.subList.map(res =>{
+        return res.tagvalue
+      }) : this.shiduData
+      this.timeData = wendu.subList.length >0 ? wendu.subList.map(res =>{
+        return res.transtime
+      }) : this.timeData
+      if(wenduZ || shiduZ){
+        this.wenduData.push(wenduZ.subList[0].tagvalue)
+        this.shiduData.push(shiduZ.subList[0].tagvalue)
+        this.timeData.push(wenduZ.subList[0].transtime)
+      }
+      // var wendu = data.find(item => item.Name === '温度实值-全程')
+      // var shidu = data.find(item => item.Name === '湿度实值-全程')
+      // var fushe = data.find(item => item.Name === '辐射强度值-全程')
+      // var time = data.find(item => item.Name === '全程曲线-时间分布')
+      // this.wenduData = wendu ? wendu.Values : []
+      // this.shiduData = shidu ? shidu.Values : []
+      // this.fusheData = fushe ? fushe.Values : []
+      // this.timeData = time ? time.Values : []
       // console.log(this.shiduData)
       var _this = this
       this.uEcharts.setOption({

+ 40 - 18
src/views/modules_guAn/visualization/modules/RealTimeCurve.vue

@@ -274,27 +274,49 @@ export default {
       if(data.length === 0){
         return
       }
-      var wendu = data.find(item => item.name === '温度实值-实时')
-      var shidu = data.find(item => item.name === '湿度实值-实时')
+      var wendu = data.find(item => item.name === '温度实值-实时' || item.name === '当前温度值')
+      var shidu = data.find(item => item.name === '湿度实值-实时' || item.name === '当前湿度值')
       var fushe = data.find(item => item.name === '辐射强度值-实时')
       var time = data.find(item => item.name === '实时曲线-时间分布')
-      var wenduZ = data.find(item => item.name === '当前温度值')
-      var shiduZ = data.find(item => item.name === '当前湿度值')
-      // console.log('1111',wendu,shidu,fushe,time,wenduZ,shiduZ)
-      this.wenduData = wendu ? wendu.subList.map(res =>{
-        return res.tagvalue
-      }) : []
-      this.shiduData = shidu ? shidu.subList.map(res =>{
-        return res.tagvalue
-      }) : []
-      this.timeData = wendu ? wendu.subList.map(res =>{
-        return res.transtime
-      }) : []
-      if(wenduZ || shiduZ){
-        this.wenduData.push(wenduZ.subList[0].tagvalue)
-        this.shiduData.push(shiduZ.subList[0].tagvalue)
-        this.timeData.push(wenduZ.subList[0].transtime)
+      // var wenduZ = data.find(item => item.name === '当前温度值')
+      // var shiduZ = data.find(item => item.name === '当前湿度值')
+      console.log(7878,this.wenduData)
+
+      if(wendu.subList.length >0){
+        var newData = wendu.subList.map(res =>{
+          return res.tagvalue
+        })
+        this.wenduData.push(...newData)
+      }
+      if(shidu.subList.length >0){
+        var newData = shidu.subList.map(res =>{
+          return res.tagvalue
+        })
+        this.shiduData.push(...newData)
+      }
+      if(wendu.subList.length >0){
+        var newData = wendu.subList.map(res =>{
+          return res.transtime
+        })
+        this.timeData.push(...newData)
       }
+
+
+      // console.log('1111',wendu,shidu,fushe,time,wenduZ,shiduZ)
+      // this.wenduData = wendu.subList.length >0 ? wendu.subList.map(res =>{
+      //   return res.tagvalue
+      // }) : this.wenduData
+      // this.shiduData = shidu.subList.length >0 ? shidu.subList.map(res =>{
+      //   return res.tagvalue
+      // }) : this.shiduData
+      // this.timeData = wendu.subList.length >0 ? wendu.subList.map(res =>{
+      //   return res.transtime
+      // }) : this.timeData
+      // if(wenduZ || shiduZ){
+      //   this.wenduData.push(wenduZ.subList[0].tagvalue)
+      //   this.shiduData.push(shiduZ.subList[0].tagvalue)
+      //   this.timeData.push(wenduZ.subList[0].transtime)
+      // }
       // console.log('2222',this.wenduData,this.shiduData,this.timeData)
       // this.wenduData = wendu ? wendu.Values : []
       // this.shiduData = shidu ? shidu.Values : []