1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<template>
  <div style="height: 100%;max-height: 748px">
    <template v-if="+currentTreeNodeInfo.type===2">
      <div style="height: 100%;max-height: 748px">
        <!--产品结构树右侧顶部区域-->
        <div style="height: 45%;overflow: hidden">
          <DeviceStructureMainTop :size="containerSize" ref="mainTopRef" :currentTreeNodeInfo="currentTreeNodeInfo"/>
        </div>
 
        <!--产品结构树右侧底部区域-->
        <div style="height: 55%;overflow: hidden">
          <DeviceStructureMainBottom :size="containerSize" :currentTreeNodeInfo="currentTreeNodeInfo"/>
        </div>
      </div>
    </template>
 
    <template v-else>
      <a-tabs>
        <a-tab-pane :key="1" tab="车间属性">
          <WorkshopInfo :currentLevelDetails="currentTreeNodeInfo" :size="containerSize"/>
        </a-tab-pane>
      </a-tabs>
    </template>
  </div>
</template>
 
<script>
  import DeviceStructureMainTop from './DeviceStructureMainTop'
  import DeviceStructureMainBottom from './DeviceStructureMainBottom'
  import WorkshopInfo from './Workshop/WorkshopInfo'
 
  export default {
    name: 'DeviceStructureMain',
    components: {
      WorkshopInfo,
      DeviceStructureMainTop,
      DeviceStructureMainBottom
    },
    created() {
      this.$bus.$on('sendCurrentTreeNodeInfo', this.receiveCurrentTreeNodeInfo)
    },
    data() {
      return {
        containerSize: 'small',
        currentTreeNodeInfo: {}
      }
    },
    methods: {
      /**
       * 接收树组件传来的当前选中的树节点信息
       * @param treeNodeInfo 树节点信息
       */
      receiveCurrentTreeNodeInfo(treeNodeInfo) {
        // 从树组件接受树节点信息后从父组件流入子组件
        this.currentTreeNodeInfo = treeNodeInfo
        if (treeNodeInfo.equipmentId) {
          this.$nextTick(() => {
            if (this.$refs.mainTopRef) this.$refs.mainTopRef.loadHasSentDocumentListData()
          })
        }
        console.log('currentTreeNodeInfo------------------', this.currentTreeNodeInfo)
      }
    }
  }
</script>