Browse Source

于涵——数据优化

wyh 1 year ago
parent
commit
3d42dadaa8

+ 13 - 12
src/views/modules_guAn/visualization/index.vue

@@ -25,7 +25,7 @@
           <!-- 左中 -->
           <!-- 左中 -->
           <common-title title="实时曲线" @click="showModal"></common-title>
           <common-title title="实时曲线" @click="showModal"></common-title>
           <div class="visualization-common-border">
           <div class="visualization-common-border">
-            <real-time-curve :data="curveData"></real-time-curve>
+            <real-time-curve :data="realTimeData" ref="realTimeCurve"></real-time-curve>
           </div>
           </div>
         </div>
         </div>
         <div class="left-bottom-con">
         <div class="left-bottom-con">
@@ -33,7 +33,7 @@
           <!-- <test-information></test-information> -->
           <!-- <test-information></test-information> -->
           <common-title title="全程曲线" @click="showModal"></common-title>
           <common-title title="全程曲线" @click="showModal"></common-title>
           <div class="visualization-common-border">
           <div class="visualization-common-border">
-            <full-curve :data="fullData"></full-curve>
+            <full-curve :data="fullData" ref="fullCurve"></full-curve>
           </div>
           </div>
         </div>
         </div>
       </div>
       </div>
@@ -96,7 +96,7 @@
         </a-form>
         </a-form>
       </div>
       </div>
       <yuzhi-curve v-if="title==='预制曲线'" :data="yuzhiData" :marks="yuzhiMarkData" ref="yuzhiCurveM"></yuzhi-curve>
       <yuzhi-curve v-if="title==='预制曲线'" :data="yuzhiData" :marks="yuzhiMarkData" ref="yuzhiCurveM"></yuzhi-curve>
-      <real-time-curve v-if="title==='实时曲线'" :data="curveData"></real-time-curve>
+      <real-time-curve v-if="title==='实时曲线'" :data="realTimeData"></real-time-curve>
       <full-curve-model v-if="title==='全程曲线'" :data="fullModelData" ref="fullCurveModel"></full-curve-model>
       <full-curve-model v-if="title==='全程曲线'" :data="fullModelData" ref="fullCurveModel"></full-curve-model>
       <template slot="footer">
       <template slot="footer">
         <a-button @click="curveClose">关闭</a-button>
         <a-button @click="curveClose">关闭</a-button>
@@ -150,7 +150,7 @@ export default {
       eqRealData: [],
       eqRealData: [],
       yuzhiData: [],
       yuzhiData: [],
       yuzhiMarkData: [],
       yuzhiMarkData: [],
-      curveData: [],
+      realTimeData: [],
       fullData: [],
       fullData: [],
       fullModelData: [],
       fullModelData: [],
       websock: null,
       websock: null,
@@ -253,20 +253,20 @@ export default {
       // 接收数据之后操作
       // 接收数据之后操作
       this.eqRealData = redata['设备实时值']
       this.eqRealData = redata['设备实时值']
       // this.curveData = redata['设备历史值'] // 原来第一版后端传数格式
       // this.curveData = redata['设备历史值'] // 原来第一版后端传数格式
-      this.curveData = redata['实时曲线']
-      this.fullData = redata['全程曲线']
+      this.realTimeData = [...this.realTimeData, ...redata['实时曲线']]
+      this.fullData = [...this.fullData, ...redata['全程曲线']]
       if(this.isFullWebSocket){
       if(this.isFullWebSocket){
         // this.fullModelData = redata['设备历史值'] // 原来第一版后端传数格式
         // this.fullModelData = redata['设备历史值'] // 原来第一版后端传数格式
-        this.fullModelData = redata['全程曲线']
+        this.fullModelData = [...this.fullModelData, ...redata['全程曲线']]
       }
       }
       // 旧版本
       // 旧版本
       // this.newAlarmData = redata['最新一条报警信息']
       // this.newAlarmData = redata['最新一条报警信息']
       // 新版本
       // 新版本
-      console.log('判断是否含有1',redata.hasOwnProperty('最近24H报警信息'))
-      console.log('判断是否含有2',redata['最近24H报警信息'])
+      // console.log('判断是否含有1',redata.hasOwnProperty('最近24H报警信息'))
+      // console.log('判断是否含有2',redata['最近24H报警信息'])
       this.newAlarmData = redata.hasOwnProperty('最近24H报警信息') ? redata['最近24H报警信息'] : ['原数据']
       this.newAlarmData = redata.hasOwnProperty('最近24H报警信息') ? redata['最近24H报警信息'] : ['原数据']
-      this.yuzhiData = redata['预制曲线']
-      this.yuzhiMarkData = redata['预制曲线线段']
+      if(redata['预制曲线'].length > 0) {this.yuzhiData = redata['预制曲线']}
+      if(redata['预制曲线线段'].length > 0) {this.yuzhiMarkData = redata['预制曲线线段']}
       // this.$refs.yuzhiCurve.markData = this.yuzhiMarkData
       // this.$refs.yuzhiCurve.markData = this.yuzhiMarkData
       var titleObj = redata['设备实时值'].find(item => item.Name === '试验名称')
       var titleObj = redata['设备实时值'].find(item => item.Name === '试验名称')
       console.log(titleObj)
       console.log(titleObj)
@@ -300,7 +300,8 @@ export default {
     showModal(title){
     showModal(title){
       this.title = title
       this.title = title
       this.visible = true
       this.visible = true
-      console.log(this.curveData)
+      // console.log('弹簧全程曲线赋值', this.$refs.fullCurve.data)
+      // this.fullModelData = this.$refs.fullCurve.data
     },
     },
     getSearchData(){
     getSearchData(){
       getAction('/datacoll/webaccess/getQcqx', this.queryParam).then(res=>{
       getAction('/datacoll/webaccess/getQcqx', this.queryParam).then(res=>{

+ 25 - 13
src/views/modules_guAn/visualization/modules/FullCurve.vue

@@ -303,30 +303,42 @@ export default {
       }
       }
 
 
       
       
-      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 wendu = data.filter(item => item.name === '温度实值-全程' || item.name === '当前温度值')
+      var nWendu = []
+      for (let i = 0; i < wendu.length; i++) {
+        const element = wendu[i];
+        var item = element.subList
+        nWendu = [...nWendu, ...item]
+      }
+      var shidu = data.filter(item => item.name === '湿度实值-全程' || item.name === '当前湿度值')
+      var nShidu = []
+      for (let i = 0; i < shidu.length; i++) {
+        const element = shidu[i];
+        var item = element.subList
+        nShidu = [...nShidu, ...item]
+      }
+      // var fushe = data.find(item => item.name === '辐射强度值-全程')
+      // var time = data.find(item => item.name === '全程曲线-时间分布')
       // var wenduZ = data.find(item => item.name === '当前温度值')
       // var wenduZ = data.find(item => item.name === '当前温度值')
       // var shiduZ = data.find(item => item.name === '当前湿度值')
       // var shiduZ = data.find(item => item.name === '当前湿度值')
       // console.log('1111',wendu,shidu,fushe,time)
       // console.log('1111',wendu,shidu,fushe,time)
-      if(wendu.subList.length >0){
-        var newData = wendu.subList.map(res =>{
+      if(nWendu.length >0){
+        this.wenduData = nWendu.map(res =>{
           return res.tagvalue
           return res.tagvalue
         })
         })
-        this.wenduData.push(...newData)
+        // this.wenduData.push(...newData)
       }
       }
-      if(shidu.subList.length >0){
-        var newData = shidu.subList.map(res =>{
+      if(nShidu.length >0){
+        this.shiduData = nShidu.map(res =>{
           return res.tagvalue
           return res.tagvalue
         })
         })
-        this.shiduData.push(...newData)
+        // this.shiduData.push(...newData)
       }
       }
-      if(wendu.subList.length >0){
-        var newData = wendu.subList.map(res =>{
+      if(nWendu.length >0){
+        this.timeData = nWendu.map(res =>{
           return res.transtime
           return res.transtime
         })
         })
-        this.timeData.push(...newData)
+        // this.timeData.push(...newData)
       }
       }
       // this.wenduData = wendu.subList.length >0 ? wendu.subList.map(res =>{
       // this.wenduData = wendu.subList.length >0 ? wendu.subList.map(res =>{
       //   return res.tagvalue
       //   return res.tagvalue

+ 58 - 20
src/views/modules_guAn/visualization/modules/FullCurveModel.vue

@@ -46,7 +46,7 @@ export default {
   watch: {
   watch: {
     data: {
     data: {
       handler(newValue, oldValue){
       handler(newValue, oldValue){
-        console.log('全程曲线', newValue, oldValue)
+        console.log('全程曲线model', newValue, oldValue)
         this.refreshData(newValue)
         this.refreshData(newValue)
       },
       },
       // immediate: true,
       // immediate: true,
@@ -300,27 +300,65 @@ export default {
       if(data.length === 0){
       if(data.length === 0){
         return
         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 === '全程曲线-时间分布')
-      var wenduZ = data.find(item => item.name === '当前温度值')
-      var shiduZ = data.find(item => item.name === '当前湿度值')
+      
+      var wendu = data.filter(item => item.name === '温度实值-全程' || item.name === '当前温度值')
+      var nWendu = []
+      for (let i = 0; i < wendu.length; i++) {
+        const element = wendu[i];
+        var item = element.subList
+        nWendu = [...nWendu, ...item]
+      }
+      var shidu = data.filter(item => item.name === '湿度实值-全程' || item.name === '当前湿度值')
+      var nShidu = []
+      for (let i = 0; i < shidu.length; i++) {
+        const element = shidu[i];
+        var item = element.subList
+        nShidu = [...nShidu, ...item]
+      }
+      // 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)
       // 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)
+      if(nWendu.length >0){
+        this.wenduData = nWendu.map(res =>{
+          return res.tagvalue
+        })
+        // this.wenduData.push(...newData)
+      }
+      if(nShidu.length >0){
+        this.shiduData = nShidu.map(res =>{
+          return res.tagvalue
+        })
+        // this.shiduData.push(...newData)
+      }
+      if(nWendu.length >0){
+        this.timeData = nWendu.map(res =>{
+          return res.transtime
+        })
+        // this.timeData.push(...newData)
       }
       }
+      // 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 wendu = data.find(item => item.Name === '温度实值-全程')
       // var shidu = data.find(item => item.Name === '湿度实值-全程')
       // var shidu = data.find(item => item.Name === '湿度实值-全程')
       // var fushe = data.find(item => item.Name === '辐射强度值-全程')
       // var fushe = data.find(item => item.Name === '辐射强度值-全程')

+ 26 - 14
src/views/modules_guAn/visualization/modules/RealTimeCurve.vue

@@ -274,31 +274,43 @@ export default {
       if(data.length === 0){
       if(data.length === 0){
         return
         return
       }
       }
-      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 wendu = data.filter(item => item.name === '温度实值-实时' || item.name === '当前温度值')
+      var nWendu = []
+      for (let i = 0; i < wendu.length; i++) {
+        const element = wendu[i];
+        var item = element.subList
+        nWendu = [...nWendu, ...item]
+      }
+      var shidu = data.filter(item => item.name === '湿度实值-实时' || item.name === '当前湿度值')
+      var nShidu = []
+      for (let i = 0; i < shidu.length; i++) {
+        const element = shidu[i];
+        var item = element.subList
+        nShidu = [...nShidu, ...item]
+      }
+      // var fushe = data.find(item => item.name === '辐射强度值-实时')
+      // var time = data.find(item => item.name === '实时曲线-时间分布')
       // var wenduZ = data.find(item => item.name === '当前温度值')
       // var wenduZ = data.find(item => item.name === '当前温度值')
       // var shiduZ = data.find(item => item.name === '当前湿度值')
       // var shiduZ = data.find(item => item.name === '当前湿度值')
       console.log(7878,this.wenduData)
       console.log(7878,this.wenduData)
-
-      if(wendu.subList.length >0){
-        var newData = wendu.subList.map(res =>{
+      console.log('组合数据', wendu, nWendu)
+      if(nWendu.length >0){
+        this.wenduData = nWendu.map(res =>{
           return res.tagvalue
           return res.tagvalue
         })
         })
-        this.wenduData.push(...newData)
+        // this.wenduData.push(...newData)
       }
       }
-      if(shidu.subList.length >0){
-        var newData = shidu.subList.map(res =>{
+      if(nShidu.length >0){
+        this.shiduData = nShidu.map(res =>{
           return res.tagvalue
           return res.tagvalue
         })
         })
-        this.shiduData.push(...newData)
+        // this.shiduData.push(...newData)
       }
       }
-      if(wendu.subList.length >0){
-        var newData = wendu.subList.map(res =>{
+      if(nWendu.length >0){
+        this.timeData = nWendu.map(res =>{
           return res.transtime
           return res.transtime
         })
         })
-        this.timeData.push(...newData)
+        // this.timeData.push(...newData)
       }
       }