liwei19941102 2 лет назад
Родитель
Сommit
b204e96316

+ 5 - 0
src/components/Map/index.vue

@@ -58,6 +58,7 @@
             }
             var car = res.rows[res.rows.length - 1]
             if (car) {
+                setCenterLocation([car.lng,car.lat]);
                 var location = formatGCJ(car.lng, car.lat);
                 // addMarker(location, car, "../src/assets/images/icon/小货车.png", 'car')
                 addMarker(location, car, carImage, 'car')
@@ -70,6 +71,10 @@
         tableData.value = data
     }
 
+    const setCenterLocation = (location) =>{
+        mapObj.value.setCenter(location);
+    }
+
     const initMap = () => {
         window._AMapSecurityConfig = {
             securityJsCode: '8e920f73eb2e6880a92ea6662eefc476',

+ 2 - 11
src/views/yunying/scheduling/index.vue

@@ -67,23 +67,14 @@
                 <img style="width: 28px;height: 28px;" src="@/assets/images/icon/cam.png" />
               </div>
             </div>
-            <div style="position:absolute;bottom:10px;right:6px;font-size:10px">
+            <div style="position:absolute;bottom:10px;right:6px;font-size:15px">
               <span>客流:{{ gettotalpeople(item, 11) }}人 </span>
               <span style="margin-left: 10px;"
                 >乘客:{{
                                 gettotalpeople(item, 0)
-
-
-
-
-
-
-
-
-
                 }}人
               </span>
-              <span style="margin-left: 10px;">货物:11个</span>
+              <!-- <span style="margin-left: 10px;">货物:11个</span> -->
             </div>
           </div>
         </el-card>

+ 23 - 5
src/views/yunying/videoKdg/index.vue

@@ -184,6 +184,7 @@
     const getSites = () => {
         listData({ dictType: "tbl_sites" }).then(res2 => {
             sites.value = res2.rows;
+            getCountry();
         });
     }
 
@@ -199,9 +200,11 @@
     const currentdata = ref(null)
 
     const videoInit = (data, node) => {
+        console.log(data)
         var siteList = data.data.sites.split(",")
         var deviceList = [];
         siteListArry.value = [];
+        console.log(sites.value)
         for (var i in sites.value) {
             if (siteList.indexOf(sites.value[i].dictCode) > -1) {
                 if (isJSON(sites.value[i].remark)) {
@@ -242,8 +245,10 @@
     }
 
     const treeclick = (data: TreeNodeData, node: TreeNode) => {
+        console.log(data)
         videoCount.value = 0
         setTimeout(() => {
+            console.log(data)
             videoInit(data, node)
         }, 1000);
     }
@@ -410,13 +415,12 @@
 
     const getCountry = () => {
         listCountry({ pageSize: 10000 }).then(res => {
-            console.log(res)
             countryList.value = res.rows
+            treeclick(data.value[0].children[0], null)
         })
     }
 
     const updateSites = (sitesList) => {
-        console.log(sitesList)
         var sites = []
         for (var i in sitesList) {
 
@@ -430,6 +434,7 @@
         data.value[0].children = sites
         console.log(data.value)
         showTree.value = false;
+        console.log(data.value[0].children[0])
         setTimeout(() => {
             showTree.value = true
         }, 100);
@@ -445,16 +450,29 @@
             children: countryList.value.map(i => { return { id: ++index, label: i.name, data: i } }),
         },]
     });
-    onMounted(() => {
+
+    const initData = async () => {
         if (treeRef.value) {
             setTimeout(() => {
                 treeRef.value.expandNode(treeRef.value.getNode(1))
             }, 100);
-            getSites();
+            await getSites();
             // initData();
-            getCountry();
             // treeRef.value.expandNode(treeRef.value.getNode(1))
         }
+    }
+
+    onMounted(() => {
+        initData();
+        // if (treeRef.value) {
+        //     setTimeout(() => {
+        //         treeRef.value.expandNode(treeRef.value.getNode(1))
+        //     }, 100);
+        //     getSites();
+        //     // initData();
+        //     getCountry();
+        //     // treeRef.value.expandNode(treeRef.value.getNode(1))
+        // }
     });
 </script>