Browse Source

优化大屏-智慧生产 数据联动

renxin 5 months ago
parent
commit
58cdc855d6

+ 25 - 1
src/views/dataBoard/smartProduction/children/rightPanel.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="wadah">
-    <el-carousel indicator-position="outside" class="flow-carousel" :autoplay="false" @change="changeCarousel">
+    <el-carousel ref="carousel" indicator-position="outside" class="flow-carousel" :autoplay="false" @change="changeCarousel">
       <el-carousel-item
         v-for="(item, index) in categoryType"
         :key="index"
@@ -43,6 +43,7 @@
 import { getassayConfigPage, getStatisticsPage } from '@/api/dcApi/assayMngApi'
 import flowCurve from './flowCurve.vue'
 import moment from 'moment'
+import eventBus from '@/utils/bus.js'
 import MultipleData from '../../components/multipleData/multipleData.vue'
 export default {
   components: {
@@ -73,6 +74,29 @@ export default {
       }
     })
   },
+  created() {
+    eventBus.$on('waterActiveT', (data) => {
+      switch (data.id) {
+        case 'graphContainer1':
+          this.$refs.carousel.setActiveItem(5)
+          break
+        case 'graphContainer2':
+          this.$refs.carousel.setActiveItem(3)
+          break
+        case 'graphContainer3':
+          this.$refs.carousel.setActiveItem(2)
+          break
+        case 'graphContainer4':
+          this.$refs.carousel.setActiveItem(1)
+          break
+        default:
+          break
+      }
+    })
+  },
+  beforeDestroy() {
+    eventBus.$off('waterActiveT')
+  },
   methods: {
     changeCarousel(val) {
       this.reportTitle = val

+ 4 - 2
src/views/zhpt/scada/scadaCraftMap/MiniScadaCraftMap/index.vue

@@ -10,7 +10,7 @@
           'width:80px;margin-bottom: 2px;background:' +
             (item.active ? '#053060' : '#409EFF')
         "
-        @click="setCraft(item.id)"
+        @click="setCraft(item.id,item)"
       >{{ item.name }}</el-button>
     </el-button-group>
 
@@ -615,7 +615,7 @@ export default {
     /**
      * @description 设置显示、隐藏
      */
-    setCraft(id) {
+    setCraft(id,val) {
       // 判断是不是当前打开的,如果是直接退出
       const flag = this.waterworks.find(
         (item) => item.active === true && item.id === id
@@ -629,6 +629,8 @@ export default {
         this.loadCraft()
         // 调用事件总线
         eventBus.$emit('waterActive', this.showItem)
+        console.log('waterActiveT', val)
+        eventBus.$emit('waterActiveT', val)
       })
     },