From fe7fd6e4b1450c01faba724bb22b1d050e896c92 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期三, 23 七月 2025 17:29:50 +0800
Subject: [PATCH] 2025.7.23 监管地图(待完成)

---
 src/views/fysp/task/components/CompTaskMap.vue |    1 
 src/utils/map/util.js                          |  108 +++++++++++++++++++++++++++
 src/components.d.ts                            |    6 
 src/components/map/SceneMap.vue                |   61 ++++++++++++++-
 src/views/fysp/task/TaskManage.vue             |    5 +
 src/utils/map/marks.js                         |    2 
 6 files changed, 173 insertions(+), 10 deletions(-)

diff --git a/src/components.d.ts b/src/components.d.ts
index 688bead..cd88150 100644
--- a/src/components.d.ts
+++ b/src/components.d.ts
@@ -13,7 +13,6 @@
     CompGenericWrapper: typeof import('./components/CompGenericWrapper.vue')['default']
     CompQuickSet: typeof import('./components/search-option/CompQuickSet.vue')['default']
     Content: typeof import('./components/core/Content.vue')['default']
-    copy: typeof import('./components/search-option/FYOptionUserType copy.vue')['default']
     ElAffix: typeof import('element-plus/es')['ElAffix']
     ElAside: typeof import('element-plus/es')['ElAside']
     ElAvatar: typeof import('element-plus/es')['ElAvatar']
@@ -52,7 +51,10 @@
     ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
     ElMenuItemGroup: typeof import('element-plus/es')['ElMenuItemGroup']
     ElOption: typeof import('element-plus/es')['ElOption']
+    ElPagination: typeof import('element-plus/es')['ElPagination']
     ElPopover: typeof import('element-plus/es')['ElPopover']
+    ElRadioButton: typeof import('element-plus/es')['ElRadioButton']
+    ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
     ElRow: typeof import('element-plus/es')['ElRow']
     ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
     ElSelect: typeof import('element-plus/es')['ElSelect']
@@ -79,11 +81,9 @@
     FYImageSelectDialog: typeof import('./components/FYImageSelectDialog.vue')['default']
     FYInfoSearch: typeof import('./components/search-option/FYInfoSearch.vue')['default']
     FYList: typeof import('./components/table/FYList.vue')['default']
-    FYOption: typeof import('./components/search-option/FYOption.vue')['default']
     FYOptionLocation: typeof import('./components/search-option/FYOptionLocation.vue')['default']
     FYOptionOnlineStatus: typeof import('./components/search-option/FYOptionOnlineStatus.vue')['default']
     FYOptionScene: typeof import('./components/search-option/FYOptionScene.vue')['default']
-    FYOptionSupervision: typeof import('./components/search-option/FYOptionSupervision.vue')['default']
     FYOptionSupervisionStatus: typeof import('./components/search-option/FYOptionSupervisionStatus.vue')['default']
     FYOptionText: typeof import('./components/search-option/base/FYOptionText.vue')['default']
     FYOptionTime: typeof import('./components/search-option/FYOptionTime.vue')['default']
diff --git a/src/components/map/SceneMap.vue b/src/components/map/SceneMap.vue
index fe296bd..e301ec3 100644
--- a/src/components/map/SceneMap.vue
+++ b/src/components/map/SceneMap.vue
@@ -9,11 +9,22 @@
     ></FYOptionScene>
     <slot name="left-top"></slot>
   </el-row>
+  <el-scrollbar class="right-wrap">
+    <div v-for="s in selectedSceneList" :key="s.guid">
+      <el-checkbox
+        v-model="s._checked"
+        :label="s.name"
+        @change="handleChange"
+      />
+      <!-- <el-text>{{ s.name }}</el-text> -->
+    </div>
+  </el-scrollbar>
 </template>
 <script setup>
-import { ref, watch } from 'vue';
+import { ref, watch, computed } from 'vue';
 import { map, onMapMounted } from '@/utils/map/index';
 import marks from '@/utils/map/marks';
+import mapUtil from '@/utils/map/util';
 import { sceneIcon } from '@/assets/scene-icon';
 const props = defineProps({
   // 鍦烘櫙鐐逛綅淇℃伅
@@ -24,6 +35,17 @@
 let markViewList = [];
 
 const scenetype = ref();
+
+const selectedSceneList = computed(() => {
+  return props.data.filter((v) => {
+    v._checked = true;
+    return (
+      scenetype.value == undefined ||
+      scenetype.value.value == null ||
+      v.typeid + '' == scenetype.value.value
+    );
+  });
+});
 
 watch(
   () => props.data,
@@ -43,6 +65,12 @@
     filterMarkViews();
   }
 });
+
+function handleChange(value) {
+  console.log(value);
+
+  filterMarkViews();
+}
 
 function createSceneMarks() {
   onMapMounted(() => {
@@ -64,15 +92,15 @@
             content: ''
             // direction: 'bottom'
           });
-          _extData._show = false
-          ev.target.setExtData(_extData)
+          _extData._show = false;
+          ev.target.setExtData(_extData);
         } else {
           ev.target.setLabel({
             content: _extData.name
             // direction: 'bottom'
           });
-          _extData._show = true
-          ev.target.setExtData(_extData)
+          _extData._show = true;
+          ev.target.setExtData(_extData);
         }
       });
       allMarkViews.push(mark);
@@ -95,9 +123,22 @@
         );
       });
     }
+    markViewList = markViewList.filter((v) => {
+      const _index = selectedSceneList.value.findIndex((s) => {
+        console.log(s.guid, v.getExtData().guid);
+
+        s.guid == v.getExtData().guid;
+      });
+      return _index != -1;
+    });
     map.add(markViewList);
     setTimeout(() => {
       map.setFitView(markViewList);
+      // const list = markViewList.map((v) => {
+      //   const _extData = v.getExtData();
+      //   return [_extData.longitude, _extData.latitude];
+      // });
+      // mapUtil.setBound(list);
     }, 1000);
   });
 }
@@ -116,4 +157,14 @@
   left: 0;
   top: 0;
 }
+.right-wrap {
+  position: absolute;
+  right: 0px;
+  bottom: 0;
+  height: 50%;
+  background-color: white;
+  border-radius: 4px;
+  padding: 2px 8px;
+  max-width: 300px;
+}
 </style>
diff --git a/src/utils/map/marks.js b/src/utils/map/marks.js
index b957b7f..0c3b428 100644
--- a/src/utils/map/marks.js
+++ b/src/utils/map/marks.js
@@ -145,7 +145,7 @@
     return layer;
   },
 
-  createMarker({ position, img, label, extData }) {
+  createMarker({ position, img, label = ' ', extData }) {
     //鍒涘缓 AMap.Icon 瀹炰緥锛�
     const icon = new AMap.Icon({
       size: new AMap.Size(30, 30), //鍥炬爣灏哄
diff --git a/src/utils/map/util.js b/src/utils/map/util.js
new file mode 100644
index 0000000..9e83951
--- /dev/null
+++ b/src/utils/map/util.js
@@ -0,0 +1,108 @@
+import { map, AMap, isDragging } from '@/utils/map/index';
+import marks from '@/utils/map/marks';
+
+/**
+ * 鍧愭爣闆嗗悎鐨勬渶瑗垮崡瑙掑拰鏈�涓滃寳瑙�
+ * @param {*} list
+ *  list 鏄帴鍙h幏鍙栫殑鐐� 鐨勬暟缁�
+ */
+const getBound = (list) => {
+  const offset = 0.005;
+  let south = null;
+  let west = null;
+  let north = null;
+  let east = null;
+  for (let item of list) {
+    // 鎺掗櫎鏃犳晥缁忕含搴�
+    if (item[0] == 0 && item[1] == 0) {
+      continue;
+    }
+    if ((west && item[0] < west) || !west) {
+      west = item[0] - offset;
+    }
+    if ((south && item[1] < south) || !south) {
+      south = item[1] - offset;
+    }
+    if ((east && item[0] > east) || !east) {
+      east = item[0] + offset;
+    }
+    if ((north && item[1] > north) || !north) {
+      north = item[1] + offset;
+    }
+  }
+  if (!south || !west || !north || !east) {
+    return { sw: null, ne: null };
+  } else {
+    return { sw: [west, south], ne: [east, north] };
+  }
+};
+
+/**
+ * 鏍规嵁涓績鐐瑰嚭鍙戠殑鍗婂緞锛屽緱鍒板悎閫傜殑鍦板浘缂╂斁绯绘暟
+ * 楂樺痉鍦板浘缂╂斁绯绘暟姣忓噺灏�1锛屽垯鍦板浘灞曠ず鐨勫疄闄呰窛绂绘斁澶�1鍊�
+ * 楂樺痉鍦板浘缂╂斁绯绘暟鑼冨洿[3, 18]
+ * @param {*} d
+ */
+const distanceToZoom = (d) => {
+  let baseDis = 250,
+    z = 0;
+  while (baseDis < d) {
+    baseDis *= 2;
+    z++;
+  }
+
+  // 澶氫綑鐨勫湴鍥剧缉鏀剧郴鏁�
+  const x = (baseDis - d) / (baseDis / 2);
+  z -= x;
+  z = z < 0 ? 0 : z;
+
+  z = 18 - z;
+  z = z < 3 ? 3 : z;
+  return z;
+};
+
+export default {
+  setCenter(lnglat, ignore = false) {
+    if (!ignore && isDragging) {
+      return;
+    }
+    var now = new Date();
+    if (
+      this.lasttime == undefined ||
+      now.getTime() - this.lasttime.getTime() >= 200
+    ) {
+      map.setCenter(lnglat);
+      this.lasttime = now;
+    }
+  },
+  addViews(view) {
+    map.add(view);
+  },
+  removeViews(view) {
+    map.remove(view);
+  },
+  clearMap() {
+    marks.clearMassMarks();
+    map.clearMap();
+  },
+  setFitView(views) {
+    if (views) {
+      map.setFitView(views);
+    } else {
+      map.setFitView();
+    }
+  },
+  setFitSector({ p, r }) {
+    this.setCenter(p);
+    const z = distanceToZoom(r);
+    map.setZoom(z);
+  },
+  setBound(lnglats_GD) {
+    const { sw, ne } = getBound(lnglats_GD);
+    if (!sw || !ne) {
+      return;
+    }
+    var mybounds = new AMap.Bounds(sw, ne); // sw, ne > [xxx,xxx], [xxx,xxx]
+    map.setBounds(mybounds);
+  }
+};
diff --git a/src/views/fysp/task/TaskManage.vue b/src/views/fysp/task/TaskManage.vue
index 40ace5d..161af96 100644
--- a/src/views/fysp/task/TaskManage.vue
+++ b/src/views/fysp/task/TaskManage.vue
@@ -214,7 +214,10 @@
       });
       return [
         { name: '鍦烘櫙鏁�', value: total },
-        { name: '鏈贰鏌�', value: total - inspected },
+        {
+          name: '鏈贰鏌�',
+          value: total - inspected > 0 ? total - inspected : 0
+        },
         { name: '宸插贰鏌�', value: inspected }
       ];
     }
diff --git a/src/views/fysp/task/components/CompTaskMap.vue b/src/views/fysp/task/components/CompTaskMap.vue
index 4ca6f09..4636ff3 100644
--- a/src/views/fysp/task/components/CompTaskMap.vue
+++ b/src/views/fysp/task/components/CompTaskMap.vue
@@ -31,6 +31,7 @@
 const scenes = computed(() => {
   return props.plans
     .filter((v) => {
+      // 鎸夌収鐩戠鐘舵�佺瓫閫�
       if (supervisionStatus.value) {
         switch (supervisionStatus.value.value) {
           case '0':

--
Gitblit v1.9.3