董国庆
6 天以前 7e8b61eb1d084d53458affcde0b79b506ac41a93
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
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
<template>
  <div class="flex homePage">
    <div class="left">
      <!-- 头部 -->
      <div class="mapTop">
        <!-- 车辆统计 -->
        <div class="carCount">
          <!-- <div class="title">车辆统计</div> -->
          <div class="fir">
            <div class="countCard mid" v-for="(item, index) in carCountData" :key="item.id"
              @click="toCarManage(item.name)">
              <img class="iconImg" :src="imgList[index]" />
              <div>
                <div class="name">{{ item.name || "" }}(辆)</div>
                <div class="num">{{ item.carNum || 0 }}</div>
              </div>
            </div>
          </div>
          <!-- <div class="sec">
          <div class="countCard" v-for="(item, index) in carCountData.slice(3, 7)" @click="toCarManage(item.name)"
            :key="item.id">
            <img class="iconImg" :src="imgList[index + 3]" />
            <div>
              <div class="name">{{ item.name || "" }}(辆)</div>
              <div class="num">{{ item.carNum || 0 }}</div>
            </div>
          </div>
        </div> -->
        </div>
        <!-- 车辆状态 -->
        <!-- <div class="carStatus">
        <div class="title">车辆状态</div>
        <div class="statusFir">
          <div class="statusCard">
            <div class="statusLeft">
 
            </div>
            <el-progress type="circle" :width="20" :show-text="false" stroke-linecap="butt"
              :percentage="carStatusData.onlinePercent" color="rgba(91, 143, 249, 1)"
              define-back-color="rgba(91, 143, 249, 0.25)" class="progressCard"></el-progress>
          </div>
          <div class="statusLine"></div>
          <div class="statusCard">
            <div class="statusLeft">
 
            </div>
            <el-progress type="circle" :width="20" :show-text="false" stroke-linecap="butt"
              :percentage="carStatusData.offlinePercent" color="rgba(93, 112, 146, 1)"
              define-back-color="rgba(93, 112, 146, 0.25)" class="progressCard"></el-progress>
          </div>
        </div>
        <div class="statusSec">
          <div class="statusCard">
 
            <el-progress type="circle" :width="20" :show-text="false" stroke-linecap="butt"
              :percentage="carStatusData.breakdownPercent" color="rgba(253, 83, 118, 1)"
              define-back-color="rgba(253, 83, 118, 0.25)" class="progressCard"></el-progress>
          </div>
          <div class="statusLine"></div>
          <div class="statusCard">
 
            <el-progress type="circle" :width="20" :show-text="false" stroke-linecap="butt"
              :percentage="carStatusData.abnormalPercent" color="rgba(246, 189, 22, 1)"
              define-back-color="rgba(246, 189, 22, 0.25)" class="progressCard"></el-progress>
          </div>
        </div>
      </div> -->
 
      <div class="firCard">
            <div class="companyCard">
              <div class="lineCard"></div>
              <div class="name">运营公司(家)</div>
              <div class="value">{{ carStatusData.enterprise || 0 }}</div>
            </div>
            <div class="companyCard">
              <div class="statusLeft">
                <div class="name">运营车辆(辆)</div>
                <div class="value">{{ carStatusData.car || 0 }}</div>
              </div>
 
 
              <div class="statusLeft">
                <div class="name">在线</div>
                <div class="num">{{ carStatusData.online || 0 }}</div>
              </div>
              <div class="statusLeft">
                <div class="name">离线</div>
                <div class="num">{{ carStatusData.offline || 0 }}</div>
              </div>
 
              <div class="statusLeft">
                <div class="name">故障</div>
                <div class="num">{{ carStatusData.breakdown || 0 }}</div>
              </div>
 
              <div class="statusLeft">
                <div class="name">异常</div>
                <div class="num">{{ carStatusData.abnormal || 0 }}</div>
              </div>
            </div>
            <!-- <div class="companyCard">
          <div class="lineCard"></div>
          <div class="name">驾驶员(人)</div>
          <div class="value">{{ carStatusData.driver || 0 }}</div>
        </div> -->
          </div>
 
 
      </div>
      <div class="leftContent">
        <!-- 左边统计 -->
        <div class="leftData">
          <div class="warnCount">
            <div class="title ">预警类型排行榜</div>
            <div class="countChart" id="countChart"></div>
          </div>
          <!-- 预警排行榜(前10) -->
          <div class="warnRank">
            <div class="title mt-0">公司预警排行榜</div>
            <div class="rankChart" id="rankChart">
              <div class="rankItem" v-for="(item, index) in rankList" :key="index">
                <div class="left">{{ item.name }}</div>
                <div class="rankRight" :class="[0, 1, 2].includes(index) ? 'rankColor' : ''">
                  <div class="rank" :style="{ width: item.percentage + '%' }"></div>
                </div>
              </div>
            </div>
            <div class="noData" v-if="rankList.length == 0">
              <el-empty description="暂无数据" :image-size="80"></el-empty>
            </div>
          </div>
        </div>
        <!-- 左边 地图 -->
        <div class="leftMap">
          <div class="mapContainer" id="mapContainer"></div>
        </div>
        <!-- 右边 内容 -->
        <div class="right">
          
          <!-- 今日预警 -->
          <div class="todayWarn">
            <div class="title">今日预警</div>
            <div class="warnList" v-if="warnList.length > 0">
              <div class="warnItem" v-for="(item, index) in warnList" :key="index" :class="item.warnLevel
                ? ['oneWarn', 'twoWarn', 'threeWarn', 'fourWarn'][
                item.warnLevel - 1
                ]
                : 'fiveWarn'
                ">
                <div class="grade">
                  {{
                    item.warnLevel
                      ? ["一级", "二级", "三级", "四级"][item.warnLevel - 1]
                      : "-"
                  }}
                </div>
                <div class="info">
                  {{ item.vehicleNumber }} {{ item.warnType }} {{ item.keepTime }}
                  {{ item.startTime }}
                </div>
              </div>
            </div>
            <div class="noData" v-else>
              <el-empty description="暂无数据" :image-size="80"></el-empty>
            </div>
          </div>
          <!-- 预警情况统计 -->
          <div class="warnCount">
            <div class="title ">预警情况统计</div>
            <el-table v-if="tableData.length" :data="tableData" border stripe style="width: 100%" :height="300">
              <el-table-column prop="operate_type" label="车辆类型">
                <template #default="{ row }">
                  <span class="operate_type" @click="toWarningList(row.operate_type)">{{ row.operate_type }}</span>
                </template>
              </el-table-column>
              <el-table-column prop="total" label="预警总数"></el-table-column>
              <el-table-column prop="processed" label="已处理数"></el-table-column>
              <el-table-column prop="unprocessed" label="未处理数"></el-table-column>
              <el-table-column prop="rate" label="处置率"></el-table-column>
            </el-table>
            <div class="noData" v-else>
              <el-empty description="暂无数据" :image-size="80"></el-empty>
            </div>
          </div>
 
        </div>
      </div>
 
 
    </div>
 
 
  </div>
</template>
 
<script>
import * as echarts from "echarts";
import html2canvas from "html2canvas";
import AMapLoader from "@amap/amap-jsapi-loader";
import flvjs from "flv.js";
import moment from 'moment'
import {
  getCarCount,
  getCarStatusCount,
  getMapCarList,
  getCarWarnList,
  getWarnGroupCount,
  getWarnGroupCountTop10,
  getRealVideo,
  playDetection,
  closeRealVideo,
  getAllWarnGroupVehicleType
} from "./service";
export default {
  data() {
    return {
      flvPlayer: null,
      videoTimer: null,
      activeIndex: "1",
      activeIndex2: "1",
      timer: null,
      markers: [],
      map: null,
      AMap: null,
      infoWindow: null,
      imgList: [
        require("../../assets//homeImg/img3.png"),
        require("../../assets//homeImg/img6.png"),
        require("../../assets//homeImg/img7.png"),
        require("../../assets//homeImg/img5.png"),
        require("../../assets//homeImg/img1.png"),
        require("../../assets//homeImg/img4.png"),
        require("../../assets//homeImg/img2.png"),
      ],
      countList: [], //预警情况统计数据
      rankList: [], //预警排行榜数据
      carList: [], //车辆列表数据
      carCountData: [], //车辆统计数据
      carStatusData: {}, //车辆状态数据
      warnList: [], //预警列表数据
 
      serverIp: "", //监控ip
      serverPort: "", //监控端口
      carId: "", //监控车辆
      urlLink: '',//视频地址
      tableData: [], //预警情况统计数据
    };
  },
  watch: {
    map(val) {
      if (val) {
        HTMLCanvasElement.prototype.getContext = (function (origFn) {
          return function (type, attributes) {
            if (type.indexOf("webgl") > -1) {
              attributes = Object.assign({}, attributes, {
                preserveDrawingBuffer: true,
              });
            }
            return origFn.call(this, type, attributes);
          };
        })(HTMLCanvasElement.prototype.getContext);
      }
    },
  },
  filters: {},
 
  created() {
    window.toCarDetail = (record) => {
      this.toCarDetail(record);
    };
    window.fullScreen = () => {
      this.fullScreen();
    };
    window.shotScreen = () => {
      this.shotScreen();
    };
  },
  mounted() {
    // 调用所有接口
    this.getCarCountData();
    this.getCarStatusData();
    // this.getMapCarData(); // 移除这里的调用,因为 initMap 中会调用
    this.getWarnListData();
    this.getWarnGroupData();
    this.getWarnTop10Data();
    this.getVehicleType();
 
    this.initMap();
    if (this.timer) {
      clearInterval(this.timer);
    }
    // 设置定时器,每分钟刷新一次数据
    this.timer = setInterval(() => {
      this.getCarCountData();
      this.getCarStatusData();
      this.getMapCarData(); // 保留定时器中的调用
      this.getWarnListData();
      this.getWarnGroupData();
      this.getWarnTop10Data();
      this.getVehicleType();
    }, 60000);
  },
  beforeDestroy() {
    if (this.timer) {
      clearInterval(this.timer);
    }
    this.destroyPlayer();
    if (this.markers && this.markers.length > 0) {
      this.markers.forEach((marker) => {
        marker.setMap(null);
      });
      this.markers = [];
    }
    if (this.infoWindow) {
      this.infoWindow.close();
    }
    if (this.flvPlayer) {
      this.flvPlayer.destroy();
      this.flvPlayer = null;
    }
  },
  beforeRouteLeave(to, from, next) {
    if (this.infoWindow) {
      this.infoWindow.close();
    }
    if (this.flvPlayer) {
      this.flvPlayer.destroy();
      this.flvPlayer = null;
    }
    next();
  },
  methods: {
    toWarningList(name) {
      this.$router.push({
        path: "/early-warning",
        query: { name },
      });
    },
    getVehicleType() {
      getAllWarnGroupVehicleType().then(res => {
        this.tableData = res;
      })
    },
    toCarManage(id) {
      this.$router.push({
        path: "/car-manage",
        query: { id },
      });
    },
    // 获取车辆统计数据
    async getCarCountData() {
      try {
        const res = await getCarCount();
        // let list=['客运','危货运输','普货运输','公交车','出租车','交邮','网约车']
        this.carCountData = res;
      } catch (error) {
        this.$message.error("获取车辆统计数据失败");
      }
    },
    // 获取车辆状态数据
    async getCarStatusData() {
      try {
        const res = await getCarStatusCount();
        // 设置默认值为0,防止空值
        const online = Number(res.online) || 0;
        const offline = Number(res.offline) || 0;
        const breakdown = Number(res.breakdown) || 0;
        const abnormal = Number(res.abnormal) || 0;
        const enterprise = Number(res.enterprise) || 0;
        const car = Number(res.car) || 0;
        const driver = Number(res.driver) || 0;
 
        // 计算总数
        const total = online + offline + breakdown + abnormal;
 
        // 计算百分比,如果总数为0则百分比为0
        const onlinePercent =
          total > 0 ? Math.round((online / total) * 100) : 0;
        const offlinePercent =
          total > 0 ? Math.round((offline / total) * 100) : 0;
        const breakdownPercent =
          total > 0 ? Math.round((breakdown / total) * 100) : 0;
        const abnormalPercent =
          total > 0 ? Math.round((abnormal / total) * 100) : 0;
        // 更新数据
        this.carStatusData = {
          online,
          offline,
          breakdown,
          abnormal,
          enterprise,
          car,
          driver,
          total,
          onlinePercent,
          offlinePercent,
          breakdownPercent,
          abnormalPercent,
        };
      } catch (error) {
        this.$message.error("获取车辆状态数据失败");
        // 设置默认值
        this.carStatusData = {
          online: 0,
          offline: 0,
          breakdown: 0,
          abnormal: 0,
          enterprise: 0,
          car: 0,
          driver: 0,
          total: 0,
          onlinePercent: 0,
          offlinePercent: 0,
          breakdownPercent: 0,
          abnormalPercent: 0,
        };
      }
    },
    // 获取地图车辆数据
    async getMapCarData() {
      try {
        const res = await getMapCarList();
        this.carList = res;
        // 确保地图已初始化后再更新标记
        if (this.AMap && this.map) {
          this.updateMarkers(res);
        }
      } catch (error) {
        this.$message.error("获取地图车辆数据失败");
      }
    },
    // 获取预警列表数据
    async getWarnListData() {
      try {
        const res = await getCarWarnList({ pageNum: 1, pageSize: 100000, startTime: moment().format('YYYY-MM-DD 00:00:00'), endTime: moment().format('YYYY-MM-DD 23:59:59') });
        this.warnList = res.page.records;
      } catch (error) {
        this.$message.error("获取预警列表数据失败");
      }
    },
    // 获取预警统计情况数据
    async getWarnGroupData() {
      try {
        const res = await getWarnGroupCount();
        this.countList = res;
        this.getCountList();
      } catch (error) {
        this.$message.error("获取预警统计情况数据失败");
      }
    },
    // 获取预警排行数据
    async getWarnTop10Data() {
      try {
        const res = await getWarnGroupCountTop10();
        // 判断返回的数组是否为空
        if (!res || res.length === 0) {
          this.rankList = [];
          return;
        }
        // 计算所有num的总和
        const total = res.reduce((sum, item) => sum + (item.num || 0), 0);
        // 为每个数据项添加百分比属性
        this.rankList = res.map((item) => ({
          ...item,
          percentage:
            total > 0 ? (((item.num || 0) / total) * 100).toFixed(2) : 0,
        }));
      } catch (error) {
        this.$message.error("获取预警排行数据失败");
        this.rankList = [];
      }
    },
    // 初始化地图
    initMap() {
      window._AMapSecurityConfig = {
        securityJsCode: this.$secretKey,
      };
      AMapLoader.load({
        key: this.$mapKey,
        version: "2.0",
        plugins: [
          "AMap.ToolBar",
          "AMap.AutoComplete",
          "AMap.Geocoder",
          "AMap.MarkerCluster",
          "AMap.Geocoder",
        ],
      })
        .then((AMap) => {
          this.AMap = AMap;
          this.map = new AMap.Map("mapContainer", {
            center: [105.574542, 30.5061493],
            zoom: 8,
          });
          this.infoWindow = new AMap.InfoWindow({
            offset: new AMap.Pixel(30, 30),
            autoMove: true,
            anchor: "top-center",
          });
          // 添加信息弹窗关闭事件监听
          this.infoWindow.on("close", () => {
            console.log("关闭信息弹窗1111111111111111111");
            this.destroyPlayer();
          });
          this.getMapCarData();
        })
        .catch((e) => {
          this.$message.error("地图加载失败");
        });
    },
    // 更新地图标记
    updateMarkers(arr) {
      if (!this.AMap) {
        return;
      }
      if (this.markers && this.markers.length > 0) {
        this.markers.forEach((marker) => {
          marker.setMap(null);
        });
        this.markers = [];
      }
 
      if (arr.length > 0) {
        const iconMap = {
          出租车: {
            icon: require("../../assets/homeImg/taxi.png"),
            size: new this.AMap.Size(75, 37),
          },
          公交车: {
            icon: require("../../assets/homeImg/bus.png"),
            size: new this.AMap.Size(62, 34),
          },
          危险品: {
            icon: require("../../assets/homeImg/risk.png"),
            size: new this.AMap.Size(69, 32),
          },
          郊游: {
            icon: require("../../assets/homeImg/outing.png"),
            size: new this.AMap.Size(61, 31),
          },
          货运: {
            icon: require("../../assets/homeImg/expressage.png"),
            size: new this.AMap.Size(60, 31),
          },
          网约车: {
            icon: require("../../assets/homeImg/online.png"),
            size: new this.AMap.Size(75, 33),
          },
          客运: {
            icon: require("../../assets/homeImg/passenger.png"),
            size: new this.AMap.Size(69, 31),
          },
        };
 
        arr.forEach((item, index) => {
          // 检查必要字段
          if (!item.operateType || !item.longitude || !item.latitude) {
            return;
          }
 
          const iconConfig = iconMap[item.operateType];
          if (!iconConfig) {
            return;
          }
 
          let marker = new this.AMap.Marker({
            position: [Number(item.longitude), Number(item.latitude)],
            map: this.map,
            icon: new this.AMap.Icon({
              size: iconConfig.size,
              image: iconConfig.icon,
              imageSize: iconConfig.size,
              imageOffset: new this.AMap.Pixel(0, 0),
            }),
          });
 
          // 添加点击事件
          marker.on("click", async (e) => {
            // 如果已经有视频在播放,先销毁
            if (this.flvPlayer) {
              this.flvPlayer.destroy();
              this.flvPlayer = null;
            }
 
            // 显示loading
            this.infoWindow.setContent(
              '<div style="padding: 20px;text-align: center;">加载中...</div>'
            );
            this.infoWindow.open(this.map, e.target.getPosition());
 
            try {
              // 使用高德地图API获取地址信息
              const geocoder = new this.AMap.Geocoder();
              const location = [Number(item.longitude), Number(item.latitude)];
 
              const [addressResult, videoRes] = await Promise.all([
                new Promise((resolve) => {
                  geocoder.getAddress(location, (status, result) => {
                    if (status === "complete" && result.regeocode) {
                      resolve(result.regeocode.formattedAddress);
                    } else {
                      resolve("未知地址");
                    }
                  });
                }),
                this.getVideoUrl(item.id),
              ]);
 
              // 更新弹窗内容
              this.infoWindow.setContent(
                this.listRender({
                  ...item,
                  drivingTime: this.formatterTime(item.drivingTime || 0),
                  location: addressResult,
                })
              );
 
              this.initVideoPlayer();
            } catch (error) {
              this.infoWindow.setContent(
                '<div style="padding: 20px;text-align: center;color: red;">获取车辆信息失败</div>'
              );
            }
          });
 
          // 将marker添加到数组中
          this.markers.push(marker);
        });
      }
    },
    // 获取视频地址
    async getVideoUrl(carId) {
      this.carId = carId;
      try {
        const res = await getRealVideo({ id: carId });
        // 将RTSP流转换为FLV流
        this.serverIp = res.serverIp;
        this.serverPort = res.serverPort;
        this.urlLink = res.url;
      } catch (error) {
        console.error("获取视频地址失败", error);
        return {};
      }
    },
 
    // 初始化视频播放器
    initVideoPlayer() {
      console.log('11111', this.serverIp, '2222222222', this.serverPort)
      // 先销毁之前的播放器
      if (this.flvPlayer) {
        this.flvPlayer.destroy();
        this.flvPlayer = null;
      }
 
      // 获取video元素
      const video = document.getElementById("monitoringCard");
      if (!video) {
        console.error("Video element not found");
        return;
      }
 
      // 检查flv.js是否支持
      if (flvjs.isSupported()) {
        try {
          playDetection(this.carId).then((res) => {
            this.flvPlayer = flvjs.createPlayer({
              type: "flv", //视频类型
              isLive: true, //是否为直播
              cors: true, //是否开启跨域
              hasAudio: false, //是否开启音频
              hasVideo: true, //是否开启视频
              // url: `http://${this.serverIp}:${this.serverPort}/live?port=1935&app=flv&stream=${this.carId}`, // 后端拿到的视频路径
              url: this.urlLink, // 后端拿到的视频路径
              enableWorker: true, //启用 Web Worker 进程来加速视频的解码和处理过程
              enableStashBuffer: false, // 启用数据缓存机制,提高视频的流畅度和稳定性。
              stashInitialSize: 1024, // 初始缓存大小。单位:字节。建议针对直播:调整为1024kb
              stashInitialTime: 0.2, // 缓存初始时间。单位:秒。建议针对直播:调整为200毫秒
              seekType: "range", // 建议将其设置为"range"模式,以便更快地加载视频数据,提高视频的实时性。
              lazyLoad: false, //关闭懒加载模式,从而提高视频的实时性。建议针对直播:调整为false
              lazyLoadMaxDuration: 0.2, // 懒加载的最大时长。单位:秒。建议针对直播:调整为200毫秒
              deferLoadAfterSourceOpen: false, // 不预先加载视频数据,在 MSE(Media Source Extensions)打开后立即加载数据,提高视频的实时性。建议针对直播:调整为false
            });
            let video = document.getElementById("monitoringCard");
            this.flvPlayer.attachMediaElement(video); // video容器
            this.flvPlayer.load();
            this.flvPlayer
              .play()
              .then((res) => {
                // 显示视频元素
                video.style.display = 'block';
                // 隐藏空状态
                const emptyElement = video.parentElement.querySelector('.el-empty');
                if (emptyElement) {
                  emptyElement.style.display = 'none';
                }
 
                this.videoTimer = setInterval(() => {
                  playDetection(this.carId);
                }, 5000);
              })
              .catch((err) => {
                this.destroyPlayer();
              });
            // 错误监听
            this.flvPlayer.on("error", (err) => {
              this.destroyPlayer();
            });
          });
        } catch (error) {
          console.error("创建播放器失败:", error);
        }
      } else {
        console.error("当前浏览器不支持flv.js");
      }
    },
 
    destroyPlayer() {
      this.urlLink = ""
      // 销毁播放器释放资源
      if (this.flvPlayer) {
        if (this.videoTimer) clearInterval(this.videoTimer);
        closeRealVideo(this.carId).then((res) => {
          this.flvPlayer.pause();
          this.flvPlayer.unload();
          this.flvPlayer.detachMediaElement();
          this.flvPlayer.destroy();
          this.flvPlayer = null;
 
          // 恢复空状态的显示
          const video = document.getElementById("monitoringCard");
          if (video) {
            video.style.display = 'none';
            const emptyElement = video.parentElement.querySelector('.el-empty');
            if (emptyElement) {
              emptyElement.style.display = 'block';
            }
          }
        });
      }
    },
 
    // 处理视频错误
    handleVideoError(event) {
      console.error("视频加载失败", event);
      if (this.flvPlayer) {
        this.flvPlayer.destroy();
        this.flvPlayer = null;
      }
      this.infoWindow.setContent(
        '<div style="padding: 20px;text-align: center;color: red;">视频加载失败,请稍后重试</div>'
      );
    },
 
    listRender(record) {
      return `<div style="background: #ffffff; padding: 24px 20px;z-index: 999">
        <div style="position: relative; width: 460px; height: 330px">
          <div style="width: 460px; height: 330px; border-radius: 9px; background: #f5f5f5; display: flex; justify-content: center; align-items: center; flex-direction: column">
            <video
              ref="video"
              style="width: 460px; height: 330px; border-radius: 9px; display: none" 
              id="monitoringCard"
              ref="monitoringCard"
              :controls="false"
              autoPlay
              width="620">
            </video>
            <el-empty description="暂无视频信息" :image-size="80"></el-empty>
          </div>
          <canvas id="myCanvas" style="display:none"></canvas>
          <div style="position: absolute; right: 11px; top: 10px">
            <div style="display: flex;flex-direction: column;align-items: center;justify-content: center;
              background: #ffffff; padding: 3px 10px; border-radius: 6px;margin-bottom: 10px;" onclick="fullScreen()">
              <img style="width: 20px; height: 20px" src="${require("../../assets//homeImg/full.png")}" />
              <div style="font-size: 12px;font-weight: 400; line-height: 17px; color: rgba(0, 0, 0, 0.88);">全屏</div>
            </div>
            <div style="display: flex;flex-direction: column;align-items: center; justify-content: center;
              background: #ffffff;padding: 3px 10px;border-radius: 6px;" onclick="shotScreen()">
              <img style="width: 20px; height: 20px" src="${require("../../assets//homeImg/slot.png")}" />
              <div style="font-size: 12px; font-weight: 400; line-height: 17px; color: rgba(0, 0, 0, 0.88);">截屏</div>
            </div>
          </div>
        </div>
        <div style="display: flex;justify-content: space-between;margin-top: 15px;margin-bottom: 12px;">
          <div style="font-weight: 500;font-size: 18px;color: rgba(0, 0, 0, 0.85);line-height: 25px;">车牌号:${record.vehicleNumber || ""
        }</div>
          <div style="font-weight: 500; font-size: 18px;color: rgba(0, 0, 0, 0.85);line-height: 25px;">驾驶员:${record.driverName || ""
        }</div>
        </div>
        <div style="display: flex; justify-content: space-between">
          <div style="font-weight: 500; font-size: 14px; color: rgba(0, 0, 0, 0.65);line-height: 26px;width: 200px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="${record.location
        }">位置:${record.location}</div>
          <div style="font-weight: 500;font-size: 14px; color: rgba(0, 0, 0, 0.65);line-height: 26px;">经纬度:${record.longitude + "," + record.latitude
        }</div>
        </div>
        <div style="display: flex; justify-content: space-between">
          <div style="font-weight: 500;font-size: 14px; color: rgba(0, 0, 0, 0.65);line-height: 26px;">当前时速:${record.speed || ""
        }${record.speed && "km/h"}</div>
          <div style="font-weight: 500;font-size: 14px; color: rgba(0, 0, 0, 0.65);line-height: 26px;">驾驶时长:${record.drivingTime
        }</div>
        </div>
        <div style="margin-top: 14px;display: flex;justify-content: flex-end;align-items: center;cursor: pointer;" onclick="toCarDetail(${record.id
        })">
          <div style="font-weight: 400;font-size: 18px; color: rgba(22, 119, 255, 1);line-height: 25px;">车辆详情</div>
          <img style="width:18px;height: 18px;margin-left: 8px;" src="${require("../../assets//homeImg/right.png")}" />
        </div>
      </div>`;
    },
    formatterTime(value) {
      if (!value) return "";
      const hours = Math.floor(value / 60);
      const minutes = value % 60;
      if (hours > 0) {
        return `${hours}小时${minutes}分钟`;
      } else {
        return `${minutes}分钟`;
      }
    },
    // 获取预警情况统计
    getCountList() {
      echarts.dispose(document.getElementById("countChart"));
      if (this.countList.length > 0) {
        this.chartTnit();
      }
    },
    chartTnit() {
      // 基于准备好的dom,初始化echarts实例
      const myChart = echarts.init(document.getElementById("countChart"));
      // 绘制数量图表
      myChart.setOption({
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "shadow",
          },
        },
        grid: {
          width: "auto",
          height: "auto",
          top: "5%",
          left: "3%",
          right: "4%",
          bottom: "0%",
          containLabel: true,
        },
        xAxis: [
          {
            type: "category",
            data: this.countList.map((item) => item.warnType),
            axisTick: {
              alignWithLabel: true,
              lineStyle: {
                color: "#777777",
              },
            },
            axisLabel: {
              color: "rgba(0, 0, 0, 0.45)",
              interval: 0, // 强制显示所有标签
              width: 60, // 设置标签宽度
              height: 20, // 设置标签高度
              overflow: 'truncate', // 截断模式
              ellipsis: true, // 超出显示省略号
              rotate: -40, // 可以根据需要调整角度
              formatter: function (value) {
                if (value.length > 4) {
                  return value.substring(0, 4) + '...';
                }
                return value;
              }
            },
          },
        ],
        yAxis: [
          {
            type: "value",
          },
        ],
        series: [
          {
            type: "bar",
            barWidth: "20px",
            itemStyle: {
              borderRadius: [20, 20, 20, 20],
              color: (params) => {
                return [
                  "#5B8FF9",
                  "#5AD8A6",
                  "#F6BD16",
                  "#6DC8EC",
                  "#945FB9",
                  "rgba(248, 204, 65, 0.5)",
                  "rgba(2, 179, 118, 0.5)",
                  "rgba(254, 41, 94, 0.5)",
                  "rgba(255, 102, 39, 0.5)",
                  "rgba(169, 14, 253, 0.5)",
                  "rgba(109, 200, 236, 0.5)",
                ][params.dataIndex];
              },
            },
            data: this.countList.map((item) => item.num),
          },
        ],
      });
      myChart.resize();
    },
 
    // 跳转车辆详情
    toCarDetail(id) {
      this.$router.push({
        path: "/car-detail",
        query: {
          id: id,
        },
      });
    },
    fullScreen() {
      const video = document.getElementById("monitoringCard");
      if (video.requestFullscreen) {
        video.requestFullscreen();
      } else if (video.mozRequestFullScreen) {
        // Firefox
        video.mozRequestFullScreen();
      } else if (video.webkitRequestFullscreen) {
        // Chrome, Safari and Opera
        video.webkitRequestFullscreen();
      } else if (video.msRequestFullscreen) {
        // IE/Edge
        video.msRequestFullscreen();
      }
    },
    getRandomColor() {
      const letters = "0123456789ABCDEF";
      let color = "#";
      for (let i = 0; i < 6; i++) {
        color += letters[Math.floor(Math.random() * 16)];
      }
      return color;
    },
    shotScreen() {
      // 获取video和canvas元素
      const video = document.getElementById("monitoringCard");
      const canvas = document.getElementById("myCanvas");
      // 设置canvas的宽度和高度与video相同
      canvas.width = video.videoWidth;
      canvas.height = video.videoHeight;
      // 获取canvas的2d绘图上下文
      const context = canvas.getContext("2d");
      // 将当前video帧绘制到canvas上
      context.drawImage(video, 0, 0, canvas.width, canvas.height);
 
      setTimeout(() => {
        // 将canvas内容转换为图片
        let dataURL = canvas.toDataURL("image/png");
        this.downloadImage(dataURL);
      }, 100);
    },
    downloadImage(base64) {
      const link = document.createElement("a");
      link.href = base64;
      link.download = "screenshot.png"; // 你希望下载的文件名
      document.body.appendChild(link);
      link.click();
      document.body.removeChild(link);
    },
  },
};
</script>
 
<style scoped lang="less">
.homePage {
  display: flex;
  height: 100%;
  position: relative;
  background: #f4f4ff;
 
  .left {
    flex: 1;
 
    .leftContent {
      display: flex;
      height: calc(100% - 138px);
      padding-top: 20px;
      .title {
      margin-top: 10px;
      font-weight: 600;
      font-size: 18px;
      color: rgba(0, 0, 0, 0.88);
      line-height: 25px;
      text-transform: none;
      margin-bottom: 10px;
    }
 
 
      .leftData {
        display: flex;
        flex-direction: column;
        width: 493px;
        height: 100%;
        padding-right: 20px;
 
      }
 
      .warnCount {
        // position: relative;
        flex: 1;
        padding: 10px;
        box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.2);
        border-radius: 10px 10px 0px 0px;
        background: #f4f4ff;
        // margin-bottom: 10px;
 
        #countChart {
          width: 100%;
          height: 88%;
        }
 
        .noData {
          display: flex;
          flex-direction: column;
          align-content: center;
          justify-content: center;
          // position: absolute;
          // bottom: 0;
          // left: 0;
          width: 100%;
          height: 180px;
        }
      }
 
      .warnRank {
        flex: 1;
        position: relative;
        box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.2);
        border-radius: 10px 10px 0px 0px;
        background: #f4f4ff;
        padding: 10px;
        margin-top: 10px;
 
        .rankChart {
          padding: 5px;
          width: 100%;
          height: 90%;
          margin-top: 10px;
          padding-top: 10px;
          background: #fff;
          // height: 300px;
 
          .rankItem {
            display: flex;
            align-content: center;
            margin-bottom: 24px;
 
            .left {
              flex: 2;
              padding-right: 25px;
              font-weight: 400;
              font-size: 13px;
              color: rgba(0, 0, 0, 0.45);
              line-height: 17px;
              text-align: right;
              overflow: hidden;
              white-space: nowrap;
              text-overflow: ellipsis;
            }
 
            .rankRight {
              flex: 5;
              height: 15px;
              background: rgba(93, 112, 146, 0.2);
              border-radius: 8px;
 
              .rank {
                height: 15px;
                border-radius: 8px;
                background: rgba(93, 112, 146, 0.6);
              }
            }
 
            .rankColor {
              background: rgba(91, 143, 249, 0.2);
 
              .rank {
                background: rgba(91, 143, 249, 0.85);
              }
            }
          }
 
          .rankItem:last-child {
            margin-bottom: 0 !important;
          }
        }
 
        .noData {
          display: flex;
          flex-direction: column;
          align-content: center;
          justify-content: center;
          position: absolute;
          bottom: 0;
          left: 0;
          width: 100%;
          height: 300px;
        }
      }
    }
  }
 
  .leftMap {
    // width: 100%;
    height: 100%;
    flex: 3;
    display: flex;
    position: relative;
 
    #mapContainer {
      flex: 1;
      width: 100%;
      height: 100%;
    }
  }
 
  .mapTop {
    z-index: 99;
    // position: absolute;
    // top: 20px;
    // left: 20px;
    // right: 513px;
    display: flex;
    justify-content: space-between;
    width: calc(100%);
 
    .title {
      font-weight: 600;
      font-size: 18px;
      color: #000000;
      line-height: 25px;
      text-transform: none;
      text-align: center;
    }
 
    .carCount {
      flex: 8;
      background: #f4f4ff;
      box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.2);
      border-radius: 10px;
      padding: 14px 20px 20px 20px;
      margin-right: 20px;
 
      .fir {
        display: flex;
        justify-content: space-between;
        margin-bottom: 10px;
        margin-top: 11px;
 
        .countCard {
          background: #ffffff;
          margin-right: 20px;
          padding: 14px 14px 18px 24px;
        }
 
        .countCard:last-child {
          margin-right: none;
        }
      }
 
      .sec {
        display: flex;
        justify-content: space-between;
 
        .countCard {
          background: #ffffff;
          margin-right: 15px;
        }
 
        .countCard:last-child {
          margin-right: none;
        }
      }
 
      .countCard {
        flex: 1;
        background: linear-gradient(180deg,
            rgba(246, 246, 252, 0) 0%,
            #f3f4f8 100%);
        box-shadow: inset 0px -1px 4px 0px #ffffff;
        border-radius: 10px;
        border: 1px solid #f1f1f1;
        padding: 14px 20px 18px 14px;
        display: flex;
        // justify-content: space-between;
 
        .iconImg {
          width: 30px;
          height: 30px;
          border-radius: 10px;
          margin-right: 25px;
        }
 
        .iconImg:nth-child(1) {
          box-shadow: 0px 7px 14px 0px rgba(14, 110, 253, 0.4);
        }
 
        .iconImg:nth-child(2) {
          box-shadow: 0px 7px 14px 0px rgba(255, 102, 39, 0.5);
        }
 
        .iconImg:nth-child(3) {
          box-shadow: 0px 7px 14px 0px rgba(254, 41, 94, 0.5);
        }
 
        .iconImg:nth-child(4) {
          box-shadow: 0px 7px 14px 0px rgba(248, 204, 65, 0.5);
        }
 
        .iconImg:nth-child(5) {
          box-shadow: 0px 7px 14px 0px rgba(2, 179, 118, 0.5);
        }
 
        .iconImg:nth-child(6) {
          box-shadow: 0px 7px 14px 0px rgba(169, 14, 253, 0.4);
        }
 
        .iconImg:nth-child(7) {
          box-shadow: 0px 7px 14px 0px rgba(109, 200, 236, 0.5);
        }
 
        .name {
          font-weight: 500;
          font-size: 12px;
          color: rgba(0, 0, 0, 0.6);
          line-height: 17px;
          margin-top: 2px;
        }
 
        .num {
          font-weight: 900;
          font-size: 16px;
          color: rgba(0, 0, 0, 0.8);
          line-height: 19px;
          text-align: left;
          margin-top: 1px;
        }
      }
    }
 
    .carStatus {
      flex: 5;
      background: #f4f4ff;
      box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.2);
      border-radius: 10px;
      padding: 14px 84px 20px 84px;
 
      .statusFir {
        margin-top: 23px;
        margin-bottom: 28px;
        display: flex;
        justify-content: space-between;
        align-content: center;
      }
 
      .statusSec {
        display: flex;
        justify-content: space-between;
        align-content: center;
      }
 
      .statusCard {
        display: flex;
        align-content: center;
 
        .statusLeft {
          margin-right: 9px;
          display: flex;
          flex-direction: column;
          justify-content: center;
 
          .name {
            font-weight: 500;
            font-size: 12px;
            color: rgba(0, 0, 0, 0.6);
            line-height: 17px;
          }
 
          .num {
            font-weight: 900;
            font-size: 16px;
            color: rgba(0, 0, 0, 0.8);
            line-height: 19px;
          }
        }
 
        .progressCard {
          width: 56px;
          height: 56px;
 
          ::v-deep .el-progress-circle {
            width: 56px !important;
            height: 56px !important;
          }
        }
      }
 
      .statusLine {
        width: 1px;
        height: 46px;
        border: 1px solid #dedede;
        box-sizing: border-box;
      }
    }
 
    .firCard {
      display: flex;
      justify-content: space-between;
      box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.2);
      border-radius: 10px 10px 0px 0px;
      background: #f4f4ff;
      // margin-bottom: 10px;
      padding: 10px;
      width: 473px;
      padding-left: 20px;
 
      .companyCard {
        width: 100px;
        // height: 90px;
        background: #fff;
        border-radius: 0px 10px 10px 0px;
        position: relative;
 
 
        .lineCard {
          position: absolute;
          left: 0;
          top: 0;
          width: 4px;
          // height: 90px;
          background: #0e6efd;
          border-radius: 2px;
        }
 
        .name {
          margin: 18px 10px 12px 10px;
          text-align: left;
          font-size: 12px;
          color: rgba(0, 0, 0, 0.6);
          line-height: 17px;
        }
 
        .value {
          padding-left: 10px;
          margin-bottom: 22px;
          text-align: left;
          font-weight: 900;
          font-size: 18px;
          color: #0e6efd;
          line-height: 21px;
        }
      }
 
      .companyCard:nth-child(2) {
        flex: 1;
        margin-left: 10px;
        display: flex;
        justify-content: space-between;
        padding-right: 10px;
 
        .statusLeft {
          text-align: left;
 
          .num {
            padding-left: 10px;
            // padding-right: 10px;
          }
        }
 
      }
    }
  }
 
  .right {
    // position: absolute;
    // right: 0;
    // top: 0;
    width: 493px;
    // flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    // margin: 20px 17px 0 20px;
    background: transparent;
    // box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.2);
    // border-radius: 10px 10px 0px 0px;
    padding: 0 0 0 20px;
    // overflow-y: auto;
 
    .title {
      margin-top: 10px;
      font-weight: 600;
      font-size: 18px;
      color: rgba(0, 0, 0, 0.88);
      line-height: 25px;
      text-transform: none;
      margin-bottom: 10px;
    }
 
    .mt-0 {
      margin-top: 0 !important;
    }
 
    .firCard {
      display: flex;
      justify-content: space-between;
      box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.2);
      border-radius: 10px 10px 0px 0px;
      background: #f4f4ff;
      margin-bottom: 10px;
      padding: 10px;
 
      .companyCard {
        width: 100px;
        // height: 90px;
        background: #fff;
        border-radius: 0px 10px 10px 0px;
        position: relative;
 
 
        .lineCard {
          position: absolute;
          left: 0;
          top: 0;
          width: 4px;
          // height: 90px;
          background: #0e6efd;
          border-radius: 2px;
        }
 
        .name {
          margin: 18px 10px 12px 10px;
          text-align: left;
          font-size: 12px;
          color: rgba(0, 0, 0, 0.6);
          line-height: 17px;
        }
 
        .value {
          padding-left: 10px;
          margin-bottom: 22px;
          text-align: left;
          font-weight: 900;
          font-size: 18px;
          color: #0e6efd;
          line-height: 21px;
        }
      }
 
      .companyCard:nth-child(2) {
        flex: 1;
        margin-left: 10px;
        display: flex;
        justify-content: space-between;
        padding-right: 10px;
 
        .statusLeft {
          text-align: left;
 
          .num {
            padding-left: 10px;
            // padding-right: 10px;
          }
        }
 
      }
    }
 
    .todayWarn {
      box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.2);
      border-radius: 10px 10px 0px 0px;
      background: #f4f4ff;
      margin-bottom: 10px;
      padding: 10px;
      flex: 1;
 
      .warnList {
        height: 100%;
        overflow-y: auto;
        box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.2);
        border-radius: 10px 10px 0px 0px;
        background-color: #fff;
 
        .warnItem {
          height: 26px;
          background: rgba(39, 129, 255, 0.06);
          border-radius: 4px;
          padding: 2px;
          display: flex;
          align-content: center;
          margin-bottom: 10px;
 
          .grade {
            height: 22px;
            background: #e6f4ff;
            border-radius: 4px;
            border: 1px solid #bae0ff;
            margin-right: 11px;
            box-sizing: border-box;
            padding: 1px 8px;
 
            font-weight: 400;
            font-size: 12px;
            color: #1677ff;
            line-height: 20px;
          }
 
          .info {
            font-size: 12px;
            color: rgba(0, 0, 0, 0.8);
            line-height: 26px;
          }
        }
 
        .warnItem:last-child {
          margin-bottom: 0 !important;
        }
 
        .oneWarn {
          background: rgba(255, 77, 79, 0.06);
 
          .grade {
            background: #fff1f0;
            border: 1px solid #ffccc7;
            color: rgba(255, 77, 79, 1);
          }
        }
 
        .twoWarn {
          background: rgba(250, 173, 20, 0.06);
 
          .grade {
            background: #fffbe6;
            border-radius: 4px;
            border: 1px solid #fff1b8;
            color: rgba(250, 173, 20, 1);
          }
        }
 
        .threeWarn {
          background: rgba(39, 129, 255, 0.06);
 
          .grade {
            background: #e6f4ff;
            border: 1px solid #bae0ff;
            color: #1677ff;
          }
        }
 
        .fourWarn {
          background: rgba(82, 196, 26, 0.06);
 
          .grade {
            background: #f6ffed;
            border-radius: 4px;
            border: 1px solid #d9f7be;
            color: rgba(82, 196, 26, 1);
          }
        }
 
        .fiveWarn {
          background: rgba(214, 219, 228, 0.3);
 
          .grade {
            background: rgba(214, 219, 228, 0.3);
            border-radius: 4px;
            border: 1px solid rgba(214, 219, 228, 0.6);
            color: rgba(0, 0, 0, 0.8);
          }
        }
      }
 
      .warnList::-webkit-scrollbar {
        width: 8px;
        height: 8px;
        background-color: #f5f5f5;
      }
 
      .warnList::-webkit-scrollbar-thumb {
        background-color: #ccc;
        border-radius: 4px;
      }
 
      .warnList::-webkit-scrollbar-thumb:hover {
        background-color: #aaa;
      }
    }
 
    .warnCount {
      // position: relative;
      padding: 10px;
      box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.2);
      border-radius: 10px 10px 0px 0px;
      background: #f4f4ff;
      margin-bottom: 0px !important;
      flex: 1;
 
      #countChart {
        width: 100%;
        height: 100%;
      }
 
      .noData {
        display: flex;
        flex-direction: column;
        align-content: center;
        justify-content: center;
        // position: absolute;
        // bottom: 0;
        // left: 0;
        width: 100%;
        height: 180px;
      }
    }
 
    .warnRank {
      position: relative;
      box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.2);
      border-radius: 10px 10px 0px 0px;
      background: #f4f4ff;
      padding: 10px;
      flex: 1;
 
      .rankChart {
        padding: 5px;
        width: 100%;
        background: #fff;
        // height: 300px;
 
        .rankItem {
          display: flex;
          align-content: center;
          margin-bottom: 14px;
 
          .left {
            flex: 2;
            padding-right: 25px;
            font-weight: 400;
            font-size: 13px;
            color: rgba(0, 0, 0, 0.45);
            line-height: 17px;
            text-align: right;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
          }
 
          .rankRight {
            flex: 5;
            height: 15px;
            background: rgba(93, 112, 146, 0.2);
            border-radius: 8px;
 
            .rank {
              height: 15px;
              border-radius: 8px;
              background: rgba(93, 112, 146, 0.6);
            }
          }
 
          .rankColor {
            background: rgba(91, 143, 249, 0.2);
 
            .rank {
              background: rgba(91, 143, 249, 0.85);
            }
          }
        }
 
        .rankItem:last-child {
          margin-bottom: 0 !important;
        }
      }
 
      .noData {
        display: flex;
        flex-direction: column;
        align-content: center;
        justify-content: center;
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 300px;
      }
    }
  }
}
 
.operate_type {
  color: #1677ff;
  cursor: pointer;
 
  &:hover {
    color: #0052d9;
  }
 
  text-decoration: underline;
}
</style>