gemercheung 1 год назад
Родитель
Сommit
d672ea6b49
3 измененных файлов с 20 добавлено и 14 удалено
  1. 1 0
      src/views/map/addProjectModal.vue
  2. 9 4
      src/views/map/index.vue
  3. 10 10
      src/views/map/list.vue

+ 1 - 0
src/views/map/addProjectModal.vue

@@ -5,6 +5,7 @@
     :title="isEditMode ? t('layout.map.projectInfo') : t('layout.map.addPro')"
     :minHeight="380"
     :width="550"
+    destroyOnClose
     @ok="handleSubmit"
     @cancel="handleCancel"
   >

+ 9 - 4
src/views/map/index.vue

@@ -204,6 +204,7 @@
   const projectId = useRouteQuery('projectId');
   const allProjectData = ref<any[]>([]);
   const allSceneData = ref<any[]>([]);
+  let deylayTimer;
   const type = useRouteQuery('type', 0);
   const form = ref<{
     searchValue: undefined | string;
@@ -248,13 +249,17 @@
       if (!ready) return;
       console.log('ready', ready, lo.value.length);
       loadingRef.value = false;
-      if (ready && lo.value.length > 0) {
-        setTimeout(() => {
+
+      if (lo.value.length > 0) {
+        deylayTimer && clearTimeout(deylayTimer);
+        deylayTimer = setTimeout(() => {
           realLocations.value = locations.value;
           console.warn('delayCluster');
           delayCluster.value = true;
           mapFitBounds(mapRef, locations.value);
         }, 600);
+      } else {
+        setDefaultCenter();
       }
     },
     {
@@ -372,12 +377,12 @@
     }
   };
 
-  const setCenter = (lat: number, lng: number) => {
+  const setCenter = (lat: number, lng: number, zoom = 14) => {
     if (mapRef.value) {
       // debugger;
       // console.log('mapRef.value', mapRef.value);
       mapRef.value.map?.setCenter({ lat, lng });
-      mapRef.value.map?.setZoom(14);
+      mapRef.value.map?.setZoom(zoom);
     }
   };
 

+ 10 - 10
src/views/map/list.vue

@@ -140,16 +140,16 @@
           slots: { customRender: 'createTime' },
           width: 200,
         },
-        {
-          title: '求证测试(lat)',
-          dataIndex: 'lat',
-          width: 100,
-        },
-        {
-          title: '求证测试(lon)',
-          dataIndex: 'lon',
-          width: 100,
-        },
+        // {
+        //   title: '求证测试(lat)',
+        //   dataIndex: 'lat',
+        //   width: 100,
+        // },
+        // {
+        //   title: '求证测试(lon)',
+        //   dataIndex: 'lon',
+        //   width: 100,
+        // },
         {
           title: t('layout.map.homeShow'),
           dataIndex: 'isShow',