Browse Source

校园首页

gzb
wangzhonglu 9 months ago
parent
commit
a02ca8a476

+ 65
- 7
src/views/platformSection/home/index.vue View File

@@ -217,6 +217,7 @@ export default {
217 217
             res.push({
218 218
               name: outdata[i].name,
219 219
               value: geoCoord.concat(outdata[i].value),
220
+              numInfo: outdata[i].numInfo,
220 221
               //单独修改圆环上的文字
221 222
               label: {
222 223
                 formatter: () => {
@@ -245,13 +246,22 @@ export default {
245 246
           appendTo: "body",
246 247
           formatter: (params) => {
247 248
             return `${params.name}<div>设备数:${
248
-              (params.numInfo && params.numInfo.devicenum) || 0
249
+              (params.data &&
250
+                params.data.numInfo &&
251
+                params.data.numInfo.devicenum) ||
252
+              0
249 253
             } 台</div>
250 254
             <div>用户数:${
251
-              (params.numInfo && params.numInfo.usernum) || 0
255
+              (params.data &&
256
+                params.data.numInfo &&
257
+                params.data.numInfo.usernum) ||
258
+              0
252 259
             } 人</div>
253 260
             <div>学校数:${
254
-              (params.numInfo && params.numInfo.schoolnum) || 0
261
+              (params.data &&
262
+                params.data.numInfo &&
263
+                params.data.numInfo.schoolnum) ||
264
+              0
255 265
             } 所</div>`;
256 266
           }
257 267
         },
@@ -312,6 +322,34 @@ export default {
312 322
           },
313 323
           {
314 324
             type: "scatter",
325
+            tooltip: {
326
+              show: true,
327
+              borderColor: "#6AC8F0",
328
+              // 将tooltip限制在图表内
329
+              confine: true,
330
+              // 将tooltip添加到body下
331
+              appendTo: "body",
332
+              formatter: (params) => {
333
+                return `${params.name}<div>设备数:${
334
+                  (params.data &&
335
+                    params.data.numInfo &&
336
+                    params.data.numInfo.devicenum) ||
337
+                  0
338
+                } 台</div>
339
+            <div>用户数:${
340
+              (params.data &&
341
+                params.data.numInfo &&
342
+                params.data.numInfo.usernum) ||
343
+              0
344
+            } 人</div>
345
+            <div>学校数:${
346
+              (params.data &&
347
+                params.data.numInfo &&
348
+                params.data.numInfo.schoolnum) ||
349
+              0
350
+            } 所</div>`;
351
+              }
352
+            },
315 353
             coordinateSystem: "geo",
316 354
             zlevel: 2,
317 355
             rippleEffect: {
@@ -323,7 +361,6 @@ export default {
323 361
               show: true,
324 362
               color: "#fff"
325 363
             },
326
-            // #FF243A
327 364
             symbol: "pin", //定位图标样式
328 365
             symbolSize: 60,
329 366
             //点的名称和经纬度
@@ -682,9 +719,29 @@ export default {
682 719
         color:
683 720
           this.deviceActivityInfo.doEvent === 2 ? ["#52C41A"] : ["#339DFF"],
684 721
         tooltip: {
685
-          trigger: "item",
686
-          formatter: (params) => {
687
-            return `${params.name}:${params.value}次`;
722
+          trigger: "axis",
723
+          backgroundColor: "#fff", //背景颜色(此时为默认色)
724
+          borderWidth: 1, //边框线宽
725
+          textStyle: {
726
+            lineHeight: 1.6,
727
+            color: "#253A70"
728
+          },
729
+          axisPointer: {
730
+            z: 1, //竖线在圆圈后面
731
+            lineStyle: {
732
+              color: "#f8f8fd",
733
+              width: 20,
734
+              opacity: 0.7
735
+            }
736
+          },
737
+          formatter: (data) => {
738
+            let date = "";
739
+            let seriesDom = "";
740
+            for (const item of data) {
741
+              date = item.name;
742
+              seriesDom += `<div><span style="color: #95ABDF">${item.seriesName}</span> ${item.value}次</div>`;
743
+            }
744
+            return `${date}${seriesDom}`;
688 745
           }
689 746
         },
690 747
         legend: {
@@ -769,6 +826,7 @@ export default {
769 826
                 verticalAlign: "bottom",
770 827
                 position: "top",
771 828
                 distance: 0,
829
+                color: "inherit",
772 830
                 formatter: `{c}`
773 831
               }
774 832
             },

+ 65
- 7
src/views/regionSection/home/index.vue View File

@@ -210,6 +210,7 @@ export default {
210 210
             res.push({
211 211
               name: outdata[i].name,
212 212
               value: geoCoord.concat(outdata[i].value),
213
+              numInfo: outdata[i].numInfo,
213 214
               //单独修改圆环上的文字
214 215
               label: {
215 216
                 formatter: () => {
@@ -238,13 +239,22 @@ export default {
238 239
           appendTo: "body",
239 240
           formatter: (params) => {
240 241
             return `${params.name}<div>设备数:${
241
-              (params.numInfo && params.numInfo.devicenum) || 0
242
+              (params.data &&
243
+                params.data.numInfo &&
244
+                params.data.numInfo.devicenum) ||
245
+              0
242 246
             } 台</div>
243 247
             <div>用户数:${
244
-              (params.numInfo && params.numInfo.usernum) || 0
248
+              (params.data &&
249
+                params.data.numInfo &&
250
+                params.data.numInfo.usernum) ||
251
+              0
245 252
             } 人</div>
246 253
             <div>学校数:${
247
-              (params.numInfo && params.numInfo.schoolnum) || 0
254
+              (params.data &&
255
+                params.data.numInfo &&
256
+                params.data.numInfo.schoolnum) ||
257
+              0
248 258
             } 所</div>`;
249 259
           }
250 260
         },
@@ -305,6 +315,34 @@ export default {
305 315
           },
306 316
           {
307 317
             type: "scatter",
318
+            tooltip: {
319
+              show: true,
320
+              borderColor: "#6AC8F0",
321
+              // 将tooltip限制在图表内
322
+              confine: true,
323
+              // 将tooltip添加到body下
324
+              appendTo: "body",
325
+              formatter: (params) => {
326
+                return `${params.name}<div>设备数:${
327
+                  (params.data &&
328
+                    params.data.numInfo &&
329
+                    params.data.numInfo.devicenum) ||
330
+                  0
331
+                } 台</div>
332
+            <div>用户数:${
333
+              (params.data &&
334
+                params.data.numInfo &&
335
+                params.data.numInfo.usernum) ||
336
+              0
337
+            } 人</div>
338
+            <div>学校数:${
339
+              (params.data &&
340
+                params.data.numInfo &&
341
+                params.data.numInfo.schoolnum) ||
342
+              0
343
+            } 所</div>`;
344
+              }
345
+            },
308 346
             coordinateSystem: "geo",
309 347
             zlevel: 2,
310 348
             rippleEffect: {
@@ -316,7 +354,6 @@ export default {
316 354
               show: true,
317 355
               color: "#fff"
318 356
             },
319
-            // #FF243A
320 357
             symbol: "pin", //定位图标样式
321 358
             symbolSize: 60,
322 359
             //点的名称和经纬度
@@ -675,9 +712,29 @@ export default {
675 712
         color:
676 713
           this.deviceActivityInfo.doEvent === 2 ? ["#52C41A"] : ["#339DFF"],
677 714
         tooltip: {
678
-          trigger: "item",
679
-          formatter: (params) => {
680
-            return `${params.name}:${params.value}次`;
715
+          trigger: "axis",
716
+          backgroundColor: "#fff", //背景颜色(此时为默认色)
717
+          borderWidth: 1, //边框线宽
718
+          textStyle: {
719
+            lineHeight: 1.6,
720
+            color: "#253A70"
721
+          },
722
+          axisPointer: {
723
+            z: 1, //竖线在圆圈后面
724
+            lineStyle: {
725
+              color: "#f8f8fd",
726
+              width: 20,
727
+              opacity: 0.7
728
+            }
729
+          },
730
+          formatter: (data) => {
731
+            let date = "";
732
+            let seriesDom = "";
733
+            for (const item of data) {
734
+              date = item.name;
735
+              seriesDom += `<div><span style="color: #95ABDF">${item.seriesName}</span> ${item.value}次</div>`;
736
+            }
737
+            return `${date}${seriesDom}`;
681 738
           }
682 739
         },
683 740
         legend: {
@@ -762,6 +819,7 @@ export default {
762 819
                 verticalAlign: "bottom",
763 820
                 position: "top",
764 821
                 distance: 0,
822
+                color: "inherit",
765 823
                 formatter: `{c}`
766 824
               }
767 825
             },

+ 947
- 7
src/views/schoolSection/home/index.vue View File

@@ -1,25 +1,883 @@
1 1
 <template>
2 2
   <div class="main_root">
3 3
     <div class="row_item">
4
-      <div class="cell_item left_w"></div>
5
-      <div class="cell_item right_w"></div>
4
+      <div class="cell_item left_w">
5
+        <div class="cell_header">
6
+          <div>设备用户</div>
7
+        </div>
8
+        <div class="content_main" id="deviceUserEcharts"></div>
9
+      </div>
10
+      <div class="cell_item right_w device_info">
11
+        <div class="device_info_left">
12
+          <div class="cell_header">
13
+            <div>设备类型</div>
14
+          </div>
15
+          <div class="content_main" id="deviceModelEcharts"></div>
16
+        </div>
17
+        <div class="device_info_right">
18
+          <div class="cell_header">
19
+            <div>客户端版本</div>
20
+          </div>
21
+          <div class="content_main">
22
+            <div id="controlVersionEcharts"></div>
23
+            <div id="appVersionEcharts"></div>
24
+          </div>
25
+        </div>
26
+      </div>
6 27
     </div>
7 28
     <div class="row_item">
8
-      <div class="cell_item left_w"></div>
9
-      <div class="cell_item right_w"></div>
29
+      <div class="cell_item left_w">
30
+        <div class="cell_header">
31
+          <div>增长趋势</div>
32
+        </div>
33
+        <div class="content_main" id="growthTrendEcharts"></div>
34
+      </div>
35
+      <div class="cell_item right_w">
36
+        <div class="cell_header">
37
+          <div>在线设备</div>
38
+        </div>
39
+        <div class="content_main online_devices">
40
+          <div>
41
+            <div
42
+              class="online_info online_1"
43
+              v-if="onlineDeviceList.length > 0"
44
+            >
45
+              <div>
46
+                {{
47
+                  onlineDeviceList[0].tatalnum > 0
48
+                    ? Math.floor(
49
+                        (onlineDeviceList[0].num /
50
+                          onlineDeviceList[0].tatalnum) *
51
+                          10000
52
+                      ) / 100
53
+                    : 0
54
+                }}%
55
+              </div>
56
+              <div>最近1小时</div>
57
+              <div class="online_title">
58
+                在线 <span>{{ onlineDeviceList[0].num }}</span>
59
+              </div>
60
+            </div>
61
+            <div id="onlineEcharts1"></div>
62
+          </div>
63
+          <div>
64
+            <div
65
+              class="online_info online_2"
66
+              v-if="onlineDeviceList.length > 0"
67
+            >
68
+              <div>
69
+                {{
70
+                  onlineDeviceList[1].tatalnum > 0
71
+                    ? Math.floor(
72
+                        (onlineDeviceList[1].num /
73
+                          onlineDeviceList[1].tatalnum) *
74
+                          10000
75
+                      ) / 100
76
+                    : 0
77
+                }}%
78
+              </div>
79
+              <div>最近48小时</div>
80
+              <div class="online_title">
81
+                在线 <span>{{ onlineDeviceList[1].num }}</span>
82
+              </div>
83
+            </div>
84
+            <div id="onlineEcharts2"></div>
85
+          </div>
86
+          <div>
87
+            <div
88
+              class="online_info online_3"
89
+              v-if="onlineDeviceList.length > 0"
90
+            >
91
+              <div>
92
+                {{
93
+                  onlineDeviceList[2].tatalnum > 0
94
+                    ? Math.floor(
95
+                        (onlineDeviceList[2].num /
96
+                          onlineDeviceList[2].tatalnum) *
97
+                          10000
98
+                      ) / 100
99
+                    : 0
100
+                }}%
101
+              </div>
102
+              <div>最近7天</div>
103
+              <div class="online_title">
104
+                在线 <span>{{ onlineDeviceList[2].num }}</span>
105
+              </div>
106
+            </div>
107
+            <div id="onlineEcharts3"></div>
108
+          </div>
109
+        </div>
110
+      </div>
10 111
     </div>
11 112
     <div class="row_item">
12
-      <div class="cell_item"></div>
113
+      <div class="cell_item">
114
+        <div class="cell_header">
115
+          <div>设备活跃度</div>
116
+          <Select
117
+            v-model="deviceActivityInfo.doEvent"
118
+            :transfer="true"
119
+            @on-change="getDeviceActivityList()"
120
+            style="width: 100px; font-size: 14px; font-weight: 400"
121
+          >
122
+            <Option :value="1">最近一月</Option>
123
+            <Option :value="2">最近一周</Option>
124
+          </Select>
125
+        </div>
126
+        <div class="content_main" id="deviceActivityEcharts"></div>
127
+      </div>
13 128
     </div>
14 129
   </div>
15 130
 </template>
16 131
 
17 132
 <script>
133
+import {
134
+  ra_list_dm,
135
+  ra_list_cc,
136
+  ra_list_sc,
137
+  ra_list_da,
138
+  ra_get_du,
139
+  ra_list_dn,
140
+  ra_list_dut
141
+} from "@/api/ra";
142
+import * as echarts from "echarts";
18 143
 export default {
19 144
   data() {
20
-    return {};
145
+    return {
146
+      // 设备用户信息
147
+      deviceUserInfo: {},
148
+      // 设备类型信息
149
+      deviceModelList: [],
150
+      // 客户端版本-管控应用
151
+      controlVersionList: [],
152
+      // 客户端版本-应用商店
153
+      appVersionList: [],
154
+      // 增长趋势
155
+      growthTrendList: [],
156
+      // 在线设备
157
+      onlineDeviceList: [],
158
+      // 设备活跃度
159
+      deviceActivityInfo: {
160
+        // 1最近一月2最近一周
161
+        doEvent: 2,
162
+        list: []
163
+      }
164
+    };
165
+  },
166
+  created() {
167
+    this.getDeviceUserList();
168
+    this.getDeviceModelList();
169
+    this.getControlVersionList();
170
+    this.getAppVersionList();
171
+    this.getGrowthTrendList();
172
+    this.getOnlineDeviceList();
173
+    this.getDeviceActivityList();
21 174
   },
22
-  methods: {}
175
+  computed: {
176
+    powerParams() {
177
+      return this.$store.getters.powerParams;
178
+    }
179
+  },
180
+  methods: {
181
+    // 设备用户信息
182
+    getDeviceUserList() {
183
+      ra_get_du({
184
+        rtype: this.powerParams.rtype,
185
+        objectid: this.powerParams.objectid
186
+      }).then((data) => {
187
+        if (data.code === 0) {
188
+          this.deviceUserInfo = data.obj;
189
+          this.initDeviceUserEcharts();
190
+        } else {
191
+          this.$Message.error(data.msg);
192
+        }
193
+      });
194
+    },
195
+    initDeviceUserEcharts() {
196
+      let seriesDataList = [];
197
+      seriesDataList = [
198
+        {
199
+          value: this.deviceUserInfo.usernum,
200
+          name: "用户"
201
+        },
202
+        {
203
+          value: this.deviceUserInfo.devicenum,
204
+          name: "设备"
205
+        }
206
+      ];
207
+      const options = {
208
+        tooltip: {
209
+          trigger: "item",
210
+          formatter: (params) => {
211
+            return `${params.name}:${params.value}`;
212
+          }
213
+        },
214
+        legend: {
215
+          right: 16,
216
+          top: "center",
217
+          itemWidth: 10,
218
+          itemHeight: 10,
219
+          //图例距离饼图的距离
220
+          itemGap: 10,
221
+          orient: "vertical",
222
+          data: ["用户", "设备"],
223
+          textStyle: {
224
+            color: "#253A70"
225
+          }
226
+        },
227
+        color: ["#FF8D1A", "#339DFF"],
228
+        series: [
229
+          {
230
+            type: "pie",
231
+            name: "设备用户",
232
+            radius: ["30%", "45%"],
233
+            center: ["45%", "50%"],
234
+            label: {
235
+              formatter: (params) => {
236
+                if (params.name === "用户") {
237
+                  return `{usernumCss|${params.value}} 人`;
238
+                }
239
+                return `{devicenumCss|${params.value}} 台`;
240
+              },
241
+              rich: {
242
+                usernumCss: {
243
+                  color: "#FF8D1A",
244
+                  fontSize: 18
245
+                },
246
+                devicenumCss: {
247
+                  marginRight: 4,
248
+                  color: "#339DFF",
249
+                  fontSize: 18
250
+                }
251
+              },
252
+              borderWidth: 1,
253
+              borderRadius: 4,
254
+              color: "#7C8DB5",
255
+              fontSize: 12,
256
+              lineHeight: 18
257
+            },
258
+            data: seriesDataList
259
+          }
260
+        ]
261
+      };
262
+      const eInstance = echarts.init(
263
+        document.getElementById("deviceUserEcharts")
264
+      );
265
+      eInstance.clear();
266
+      eInstance.setOption(options);
267
+    },
268
+    // 设备类型信息
269
+    getDeviceModelList() {
270
+      ra_list_dm({
271
+        rtype: this.powerParams.rtype,
272
+        objectid: this.powerParams.objectid
273
+      }).then((data) => {
274
+        if (data.code === 0) {
275
+          this.deviceModelList = data.obj;
276
+          this.initDeviceModelEcharts();
277
+        } else {
278
+          this.$Message.error(data.msg);
279
+        }
280
+      });
281
+    },
282
+    initDeviceModelEcharts() {
283
+      let legendNameList = [];
284
+      let seriesDataList = [];
285
+      this.deviceModelList.forEach((item) => {
286
+        legendNameList.push(item.deviceModel);
287
+        seriesDataList.push({
288
+          value: item.devicenum,
289
+          name: item.deviceModel
290
+        });
291
+      });
292
+      const options = {
293
+        tooltip: {
294
+          trigger: "item",
295
+          formatter: (params) => {
296
+            return `${params.name}:${params.value}`;
297
+          }
298
+        },
299
+        legend: {
300
+          bottom: "10",
301
+          left: "center",
302
+          itemWidth: 10,
303
+          itemHeight: 10,
304
+          //图例距离饼图的距离
305
+          itemGap: 10,
306
+          orient: "horizontal",
307
+          data: legendNameList,
308
+          textStyle: {
309
+            color: "#253A70"
310
+          }
311
+        },
312
+        color: ["#52C41A", "#FF811A"],
313
+        series: [
314
+          {
315
+            type: "pie",
316
+            name: "设备类型",
317
+            radius: ["25%", "35%"],
318
+            center: ["50%", "45%"],
319
+            label: {
320
+              formatter: (params) => {
321
+                return `${params.name}\n${params.value}`;
322
+              },
323
+              borderWidth: 1,
324
+              borderRadius: 4,
325
+              color: "#7C8DB5",
326
+              fontSize: 12,
327
+              lineHeight: 18
328
+            },
329
+            data: seriesDataList
330
+          }
331
+        ]
332
+      };
333
+      const eInstance = echarts.init(
334
+        document.getElementById("deviceModelEcharts")
335
+      );
336
+      eInstance.clear();
337
+      eInstance.setOption(options);
338
+    },
339
+    // 客户端版本-管控应用
340
+    getControlVersionList() {
341
+      ra_list_cc({
342
+        rtype: this.powerParams.rtype,
343
+        objectid: this.powerParams.objectid
344
+      }).then((data) => {
345
+        if (data.code === 0) {
346
+          this.controlVersionList = data.obj;
347
+          this.initControlVersionEcharts();
348
+        } else {
349
+          this.$Message.error(data.msg);
350
+        }
351
+      });
352
+    },
353
+    initControlVersionEcharts() {
354
+      let seriesDataList = [];
355
+      this.controlVersionList.forEach((item) => {
356
+        seriesDataList.push({
357
+          value: item.num,
358
+          name: item.cversion
359
+        });
360
+      });
361
+      const options = {
362
+        tooltip: {
363
+          trigger: "item",
364
+          formatter: (params) => {
365
+            return `${params.name}:${params.value}`;
366
+          }
367
+        },
368
+        legend: {
369
+          bottom: "10",
370
+          left: "center",
371
+          itemWidth: 10,
372
+          itemHeight: 10,
373
+          //图例距离饼图的距离
374
+          itemGap: 10,
375
+          orient: "horizontal",
376
+          data: ["管控应用"],
377
+          textStyle: {
378
+            color: "#253A70"
379
+          }
380
+        },
381
+        color: ["#6B30FF", "#FF87C1"],
382
+        series: [
383
+          {
384
+            type: "pie",
385
+            name: "管控应用",
386
+            radius: ["25%", "35%"],
387
+            center: ["50%", "45%"],
388
+            label: {
389
+              formatter: (params) => {
390
+                return `${params.name}\n${params.value}`;
391
+              },
392
+              borderWidth: 1,
393
+              borderRadius: 4,
394
+              color: "#7C8DB5",
395
+              fontSize: 12,
396
+              lineHeight: 18
397
+            },
398
+            data: seriesDataList
399
+          }
400
+        ]
401
+      };
402
+      const eInstance = echarts.init(
403
+        document.getElementById("controlVersionEcharts")
404
+      );
405
+      eInstance.clear();
406
+      eInstance.setOption(options);
407
+    },
408
+    // 客户端版本-应用商店
409
+    getAppVersionList() {
410
+      ra_list_sc({
411
+        rtype: this.powerParams.rtype,
412
+        objectid: this.powerParams.objectid
413
+      }).then((data) => {
414
+        if (data.code === 0) {
415
+          this.appVersionList = data.obj;
416
+          this.initAppEcharts();
417
+        } else {
418
+          this.$Message.error(data.msg);
419
+        }
420
+      });
421
+    },
422
+    initAppEcharts() {
423
+      let seriesDataList = [];
424
+      this.appVersionList.forEach((item) => {
425
+        seriesDataList.push({
426
+          value: item.num,
427
+          name: item.cversion
428
+        });
429
+      });
430
+      const options = {
431
+        tooltip: {
432
+          trigger: "item",
433
+          formatter: (params) => {
434
+            return `${params.name}:${params.value}`;
435
+          }
436
+        },
437
+        legend: {
438
+          bottom: "10",
439
+          left: "center",
440
+          itemWidth: 10,
441
+          itemHeight: 10,
442
+          //图例距离饼图的距离
443
+          itemGap: 10,
444
+          orient: "horizontal",
445
+          data: ["应用商店"],
446
+          textStyle: {
447
+            color: "#253A70"
448
+          }
449
+        },
450
+        color: ["#ED4A99", "#FF87C1"],
451
+        series: [
452
+          {
453
+            type: "pie",
454
+            name: "应用商店",
455
+            radius: ["25%", "35%"],
456
+            center: ["50%", "45%"],
457
+            label: {
458
+              formatter: (params) => {
459
+                return `${params.name}\n${params.value}`;
460
+              },
461
+              borderWidth: 1,
462
+              borderRadius: 4,
463
+              color: "#7C8DB5",
464
+              fontSize: 12,
465
+              lineHeight: 18
466
+            },
467
+            data: seriesDataList
468
+          }
469
+        ]
470
+      };
471
+      const eInstance = echarts.init(
472
+        document.getElementById("appVersionEcharts")
473
+      );
474
+      eInstance.clear();
475
+      eInstance.setOption(options);
476
+    },
477
+    // 增长趋势
478
+    getGrowthTrendList() {
479
+      ra_list_dut({
480
+        rtype: this.powerParams.rtype,
481
+        objectid: this.powerParams.objectid
482
+      }).then((data) => {
483
+        if (data.code === 0) {
484
+          this.growthTrendList = data.obj;
485
+          this.initGrowthTrendEcharts();
486
+        } else {
487
+          this.$Message.error(data.msg);
488
+        }
489
+      });
490
+    },
491
+    initGrowthTrendEcharts() {
492
+      let xAxisDataList = [];
493
+      let seriesDataList = [];
494
+      let seriesDataList1 = [];
495
+      this.growthTrendList.forEach((item) => {
496
+        xAxisDataList.push(item.date);
497
+        seriesDataList.push(item.usernum || 0);
498
+        seriesDataList1.push(item.devicenum || 0);
499
+      });
500
+      let options = {
501
+        color: ["#339DFF", "#FF8622"],
502
+        // tooltip: {
503
+        //   trigger: "item",
504
+        //   formatter: (params) => {
505
+        //     return `${params.name}:${params.value}次`;
506
+        //   }
507
+        // },
508
+        tooltip: {
509
+          trigger: "axis",
510
+          backgroundColor: "#fff", //背景颜色(此时为默认色)
511
+          borderWidth: 1, //边框线宽
512
+          textStyle: {
513
+            lineHeight: 1.6,
514
+            color: "#253A70"
515
+          },
516
+          axisPointer: {
517
+            z: 1, //竖线在圆圈后面
518
+            lineStyle: {
519
+              color: "#f8f8fd",
520
+              width: 20,
521
+              opacity: 0.7
522
+            }
523
+          },
524
+          formatter: (data) => {
525
+            let date = "";
526
+            let seriesDom = "";
527
+            for (const item of data) {
528
+              date = item.name;
529
+              seriesDom += `<div><span style="color: #95ABDF">${
530
+                item.seriesName
531
+              }</span> ${item.value}${
532
+                item.seriesName === "用户数" ? "个" : "台"
533
+              }</div>`;
534
+            }
535
+            return `${date}${seriesDom}`;
536
+          }
537
+        },
538
+        legend: {
539
+          bottom: "10",
540
+          left: "center",
541
+          icon: "rect",
542
+          itemWidth: 10,
543
+          itemHeight: 10,
544
+          //图例距离饼图的距离
545
+          itemGap: 10,
546
+          orient: "horizontal",
547
+          data: ["用户数", "设备数"],
548
+          textStyle: {
549
+            color: "#253A70"
550
+          }
551
+        },
552
+        grid: {
553
+          top: 20,
554
+          left: 50,
555
+          right: 20,
556
+          bottom: 40,
557
+          containLabel: true
558
+        },
559
+        xAxis: [
560
+          {
561
+            type: "category",
562
+            axisLabel: {
563
+              textStyle: {
564
+                color: "#333"
565
+              },
566
+              // 数据多自动隐藏
567
+              // interval: 0,
568
+              rotate: 0
569
+            },
570
+            data: xAxisDataList,
571
+            axisTick: {
572
+              alignWithLabel: true
573
+            }
574
+          }
575
+        ],
576
+        yAxis: [
577
+          {
578
+            minInterval: 1,
579
+            axisLine: {
580
+              show: false
581
+            },
582
+            axisTick: {
583
+              show: false
584
+            },
585
+            splitLine: {
586
+              //网格线
587
+              lineStyle: {
588
+                type: "dotted" //设置网格线类型 dotted:虚线   solid:实线
589
+              },
590
+              show: true //隐藏或显示
591
+            },
592
+            type: "value"
593
+          }
594
+        ],
595
+        series: [
596
+          {
597
+            name: "用户数",
598
+            type: "line",
599
+            label: {
600
+              normal: {
601
+                show: true,
602
+                align: "center",
603
+                verticalAlign: "bottom",
604
+                position: "top",
605
+                distance: 0,
606
+                color: "inherit",
607
+                formatter: `{c}`
608
+              }
609
+            },
610
+            data: seriesDataList
611
+          },
612
+          {
613
+            name: "设备数",
614
+            type: "line",
615
+            label: {
616
+              normal: {
617
+                show: true,
618
+                align: "center",
619
+                verticalAlign: "bottom",
620
+                position: "top",
621
+                distance: 0,
622
+                color: "inherit",
623
+                formatter: `{c}`
624
+              }
625
+            },
626
+            data: seriesDataList1
627
+          }
628
+        ]
629
+      };
630
+      const eInstance = echarts.init(
631
+        document.getElementById("growthTrendEcharts")
632
+      );
633
+      eInstance.clear();
634
+      eInstance.setOption(options);
635
+    },
636
+    getOnlineDeviceList() {
637
+      ra_list_dn({
638
+        rtype: this.powerParams.rtype,
639
+        objectid: this.powerParams.objectid
640
+      }).then((data) => {
641
+        if (data.code === 0) {
642
+          this.onlineDeviceList = data.obj;
643
+          this.initOnlineEcharts({
644
+            domId: "onlineEcharts1",
645
+            onlineNum: this.onlineDeviceList[0].num,
646
+            onlineTatalNum: this.onlineDeviceList[0].tatalnum,
647
+            onlineColor: "#339CFF",
648
+            subtext: "最近1小时"
649
+          });
650
+          this.initOnlineEcharts({
651
+            domId: "onlineEcharts2",
652
+            onlineNum: this.onlineDeviceList[1].num,
653
+            onlineTatalNum: this.onlineDeviceList[1].tatalnum,
654
+            onlineColor: "#52C41A",
655
+            subtext: "最近48小时"
656
+          });
657
+          this.initOnlineEcharts({
658
+            domId: "onlineEcharts3",
659
+            onlineNum: this.onlineDeviceList[2].num,
660
+            onlineTatalNum: this.onlineDeviceList[2].tatalnum,
661
+            onlineColor: "#ED4A99",
662
+            subtext: "最近7天"
663
+          });
664
+        } else {
665
+          this.$Message.error(data.msg);
666
+        }
667
+      });
668
+    },
669
+    initOnlineEcharts({ onlineNum, onlineTatalNum, onlineColor, domId }) {
670
+      let options = {
671
+        tooltip: {
672
+          trigger: "item",
673
+          formatter: "{d}%",
674
+          show: true
675
+        },
676
+        legend: {
677
+          show: false
678
+        },
679
+        series: [
680
+          {
681
+            name: "底盘",
682
+            type: "pie",
683
+            radius: ["40%", "55%"],
684
+            center: ["50%", "45%"],
685
+            avoidLabelOverlap: false,
686
+            hoverAnimation: false,
687
+            label: {
688
+              normal: {
689
+                show: false,
690
+                position: "center"
691
+              },
692
+              emphasis: {
693
+                show: false
694
+              }
695
+            },
696
+            labelLine: {
697
+              normal: {
698
+                show: false
699
+              }
700
+            },
701
+            data: [
702
+              {
703
+                value: onlineNum,
704
+                name: "在线",
705
+                selected: false,
706
+                itemStyle: {
707
+                  color: onlineColor
708
+                }
709
+              },
710
+              {
711
+                value: onlineTatalNum - onlineNum,
712
+                tooltip: {
713
+                  show: false
714
+                },
715
+                name: "离线",
716
+                itemStyle: {
717
+                  color: "#E9EEF4"
718
+                },
719
+                label: {
720
+                  normal: {
721
+                    show: false
722
+                  }
723
+                }
724
+              }
725
+            ]
726
+          }
727
+        ]
728
+      };
729
+      const eInstance = echarts.init(document.getElementById(domId));
730
+      eInstance.clear();
731
+      eInstance.setOption(options);
732
+    },
733
+    // 设备活跃度
734
+    getDeviceActivityList() {
735
+      ra_list_da({
736
+        rtype: this.powerParams.rtype,
737
+        objectid: this.powerParams.objectid,
738
+        doEvent: this.deviceActivityInfo.doEvent
739
+      }).then((data) => {
740
+        if (data.code === 0) {
741
+          this.deviceActivityInfo.list = data.obj;
742
+          this.initDeviceActivityEcharts();
743
+        } else {
744
+          this.$Message.error(data.msg);
745
+        }
746
+      });
747
+    },
748
+    initDeviceActivityEcharts() {
749
+      let xAxisDataList = [];
750
+      let seriesDataList = [];
751
+      this.deviceActivityInfo.list.forEach((item) => {
752
+        xAxisDataList.push(item.date);
753
+        seriesDataList.push(item.num || 0);
754
+      });
755
+      let options = {
756
+        color:
757
+          this.deviceActivityInfo.doEvent === 2 ? ["#52C41A"] : ["#339DFF"],
758
+        tooltip: {
759
+          trigger: "axis",
760
+          backgroundColor: "#fff", //背景颜色(此时为默认色)
761
+          borderWidth: 1, //边框线宽
762
+          textStyle: {
763
+            lineHeight: 1.6,
764
+            color: "#253A70"
765
+          },
766
+          axisPointer: {
767
+            z: 1, //竖线在圆圈后面
768
+            lineStyle: {
769
+              color: "#f8f8fd",
770
+              width: 20,
771
+              opacity: 0.7
772
+            }
773
+          },
774
+          formatter: (data) => {
775
+            let date = "";
776
+            let seriesDom = "";
777
+            for (const item of data) {
778
+              date = item.name;
779
+              seriesDom += `<div><span style="color: #95ABDF">${item.seriesName}</span> ${item.value}次</div>`;
780
+            }
781
+            return `${date}${seriesDom}`;
782
+          }
783
+        },
784
+        legend: {
785
+          show: false
786
+        },
787
+        grid: {
788
+          top: 20,
789
+          left: 50,
790
+          right: 20,
791
+          bottom: 40,
792
+          containLabel: true
793
+        },
794
+        xAxis: [
795
+          {
796
+            type: "category",
797
+            axisLabel: {
798
+              textStyle: {
799
+                color: "#333"
800
+              },
801
+              // 数据多自动隐藏
802
+              // interval: 0,
803
+              rotate: 0
804
+            },
805
+            data: xAxisDataList,
806
+            axisTick: {
807
+              alignWithLabel: true
808
+            }
809
+          }
810
+        ],
811
+        yAxis: [
812
+          {
813
+            minInterval: 1,
814
+            axisLine: {
815
+              show: false
816
+            },
817
+            axisTick: {
818
+              show: false
819
+            },
820
+            splitLine: {
821
+              //网格线
822
+              lineStyle: {
823
+                type: "dotted" //设置网格线类型 dotted:虚线   solid:实线
824
+              },
825
+              show: true //隐藏或显示
826
+            },
827
+            type: "value"
828
+          }
829
+        ],
830
+        series: [
831
+          {
832
+            name: "设备活跃度",
833
+            type: "line",
834
+            smooth: true,
835
+            areaStyle: {
836
+              normal: {
837
+                color: new echarts.graphic.LinearGradient(
838
+                  0,
839
+                  0,
840
+                  0,
841
+                  1,
842
+                  this.deviceActivityInfo.doEvent === 2
843
+                    ? [
844
+                        { offset: 0, color: "rgba(82, 196, 26, 0.4)" },
845
+                        { offset: 0.5, color: "rgba(82, 196, 26, 0.2)" },
846
+                        { offset: 0.9, color: "rgba(82, 196, 26, 0)" }
847
+                      ]
848
+                    : [
849
+                        { offset: 0, color: "rgba(51, 157, 255, 0.4)" },
850
+                        { offset: 0.5, color: "rgba(51, 157, 255, 0.2)" },
851
+                        { offset: 0.9, color: "rgba(51, 157, 255, 0)" }
852
+                      ],
853
+                  false
854
+                ),
855
+                shadowColor: "rgba(0, 0, 0, 0.1)",
856
+                shadowBlur: 10
857
+              }
858
+            },
859
+            label: {
860
+              normal: {
861
+                show: true,
862
+                align: "center",
863
+                verticalAlign: "bottom",
864
+                position: "top",
865
+                distance: 0,
866
+                color: "inherit",
867
+                formatter: `{c}`
868
+              }
869
+            },
870
+            data: seriesDataList
871
+          }
872
+        ]
873
+      };
874
+      const eInstance = echarts.init(
875
+        document.getElementById("deviceActivityEcharts")
876
+      );
877
+      eInstance.clear();
878
+      eInstance.setOption(options);
879
+    }
880
+  }
23 881
 };
24 882
 </script>
25 883
 
@@ -48,6 +906,18 @@ export default {
48 906
       &.right_w {
49 907
         width: calc(60% - 10px);
50 908
       }
909
+      &.device_info {
910
+        display: flex;
911
+        justify-content: space-between;
912
+        .device_info_left {
913
+          width: 33.33%;
914
+          height: 100%;
915
+        }
916
+        .device_info_right {
917
+          width: 66.66%;
918
+          height: 100%;
919
+        }
920
+      }
51 921
       .cell_header {
52 922
         position: relative;
53 923
         display: flex;
@@ -61,6 +931,76 @@ export default {
61 931
       .content_main {
62 932
         width: 100%;
63 933
         height: calc(100% - 48px);
934
+        &.online_devices {
935
+          display: flex;
936
+          justify-content: space-between;
937
+          align-items: center;
938
+          > div {
939
+            position: relative;
940
+            width: 33.33%;
941
+            height: 100%;
942
+            .online_info {
943
+              position: absolute;
944
+              left: 0;
945
+              top: 0;
946
+              font-size: 14px;
947
+              text-align: center;
948
+              &.online_1 {
949
+                color: #339cff;
950
+                &:first-child {
951
+                  padding-top: 140px;
952
+                  font-size: 20px;
953
+                }
954
+                span {
955
+                  color: #339cff;
956
+                }
957
+              }
958
+              &.online_2 {
959
+                color: #52c41a;
960
+                &:first-child {
961
+                  padding-top: 140px;
962
+                  font-size: 20px;
963
+                }
964
+                span {
965
+                  color: #52c41a;
966
+                }
967
+              }
968
+              &.online_3 {
969
+                color: #ed4a99;
970
+                &:first-child {
971
+                  padding-top: 140px;
972
+                  font-size: 20px;
973
+                }
974
+                span {
975
+                  color: #ed4a99;
976
+                }
977
+              }
978
+              .online_title {
979
+                position: absolute;
980
+                bottom: 0;
981
+                left: 0;
982
+                right: 0;
983
+                padding-bottom: 20px;
984
+                font-size: 14px;
985
+                text-align: center;
986
+                color: #798cb5;
987
+                > span {
988
+                  font-weight: bold;
989
+                }
990
+              }
991
+            }
992
+            > div {
993
+              width: 100%;
994
+              height: 100%;
995
+            }
996
+          }
997
+        }
998
+        #controlVersionEcharts,
999
+        #appVersionEcharts {
1000
+          display: inline-block;
1001
+          width: 50%;
1002
+          height: 100%;
1003
+        }
64 1004
       }
65 1005
     }
66 1006
   }

Loading…
Cancel
Save