2023西安数博会CIM演示-【前端】-Web
AdaKing88
2023-08-21 bc03b832caa49bbcd2674fe4cae3701b5059bf95
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<template>
  <div class="smartPark">
    <parkState v-show="active == 1" />
    <safeObserve v-show="active == 2" />
    <energyManage v-show="active == 3" />
    <alarmInfo v-show="active == 4" />
    <environmentSpace v-show="active == 5" />
 
 
    <!-- <div class="topBtnRow">
      <div class="topBtn" :style="{ backgroundImage: 'url(' + (active == 1 ? coverImgUrl : uncoverImgUrl) + ')' }"
        @click="clickBtn(1)">
        园区态势</div>
      <div class="topBtn" :style="{ backgroundImage: 'url(' + (active == 2 ? coverImgUrl : uncoverImgUrl) + ')' }"
        @click="clickBtn(2)">
        安全监测</div>
      <div class="topBtn" :style="{ backgroundImage: 'url(' + (active == 3 ? coverImgUrl : uncoverImgUrl) + ')' }"
        @click="clickBtn(3)">
        能耗管理</div>
      <div class="topBtn" :style="{ backgroundImage: 'url(' + (active == 4 ? coverImgUrl : uncoverImgUrl) + ')' }"
        @click="clickBtn(4)">
        告警信息</div>
      <div class="topBtn" :style="{ backgroundImage: 'url(' + (active == 5 ? coverImgUrl : uncoverImgUrl) + ')' }"
        @click="clickBtn(5)">
        环境空间</div>
    </div> -->
  </div>
</template>
 
<script>
import parkState from './parkState'
import safeObserve from './safeObserve'
import energyManage from './energyManage'
import alarmInfo from './alarmInfo'
import environmentSpace from './environmentSpace'
export default {
  name: "smartPark",
  components: {
    parkState,
    safeObserve,
    energyManage,
    alarmInfo,
    environmentSpace
  },
  data() {
    return {
      coverImgUrl: require('@/assets/img/park_btn_active.png'),
      uncoverImgUrl: require('@/assets/img/park_btn.png'),
      active: 0,
    }
  },
  methods: {
    clickBtn(index) {
      if (this.active == index) {
        this.active = 0
      } else {
        this.active = index
      }
 
      this.$nextTick(() => [
        window.dispatchEvent(new Event('resize'))//初始化echarts
      ])
    }
  },
  watch: {
    "$store.state.currentMenu": function (val) {
      let index = 0
      switch (val) {
        case '园区概览':
          index = 1
          break;
 
        case '安全监测':
          index = 2
          break;
 
        case '能耗感知':
          index = 3
          break;
 
        case '告警信息':
          index = 4
          break;
 
        case '环境空间':
          index = 5
          break;
 
        default:
          index = 0
          break;
      }
      console.log(' @@ index',index)
      if (this.active == index) {
        // this.typeIdx = 0
      } else {
        this.active = index
      }
 
      this.$nextTick(() => [
        window.dispatchEvent(new Event('resize'))//初始化echarts
      ])
    }
  },
}
</script>
 
<style scoped lang="less">
.smartPark {
  height: 100%;
  width: 100%;
  position: absolute;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
 
  .topBtnRow {
    position: absolute;
    bottom: 140px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    pointer-events: all;
    display: flex;
    flex-direction: row;
    justify-content: center;
 
    .topBtn {
      width: 104.5px;
      height: 38px;
      display: flex;
      flex-direction: row;
      justify-content: center;
      /*
      //align-items: center;
      */
      line-height: 3;
      font-size: 11px;
      color: #ffffff;
      cursor: pointer;
 
      background-image: url("~@/assets/img/topBtnBack.png");
      background-repeat: no-repeat;
      background-size: 100% 100%;
      letter-spacing: 1.1px;
      text-shadow: -0.87px 0.5px 4px 0px rgba(5, 27, 54, 0.42);
      font-weight: 700;
    }
  }
 
}
</style>