浏览代码

运营平台-停车热力图

duwendi 1 年之前
父节点
当前提交
1564db43a9
共有 3 个文件被更改,包括 305 次插入0 次删除
  1. 297 0
      src/pages/index/components/parking_heatmap.vue
  2. 2 0
      src/pages/index/layouts/indexLayout.vue
  3. 6 0
      src/router/index.js

+ 297 - 0
src/pages/index/components/parking_heatmap.vue

@@ -0,0 +1,297 @@
1
+<template>
2
+  <div style="color: #d5d3d3" class="middle-map">
3
+    <div style="height: 450px; width: 50%">
4
+      <div class="bottom" id="map1"></div>
5
+    </div>
6
+    <div style="height: 450px; width: 50%">
7
+      <div class="bottom" id="map2"></div>
8
+    </div>
9
+  </div>
10
+</template>
11
+
12
+<script>
13
+import * as echarts from 'echarts'
14
+import * as geoJson from '../../../util/411100.json'
15
+import linechart from "@/components/lineChart";
16
+import api from '@/api/audit'
17
+
18
+export default {
19
+  components: {
20
+    linechart,
21
+  },
22
+  data() {
23
+    return {
24
+      value: '',
25
+      dqIndex: -1,
26
+      timer: null,
27
+      option: {
28
+        visualMap: {
29
+          show: true,
30
+          type: "continuous",
31
+          left: "0%",
32
+          bottom: "0%",
33
+          calculable: true,
34
+          textStyle: {
35
+            color: "white",
36
+          },
37
+          text: ["(%)"],
38
+          min: 0,
39
+          max: 100,
40
+          inRange: {
41
+            color: ["#4FC9FB","#36ADFC","#1788D1","#0E6BAE","#1871A2","#0D4D7D"],
42
+          },
43
+        },
44
+        geo: {
45
+          map: "luohe",
46
+          // aspectScale: 1,
47
+          roam: false,
48
+          itemStyle: {
49
+            normal: {
50
+              borderColor: "#2ab8ff",
51
+              borderWidth: 2.5,
52
+              areaColor: "#12235c",
53
+            },
54
+            emphasis: {
55
+              areaColor: "#2AB8FF",
56
+              shadowColor: "rgba(42,184,255, 0.7)",
57
+              shadowOffsetY: 5,
58
+              shadowOffsetX: 5,
59
+              shadowBlur: 5,
60
+            },
61
+          },
62
+        },
63
+        tooltip: {
64
+          confine: true,
65
+          formatter: this.mapTooltip,
66
+          position: "inside",
67
+          backgroundColor: "transparent",
68
+        },
69
+        series: [
70
+          {
71
+            type: "map",
72
+            // roam: true,
73
+            label: {
74
+              normal: {
75
+                textStyle: {
76
+                  color: "#fff",
77
+                },
78
+              },
79
+              emphasis: {
80
+                show: false,
81
+                textStyle: {
82
+                  color: "#fff",
83
+                },
84
+              },
85
+            },
86
+            itemStyle: {
87
+              normal: {
88
+                borderColor: "#76bef5",
89
+                borderWidth: 1.5,
90
+                areaColor: "#4282de",
91
+              },
92
+              emphasis: {
93
+                areaColor: "#002aff",
94
+                borderWidth: 0,
95
+                color: "green",
96
+              },
97
+            },
98
+            roam: false,
99
+            map: "luohe", //使用
100
+            data: [],
101
+          },
102
+        ],
103
+      },
104
+    };
105
+  },
106
+
107
+  mounted() {
108
+    this.zxt()
109
+    api.dtnyzs().then(res => {
110
+      let arr = []
111
+      let dataSoure = res.data
112
+      for (const key in dataSoure) {
113
+        if (key !== 411100) {
114
+          arr.push({
115
+            name: dataSoure[key].quyuName,
116
+            value: Number(dataSoure[key].zb),
117
+          });
118
+        }
119
+      }
120
+      let mapMax = Math.max(...arr.map(item => item.value))
121
+      let mapMin = Math.min(...arr.map(item => item.value))
122
+      let chart = echarts.init(document.getElementById("map1"));
123
+      echarts.registerMap("luohe", geoJson);
124
+      this.option.series[0].data = arr;
125
+      this.option.visualMap.min = mapMin;
126
+      this.option.visualMap.max = mapMax;
127
+      chart.setOption(this.option);
128
+      this.dqIndex = -1;
129
+      this.setIntervalMap(chart);
130
+      //鼠标移入静止播放
131
+      chart.on("mouseover", (e) => {
132
+        clearInterval(this.timer);
133
+        chart.dispatchAction({
134
+          type: "showTip",
135
+          seriesIndex: 0,
136
+          dataIndex: e.dataIndex,
137
+        });
138
+      });
139
+      chart.on("mouseout", (e) => {
140
+        clearInterval(this.timer);
141
+        //鼠标移出后先把上次的高亮取消
142
+        chart.dispatchAction({
143
+          type: "downplay",
144
+          seriesIndex: 0,
145
+          dataIndex: e.dataIndex,
146
+        });
147
+        this.setIntervalMap(chart);
148
+      });
149
+    })
150
+    api.dtnyzs().then(res => {
151
+      let arr = []
152
+      let dataSoure = res.data
153
+      for (const key in dataSoure) {
154
+        if (key !== 411100) {
155
+          arr.push({
156
+            name: dataSoure[key].quyuName,
157
+            value: Number(dataSoure[key].zb),
158
+          });
159
+        }
160
+      }
161
+      let mapMax = Math.max(...arr.map(item => item.value))
162
+      let mapMin = Math.min(...arr.map(item => item.value))
163
+      let chart = echarts.init(document.getElementById("map2"));
164
+      echarts.registerMap("luohe", geoJson);
165
+      this.option.series[0].data = arr;
166
+      this.option.visualMap.min = mapMin;
167
+      this.option.visualMap.max = mapMax;
168
+      chart.setOption(this.option);
169
+      this.dqIndex = -1;
170
+      this.setIntervalMap(chart);
171
+      //鼠标移入静止播放
172
+      chart.on("mouseover", (e) => {
173
+        clearInterval(this.timer);
174
+        chart.dispatchAction({
175
+          type: "showTip",
176
+          seriesIndex: 0,
177
+          dataIndex: e.dataIndex,
178
+        });
179
+      });
180
+      chart.on("mouseout", (e) => {
181
+        clearInterval(this.timer);
182
+        //鼠标移出后先把上次的高亮取消
183
+        chart.dispatchAction({
184
+          type: "downplay",
185
+          seriesIndex: 0,
186
+          dataIndex: e.dataIndex,
187
+        });
188
+        this.setIntervalMap(chart);
189
+      });
190
+    })
191
+  },
192
+  methods: {
193
+    zxt() {
194
+      api.zxt().then(res => {
195
+        this.linedata = res.data || []
196
+      })
197
+    },
198
+    lineTooltipFormat(params) {
199
+      const data = params[0].data;
200
+      return `<div class="line-tooltip">
201
+        <div style="color: ${params[0].color}">${params[0].seriesName}: ${
202
+        params[0].data.lastAmount || "--"
203
+      }</div>
204
+      </div>`;
205
+    },
206
+    setIntervalMap(chart) {
207
+      this.timer = setInterval(() => {
208
+        chart.dispatchAction({
209
+          type: "showTip",
210
+          seriesIndex: 0,
211
+          dataIndex: this.dqIndex + 1,
212
+        });
213
+        this.dqIndex++;
214
+        if (this.dqIndex > 4) {
215
+          this.dqIndex = -1;
216
+        }
217
+      }, 3000);
218
+    },
219
+    mapTooltip(data) {
220
+      return `<div class="map-tooltip">
221
+        <div class="map-tooltip-name">${data.name}:<span class="map-tooltip-value">${data.value}%</span></div>
222
+      </div>`;
223
+    },
224
+  },
225
+};
226
+</script>
227
+<style  lang="scss" scoped>
228
+.form-wrapper {
229
+  margin-bottom: 20px;
230
+}
231
+/deep/ .el-input__inner {
232
+  background: #2d3744;
233
+  border: none;
234
+  border-radius: 0;
235
+}
236
+/deep/ .el-select {
237
+  height: 40px;
238
+  .el-input__inner {
239
+    height: 40px;
240
+  }
241
+  .el-input__prefix, .el-input__suffix {
242
+    height: 40px;
243
+  }
244
+
245
+  /* 下面设置右侧按钮居中 */
246
+  .el-input__suffix {
247
+    top: 0px;
248
+    display: flex;
249
+    justify-content: center;
250
+    align-items: center;
251
+    flex-wrap: nowrap;
252
+    flex-direction: row;
253
+    align-content: flex-start;
254
+  }
255
+  /* 输入框加上上下边是 32px + 2px =34px */
256
+  .el-input__icon {
257
+    line-height: 0px;
258
+  }
259
+}
260
+/deep/ .form-wrapper .el-button {
261
+  background: linear-gradient(90deg,#0158d9,#3c97e4);
262
+  width: 100px;
263
+  height: 40px;
264
+}
265
+.body-wrapper {
266
+  width: 100%;
267
+  height: 100%;
268
+  box-sizing: border-box;
269
+  background: #0c0c0c;
270
+}
271
+</style>
272
+<style lang="less" scoped>
273
+.middle-map {
274
+  width: 100%;
275
+  height: 100%;
276
+  display: flex;
277
+  justify-content: space-between;
278
+  .bottom {
279
+    height: 90%;
280
+    width: 100%;
281
+  }
282
+  /deep/.map-tooltip {
283
+    font-size: 18px;
284
+    padding: 10px 20px;
285
+    background: url("../../../../static/img/u231.png");
286
+    background-size: 100% 100%;
287
+    .map-tooltip-name {
288
+      color: #00e4ff;
289
+    }
290
+    .map-tooltip-value {
291
+      color: white;
292
+      margin-left: 20px;
293
+    }
294
+  }
295
+}
296
+
297
+</style>

+ 2 - 0
src/pages/index/layouts/indexLayout.vue

@@ -88,6 +88,8 @@ export default {
88 88
         {name: '经营情况', url: '/business_conditions'},
89 89
         {name: '事件监测', url: '/event_monitoring'},
90 90
         {name: '资源接入', url: '/resource_access'},
91
+        // 以下为运营管理平台
92
+        {name: '停车场热力图', url: '/parking_heatmap'},
91 93
       ]
92 94
     }
93 95
   },

+ 6 - 0
src/router/index.js

@@ -282,6 +282,12 @@ export default new Router({
282 282
           path: "/resource_access",
283 283
           component: () => import("../pages/index/components/resource_access.vue")
284 284
         },
285
+        // 以下为运营管理平台
286
+        {
287
+          name: "parking_heatmap",
288
+          path: "/parking_heatmap",
289
+          component: () => import("../pages/index/components/parking_heatmap.vue")
290
+        },
285 291
       ]
286 292
     }
287 293
   ]