派生自 wuyushui/SewerAndRainNetwork

chenzeping
2021-03-05 23ae179b327169ba5df910498e62ffc1dae4b740
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
<template>
  <div class="legend-panel">
    <div class="legend-icon unactive" @click="legendChange()">
      <i class="el-icon-more-outline"></i>
      <span>图例</span>
    </div>
    <transition name="fade">
      <div class="legend-content" v-show="legendControl">
        <div class="legend-content-centent" v-for="(item,index) in legendContents" :key="index">
          <p>{{ item.title }}</p>
          <ul>
            <li v-for="(ite,inde) in item.items" :key="inde">
              <img :src='ite.legendImage' alt=''>
              <span>{{ ite.legendContent }}</span>
            </li>
          </ul>
          <div :class="index === 5 ? '':'under-line'"></div>
        </div>
      </div>
    </transition>
  </div>
</template>
 
<script>
export default {
  name: 'LegendPanel',
  data () {
    return {
      // 控制图例 内容的 显示/隐藏
      legendControl: false,
      // 图里存储数据
      legendContents: [
        {
          title: '预警',
          items: [
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '暴雨红色预警'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '暴雨橙色预警'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '暴雨黄色预警'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '暴雨蓝色预警'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '暴风红色预警'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '暴风红色预警'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '暴风红色预警'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '暴风红色预警'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '暴风红色预警'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '暴风红色预警'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '暴风红色预警'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '暴风红色预警'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '暴风红色预警'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '暴风红色预警'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '暴风红色预警'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '暴风红色预警'
            }
          ]
        },
        {
          title: '企业',
          items: [
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '中国石化'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '油田企业'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '炼化企业'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '销售企业'
            }
          ]
        },
        {
          title: '水情',
          items: [
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '水文站'
            }
          ]
        },
        {
          title: '管线',
          items: [
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '天然气管线'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '天然气场站'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '成品油管线'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '成品油场站'
            }
          ]
        },
        {
          title: '台风',
          items: [
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '台风实测中心'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '台风实测路径'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '台风预测中心'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '台风预测路径'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '台风当前中心'
            }
          ]
        },
        {
          title: '降水等级(单位:mm)',
          items: [
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '小雨0-5'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '中雨5-10'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '大雨10-20'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '暴雨20-50'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '大暴雨50-100'
            }
          ]
        }
      ]
    }
  },
  methods: {
    // 图标 控制内容的展示与隐藏
    legendChange () {
      if (this.legendControl === false) {
        this.legendControl = true
      } else {
        this.legendControl = false
      }
    }
  }
}
</script>
 
<style lang="less" scoped>
.legend-panel {
  position: absolute;
  z-index: 502;
  bottom: .11979rem;
  right: .14583rem;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  -webkit-box-align: end;
  -ms-flex-align: end;
  align-items: flex-end;
 
  .legend-icon {
    width: 3.4rem;
    height: 1.6rem;
    border-radius: .3rem;
    background: white;
    text-align: center;
  }
 
  @keyframes bounce-in {
    0% {
      transform: scale(0);
      opacity: 0.3;
    }
    50% {
      transform: scale(1.2);
    }
    100% {
      transform: scale(1);
      opacity: 1;
    }
  }
 
  .fade-enter-active {
    transform-origin: right center;
    animation: bounce-in 1s;
  }
 
  .fade-leave-active {
    transform-origin: left center;
    animation: bounce-in 1s reverse;
  }
 
  .legend-content {
    position: absolute;
    right: 1rem;
    bottom: 3rem;
    width: 30rem;
    height: 30rem;
    border-radius: 1rem;
    background: #3c7699;
 
    .legend-content-centent {
      p {
        text-align: center;
        color: #ffffff;
        font-size: 14px;
        margin-block-start: 0.3rem;
        margin-block-end: 0.2rem;
      }
 
      ul {
        list-style: none;
        display: flex;
        flex-wrap: wrap;
        padding-inline: 20px 0;
        margin-block: 0;
 
        li {
          width: 25%;
          height: 1.5rem;
          display: flex;
          align-items: center;
 
          img {
            height: 18px;
            width: 18px;
          }
 
          span {
            font-size: 12px;
            color: white;
          }
        }
      }
    }
 
    .under-line {
      height: 2px;
      background: #7bc5ef;
      margin-block-start: 0.5rem;
      margin-block-end: 0;
    }
  }
}
</style>