Browse Source

学校-查看设备地理位置

gzb
wangzhonglu 8 months ago
parent
commit
8559a66ac9

+ 105
- 12335
package-lock.json
File diff suppressed because it is too large
View File


+ 1
- 0
package.json View File

11
     "md5": "^2.3.0",
11
     "md5": "^2.3.0",
12
     "qrcode": "^1.5.1",
12
     "qrcode": "^1.5.1",
13
     "qrcodejs2": "^0.0.2",
13
     "qrcodejs2": "^0.0.2",
14
+    "vue-baidu-map": "^0.21.22",
14
     "vue-simple-uploader": "^0.7.6"
15
     "vue-simple-uploader": "^0.7.6"
15
   },
16
   },
16
   "devDependencies": {
17
   "devDependencies": {

+ 7
- 1
src/views/schoolSection/deviceManage/breakRuleDevice.vue View File

557
             this.userInfo.adminid,
557
             this.userInfo.adminid,
558
             snList
558
             snList
559
           );
559
           );
560
-          controlWSMsg.msgContent(this.controlMessageInfo.content);
560
+          controlWSMsg.msgContent(
561
+            JSON.stringify({
562
+              title: this.controlMessageInfo.title,
563
+              content: this.controlMessageInfo.content
564
+            })
565
+          );
561
           controlWSMsg.send();
566
           controlWSMsg.send();
562
           let form = {
567
           let form = {
563
             pushType: 1,
568
             pushType: 1,
564
             pushObj: 1,
569
             pushObj: 1,
570
+            pushObjname: this.controlMessageInfo.title,
565
             content: this.controlMessageInfo.content
571
             content: this.controlMessageInfo.content
566
           };
572
           };
567
           form.userids = useridList;
573
           form.userids = useridList;

+ 278
- 24
src/views/schoolSection/deviceManage/deviceManage.vue View File

350
       </div>
350
       </div>
351
     </Modal>
351
     </Modal>
352
     <Modal
352
     <Modal
353
-      class="modal2"
353
+      class="modal5"
354
       :mask-closable="false"
354
       :mask-closable="false"
355
       v-model="deviceDetailInfo.show"
355
       v-model="deviceDetailInfo.show"
356
       :title="`查看【${deviceDetailInfo.username}】`"
356
       :title="`查看【${deviceDetailInfo.username}】`"
358
       <div class="section_title">基本信息</div>
358
       <div class="section_title">基本信息</div>
359
       <div class="section_item">
359
       <div class="section_item">
360
         <div class="device_base">
360
         <div class="device_base">
361
-          <div class="device_base_left"></div>
361
+          <div class="device_base_left">
362
+            <div class="phone_dot"></div>
363
+            <Icon
364
+              class="ivu-icon iconfont icon-anzhuoandroid"
365
+              color="#52C41A"
366
+              size="45"
367
+            ></Icon>
368
+          </div>
362
           <div class="device_base_right">
369
           <div class="device_base_right">
363
             <Form :label-width="90">
370
             <Form :label-width="90">
364
               <FormItem label="使用人">{{
371
               <FormItem label="使用人">{{
396
         <div class="detail_left">
403
         <div class="detail_left">
397
           <table class="my_table">
404
           <table class="my_table">
398
             <tr>
405
             <tr>
399
-              <th style="width: 110px">设备号</th>
400
-              <td></td>
401
-            </tr>
402
-            <tr>
403
-              <th>SN/IMEI</th>
404
-              <td></td>
406
+              <th style="width: 110px">SN/IMEI</th>
407
+              <td>{{ deviceDetailInfo.detail.sn }}</td>
405
             </tr>
408
             </tr>
406
             <tr>
409
             <tr>
407
               <th>WiFi/MAC</th>
410
               <th>WiFi/MAC</th>
408
-              <td></td>
411
+              <td>{{ deviceDetailInfo.detail.wifyMac }}</td>
409
             </tr>
412
             </tr>
410
             <tr>
413
             <tr>
411
               <th>蓝牙MAC</th>
414
               <th>蓝牙MAC</th>
412
-              <td></td>
415
+              <td>{{ deviceDetailInfo.detail.blueMac }}</td>
413
             </tr>
416
             </tr>
414
           </table>
417
           </table>
415
         </div>
418
         </div>
417
           <table class="my_table">
420
           <table class="my_table">
418
             <tr>
421
             <tr>
419
               <th style="width: 110px">系统内核</th>
422
               <th style="width: 110px">系统内核</th>
420
-              <td></td>
423
+              <td>{{ deviceDetailInfo.detail.sysKernel }}</td>
421
             </tr>
424
             </tr>
422
             <tr>
425
             <tr>
423
               <th>Rom版本</th>
426
               <th>Rom版本</th>
424
-              <td></td>
427
+              <td>{{ deviceDetailInfo.detail.romVersion }}</td>
425
             </tr>
428
             </tr>
426
             <tr>
429
             <tr>
427
               <th>SIM序列号</th>
430
               <th>SIM序列号</th>
428
-              <td></td>
431
+              <td>{{ deviceDetailInfo.detail.sim }}</td>
429
             </tr>
432
             </tr>
430
           </table>
433
           </table>
431
         </div>
434
         </div>
432
-        <div class="detail_right"></div>
435
+        <div class="detail_right">
436
+          <div id="memory_detail"></div>
437
+        </div>
433
         <div></div>
438
         <div></div>
434
       </div>
439
       </div>
435
       <div class="section_title">已安装应用</div>
440
       <div class="section_title">已安装应用</div>
440
         ></Table>
445
         ></Table>
441
       </div>
446
       </div>
442
       <div class="section_title">地理位置</div>
447
       <div class="section_title">地理位置</div>
443
-      <div class="section_title">应用使用统计</div>
448
+      <div class="geo_location">
449
+        <div class="geo_location_header">
450
+          <div>只显示最近十条位置信息</div>
451
+        </div>
452
+        <div class="geo_location_main" v-if="deviceDetailInfo.show">
453
+          <baidu-map
454
+            class="baidu_map"
455
+            ak="2xUGaxSQ2TXTsPoiAtT9jZ88tsAl8qw2"
456
+            :center="baiduMapInfo.center"
457
+            :zoom="14"
458
+            :scroll-wheel-zoom="true"
459
+            @ready="baiduMapReady"
460
+          >
461
+            <!--缩放-->
462
+            <bm-navigation anchor="BMAP_ANCHOR_TOP_LEFT"></bm-navigation>
463
+            <!--定位-->
464
+            <bm-geolocation
465
+              anchor="BMAP_ANCHOR_BOTTOM_RIGHT"
466
+              :showAddressBar="true"
467
+              :autoLocation="true"
468
+            ></bm-geolocation>
469
+            <!--点-->
470
+            <bm-marker
471
+              v-for="(item, index) in baiduMapInfo.positions"
472
+              :key="index"
473
+              :position="{ lng: item.lng, lat: item.lat }"
474
+              :dragging="true"
475
+              animation="BMAP_ANIMATION_DROP"
476
+              @click="bmMarkerClick(item, $event)"
477
+            >
478
+              <!-- 信息弹窗 -->
479
+              <bm-info-window
480
+                title="坐标信息"
481
+                :position="{
482
+                  lng: baiduMapInfo.markerInfo.lng,
483
+                  lat: baiduMapInfo.markerInfo.lat
484
+                }"
485
+                :show="baiduMapInfo.markerInfo.show"
486
+                @close="closeBmInfoWindow()"
487
+              >
488
+                <div>地址: {{ baiduMapInfo.markerInfo.address }}</div>
489
+                <div>经度:{{ baiduMapInfo.markerInfo.lng }}</div>
490
+                <div>维度:{{ baiduMapInfo.markerInfo.lat }}</div>
491
+              </bm-info-window>
492
+            </bm-marker>
493
+          </baidu-map>
494
+        </div>
495
+      </div>
496
+      <div class="section_title">
497
+        应用使用统计<span>应用使用统计(最近七天)</span>
498
+      </div>
444
       <div class="section_table_wrap">
499
       <div class="section_table_wrap">
445
         <Table :columns="usesColumns" :data="deviceDetailInfo.detail.uses">
500
         <Table :columns="usesColumns" :data="deviceDetailInfo.detail.uses">
446
           <template slot-scope="{ row }" slot="durationSlot">
501
           <template slot-scope="{ row }" slot="durationSlot">
464
 </template>
519
 </template>
465
 
520
 
466
 <script>
521
 <script>
522
+import BaiduMap from "vue-baidu-map/components/map/Map.vue";
523
+import BmNavigation from "vue-baidu-map/components/controls/Navigation";
524
+import BmGeolocation from "vue-baidu-map/components/controls/Geolocation";
525
+import BmMarker from "vue-baidu-map/components/overlays/Marker";
526
+import BmInfoWindow from "vue-baidu-map/components/overlays/InfoWindow";
527
+import * as echarts from "echarts";
467
 import controlWs from "@/utils/ControlWs";
528
 import controlWs from "@/utils/ControlWs";
468
 import ControlWSMsg from "@/utils/ControlWSMsg";
529
 import ControlWSMsg from "@/utils/ControlWSMsg";
469
 import { exportToExcel } from "@/utils/exportToExcel";
530
 import { exportToExcel } from "@/utils/exportToExcel";
485
   formatSeconds
546
   formatSeconds
486
 } from "@/utils";
547
 } from "@/utils";
487
 export default {
548
 export default {
549
+  components: {
550
+    BaiduMap,
551
+    BmNavigation,
552
+    BmGeolocation,
553
+    BmMarker,
554
+    BmInfoWindow
555
+  },
488
   data() {
556
   data() {
489
     return {
557
     return {
558
+      baiduMapInfo: {
559
+        center: "郑州市",
560
+        // {lng, lat}
561
+        positions: [],
562
+        // {show, title, lng, lat}
563
+        markerInfo: {},
564
+        BMap: null,
565
+        map: null
566
+      },
490
       weekDay,
567
       weekDay,
491
       padDeviceIcon,
568
       padDeviceIcon,
492
       padViolatesInfo,
569
       padViolatesInfo,
574
           align: "center"
651
           align: "center"
575
         },
652
         },
576
         {
653
         {
577
-          title: "在线状态",
654
+          title: "状态",
578
           slot: "onlineSlot",
655
           slot: "onlineSlot",
656
+          width: 70,
579
           align: "center"
657
           align: "center"
580
         },
658
         },
581
         {
659
         {
772
     controlWs.closeWs();
850
     controlWs.closeWs();
773
   },
851
   },
774
   methods: {
852
   methods: {
853
+    initMemoryDetailEcharts() {
854
+      let _totalMemory = this.deviceDetailInfo.detail.totalMemory;
855
+      let _usedMemory = this.deviceDetailInfo.detail.usedMemory;
856
+      let _residueMemory = _totalMemory - _usedMemory;
857
+      const options = {
858
+        tooltip: {
859
+          trigger: "item",
860
+          formatter: "{b}: {d}%"
861
+        },
862
+        legend: {
863
+          bottom: "10",
864
+          left: "center",
865
+          itemWidth: 10,
866
+          itemHeight: 10,
867
+          //图例距离饼图的距离
868
+          itemGap: 10,
869
+          orient: "horizontal",
870
+          data: ["内部存储"],
871
+          textStyle: {
872
+            color: "#253A70"
873
+          }
874
+        },
875
+        color: ["#FFC300", "#FF8D1A"],
876
+        series: [
877
+          {
878
+            type: "pie",
879
+            name: "内部存储",
880
+            radius: ["30%", "45%"],
881
+            center: ["50%", "45%"],
882
+            label: {
883
+              formatter: (params) => {
884
+                let memoryInfo = {
885
+                  value: params.value,
886
+                  unit: "B"
887
+                };
888
+                if (memoryInfo.value / 1024 < 1024) {
889
+                  memoryInfo.value =
890
+                    Math.floor((memoryInfo.value / 1024) * 100) / 100;
891
+                  memoryInfo.unit = "KB";
892
+                } else if (memoryInfo.value / 1024 / 1024 < 1024) {
893
+                  memoryInfo.value =
894
+                    Math.floor((memoryInfo.value / 1024 / 1024) * 100) / 100;
895
+                  memoryInfo.unit = "MB";
896
+                } else {
897
+                  memoryInfo.value =
898
+                    Math.floor((memoryInfo.value / 1024 / 1024 / 1024) * 100) /
899
+                    100;
900
+                  memoryInfo.unit = "GB";
901
+                }
902
+                return `${params.name}\n${memoryInfo.value}${memoryInfo.unit}`;
903
+              },
904
+              borderWidth: 1,
905
+              borderRadius: 4,
906
+              color: "#7C8DB5",
907
+              fontSize: 12,
908
+              lineHeight: 18
909
+            },
910
+            data: [
911
+              { value: _residueMemory, name: "剩余" },
912
+              { value: _usedMemory, name: "已使用" }
913
+            ]
914
+          }
915
+        ]
916
+      };
917
+      const memoryEcharts = echarts.init(
918
+        document.getElementById("memory_detail")
919
+      );
920
+      memoryEcharts.clear();
921
+      memoryEcharts.setOption(options);
922
+    },
775
     initMonitorWS() {
923
     initMonitorWS() {
776
       controlWs.setWs();
924
       controlWs.setWs();
777
       this.getWSEventInfo();
925
       this.getWSEventInfo();
954
           this.deviceDetailInfo.show = true;
1102
           this.deviceDetailInfo.show = true;
955
           this.deviceDetailInfo.username = row.username;
1103
           this.deviceDetailInfo.username = row.username;
956
           this.deviceDetailInfo.detail = data.obj;
1104
           this.deviceDetailInfo.detail = data.obj;
1105
+          if (this.deviceDetailInfo.detail.positions.length > 0) {
1106
+            let _positions = this.deviceDetailInfo.detail.positions;
1107
+            this.baiduMapInfo.positions = _positions.map((item) => {
1108
+              return { address: "", lng: item.lon, lat: item.lat };
1109
+            });
1110
+            this.baiduMapInfo.center = {
1111
+              lng: this.baiduMapInfo.positions[0].lng,
1112
+              lat: this.baiduMapInfo.positions[0].lat
1113
+            };
1114
+            this.baiduMapInfo.markerInfo = {
1115
+              show: false,
1116
+              address: "",
1117
+              lng: this.baiduMapInfo.center.lng,
1118
+              lat: this.baiduMapInfo.center.lat
1119
+            };
1120
+          } else {
1121
+            this.baiduMapInfo.center = "郑州市";
1122
+          }
1123
+          this.initMemoryDetailEcharts();
957
         } else {
1124
         } else {
958
           this.$Message.error(data.msg);
1125
           this.$Message.error(data.msg);
959
         }
1126
         }
960
       });
1127
       });
961
     },
1128
     },
1129
+    baiduMapReady({ BMap, map }) {
1130
+      this.baiduMapInfo.BMap = BMap;
1131
+      this.baiduMapInfo.map = map;
1132
+    },
1133
+    bmMarkerClick(item, { point }) {
1134
+      if (item.address) {
1135
+        this.baiduMapInfo.markerInfo = {
1136
+          show: true,
1137
+          address: item.address,
1138
+          lng: item.lng,
1139
+          lat: item.lat
1140
+        };
1141
+      } else {
1142
+        const geocoder = new this.baiduMapInfo.BMap.Geocoder();
1143
+        geocoder.getLocation(point, (data) => {
1144
+          if (data) {
1145
+            item.address = data.address;
1146
+            this.baiduMapInfo.markerInfo = {
1147
+              show: true,
1148
+              address: data.address,
1149
+              lng: item.lng,
1150
+              lat: item.lat
1151
+            };
1152
+          }
1153
+        });
1154
+      }
1155
+    },
1156
+    closeBmInfoWindow() {
1157
+      this.baiduMapInfo.markerInfo.show = false;
1158
+    },
962
     // 策略
1159
     // 策略
963
     toStrategy(row) {
1160
     toStrategy(row) {
964
       stPad_detail_web({ objectid: row.userid }).then((res) => {
1161
       stPad_detail_web({ objectid: row.userid }).then((res) => {
1003
       password_detail_userpwd({
1200
       password_detail_userpwd({
1004
         rtype: this.powerParams.rtype,
1201
         rtype: this.powerParams.rtype,
1005
         objectid: this.powerParams.objectid,
1202
         objectid: this.powerParams.objectid,
1006
-        sn: row.sn
1203
+        userid: row.userid
1007
       }).then((data) => {
1204
       }).then((data) => {
1008
         if (data.code === 0) {
1205
         if (data.code === 0) {
1009
           this.devicePswInfo = {
1206
           this.devicePswInfo = {
1168
             this.userInfo.adminid,
1365
             this.userInfo.adminid,
1169
             snList
1366
             snList
1170
           );
1367
           );
1171
-          controlWSMsg.msgContent(this.controlMessageInfo.content);
1368
+          controlWSMsg.msgContent(
1369
+            JSON.stringify({
1370
+              title: this.controlMessageInfo.title,
1371
+              content: this.controlMessageInfo.content
1372
+            })
1373
+          );
1172
           controlWSMsg.send();
1374
           controlWSMsg.send();
1173
           let form = {
1375
           let form = {
1174
             pushType: 1,
1376
             pushType: 1,
1175
             pushObj: this.controlMessageInfo.classid ? 2 : 1,
1377
             pushObj: this.controlMessageInfo.classid ? 2 : 1,
1378
+            pushObjname: this.controlMessageInfo.title,
1176
             content: this.controlMessageInfo.content
1379
             content: this.controlMessageInfo.content
1177
           };
1380
           };
1178
           if (this.controlMessageInfo.classid) {
1381
           if (this.controlMessageInfo.classid) {
1532
   }
1735
   }
1533
 }
1736
 }
1534
 .section_title {
1737
 .section_title {
1738
+  display: flex;
1739
+  justify-content: space-between;
1740
+  align-items: center;
1535
   padding-left: 10px;
1741
   padding-left: 10px;
1536
   font-size: 18px;
1742
   font-size: 18px;
1537
   line-height: 20px;
1743
   line-height: 20px;
1538
   font-weight: bold;
1744
   font-weight: bold;
1539
   border-left: 4px solid #339dff;
1745
   border-left: 4px solid #339dff;
1746
+  > span {
1747
+    font-weight: normal;
1748
+    font-size: 16px;
1749
+  }
1540
 }
1750
 }
1541
 .section_table_wrap {
1751
 .section_table_wrap {
1542
   margin: 16px 0;
1752
   margin: 16px 0;
1555
     margin: 16px 0;
1765
     margin: 16px 0;
1556
     width: 50%;
1766
     width: 50%;
1557
     .device_base_left {
1767
     .device_base_left {
1768
+      position: relative;
1769
+      display: flex;
1770
+      justify-content: center;
1771
+      align-items: center;
1558
       margin-left: 10px;
1772
       margin-left: 10px;
1559
       width: 120px;
1773
       width: 120px;
1560
       height: 240px;
1774
       height: 240px;
1561
       border-radius: 15px;
1775
       border-radius: 15px;
1562
-      border: 3px solid #000;
1776
+      border: 4px solid #000;
1777
+      .phone_dot {
1778
+        position: absolute;
1779
+        top: 10px;
1780
+        margin: 0 auto;
1781
+        width: 30px;
1782
+        height: 8px;
1783
+        border-radius: 4px;
1784
+        background-color: #000;
1785
+      }
1563
     }
1786
     }
1564
     .device_base_right {
1787
     .device_base_right {
1565
       width: calc(100% - 140px);
1788
       width: calc(100% - 140px);
1602
     td {
1825
     td {
1603
       position: relative;
1826
       position: relative;
1604
       padding: 0;
1827
       padding: 0;
1605
-      line-height: 46px;
1828
+      line-height: 22px;
1606
       color: #798cb5;
1829
       color: #798cb5;
1607
       text-align: center;
1830
       text-align: center;
1608
       vertical-align: middle;
1831
       vertical-align: middle;
1609
-      white-space: nowrap;
1832
+      // white-space: nowrap;
1833
+      word-break: break-all;
1834
+      white-space: normal;
1610
       border: 1px solid #ced9f2;
1835
       border: 1px solid #ced9f2;
1611
     }
1836
     }
1612
   }
1837
   }
1613
   .detail_left {
1838
   .detail_left {
1614
-    width: calc(33.33% - 30px);
1839
+    margin-right: 15px;
1840
+    width: calc(50% - 280px);
1615
   }
1841
   }
1616
   .detail_center {
1842
   .detail_center {
1617
-    width: calc(33.33% - 20px);
1843
+    margin-right: 15px;
1844
+    width: calc(50% - 150px);
1618
   }
1845
   }
1619
   .detail_right {
1846
   .detail_right {
1620
-    width: 33.33%;
1847
+    width: 400px;
1848
+    height: 200px;
1849
+    #memory_detail {
1850
+      width: 400px;
1851
+      height: 200px;
1852
+    }
1853
+  }
1854
+}
1855
+.geo_location {
1856
+  margin: 16px 0;
1857
+  border: 1px solid #ced9f2;
1858
+  .geo_location_header {
1859
+    display: flex;
1860
+    justify-content: flex-end;
1861
+    align-items: center;
1862
+    padding: 0 16px;
1863
+    line-height: 44px;
1864
+    font-size: 16px;
1865
+    color: #339dff;
1866
+    border-bottom: 1px solid #ced9f2;
1867
+    background: #edf3ff;
1868
+  }
1869
+  .geo_location_main {
1870
+    height: 400px;
1871
+    .baidu_map {
1872
+      width: 100%;
1873
+      height: 100%;
1874
+    }
1621
   }
1875
   }
1622
 }
1876
 }
1623
 </style>
1877
 </style>

Loading…
Cancel
Save