gemercheung 1 år sedan
förälder
incheckning
42a5d2751e
2 ändrade filer med 362 tillägg och 347 borttagningar
  1. 316 283
      pnpm-lock.yaml
  2. 46 64
      src/view/map/map-board.vue

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 316 - 283
pnpm-lock.yaml


+ 46 - 64
src/view/map/map-board.vue

@@ -6,21 +6,13 @@
           <el-button :icon="Back" circle type="default" @click="router.back()" />
         </div>
         <div class="nav_container">
-          <div
-            class="nav_item"
-            :class="{ active: isCurrentTab(0) }"
-            @click="handleTabs(0)"
-          >
+          <div class="nav_item" :class="{ active: isCurrentTab(0) }" @click="handleTabs(0)">
             <el-icon size="20">
               <LocationInformation />
             </el-icon>
             <span>坐标</span>
           </div>
-          <div
-            class="nav_item"
-            :class="{ active: isCurrentTab(1) }"
-            @click="handleTabs(1)"
-          >
+          <div class="nav_item" :class="{ active: isCurrentTab(1) }" @click="handleTabs(1)">
             <el-icon size="20">
               <Grid />
             </el-icon>
@@ -31,57 +23,26 @@
     </Teleport>
     <div id="map" class="map-container" ref="mapContainer" @click.stop>
       <div class="map-component">
-        <el-select
-          v-model="tileType"
-          placeholder="选择底图"
-          style="width: 120px"
-          class="tile-type-select"
-        >
-          <el-option
-            v-for="item in tileOptions"
-            :key="item"
-            :label="item"
-            :value="item"
-          />
+        <el-select v-model="tileType" placeholder="选择底图" style="width: 120px" class="tile-type-select">
+          <el-option v-for="item in tileOptions" :key="item" :label="item" :value="item" />
         </el-select>
       </div>
 
       <div class="board" ref="boardContainer"></div>
     </div>
     <div class="right-control">
-      <MapRight
-        v-if="isCurrentTab(0)"
-        @fly-point="flyScenePoint"
-        @fly-scene="flyScene"
-        @goto-point="gotoPointPage"
-      />
-      <MapRightPoly
-        @del="handlePolysDel"
-        @edit="handlePolysEdit"
-        :data="boardData"
-        v-if="isCurrentTab(1)"
-      >
+      <MapRight v-if="isCurrentTab(0)" @fly-point="flyScenePoint" @fly-scene="flyScene" @goto-point="gotoPointPage" />
+      <MapRightPoly @del="handlePolysDel" @edit="handlePolysEdit" :data="boardData" v-if="isCurrentTab(1)">
       </MapRightPoly>
     </div>
 
     <Teleport to="body" v-if="isMounted">
       <el-button class="temp_btn" @click="clearPolys">后端全清</el-button>
-      <div
-        class="draw-global-icon"
-        v-if="isCurrentTab(1) && !isEditDrawingMode"
-        @click="handleBoardDraw"
-      >
+      <div class="draw-global-icon" v-if="isCurrentTab(1) && !isEditDrawingMode" @click="handleBoardDraw">
         <el-icon size="30">
-          <svg
-            xmlns="http://www.w3.org/2000/svg"
-            width="1em"
-            height="1em"
-            viewBox="0 0 24 24"
-          >
-            <path
-              fill="currentColor"
-              d="M2 4.621a.5.5 0 0 1 .854-.353l6.01 6.01c.126.126.17.31.15.487a2 2 0 1 0 1.751-1.751a.586.586 0 0 1-.487-.15l-6.01-6.01A.5.5 0 0 1 4.62 2H11a9 9 0 0 1 8.468 12.054l2.24 2.239a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.415 0l-2.239-2.239A9 9 0 0 1 2 11z"
-            />
+          <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
+            <path fill="currentColor"
+              d="M2 4.621a.5.5 0 0 1 .854-.353l6.01 6.01c.126.126.17.31.15.487a2 2 0 1 0 1.751-1.751a.586.586 0 0 1-.487-.15l-6.01-6.01A.5.5 0 0 1 4.62 2H11a9 9 0 0 1 8.468 12.054l2.24 2.239a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.415 0l-2.239-2.239A9 9 0 0 1 2 11z" />
           </svg>
         </el-icon>
       </div>
@@ -178,16 +139,18 @@ watch(
         if (mapManage && !autoInitPos()) {
           flyUserCenter(mapManage);
         }
-        const points = scenePosTransform(scenes.value);
-        console.log("scenePosTransform", points, scenes.value);
-        board.setData(
-          {
-            points: points,
-            lines: [],
-            polygons: [],
-          },
-          router.currentRoute.value.params.relicsId as string
-        );
+        // const points = scenePosTransform(scenes.value);
+        // console.log("scenePosTransform", points, scenes.value);
+        // board.setData(
+        //   {
+        //     points: points,
+        //     lines: [],
+        //     polygons: [],
+        //   },
+        //   router.currentRoute.value.params.relicsId as string
+        // );
+        initCroodTabdata();
+
         board.polygon().bus.on("clickPoint", (bpoint) => {
           const point =
             bpoint.id &&
@@ -311,26 +274,45 @@ const patchPolyName = (data: DrawingDataType) => {
 
 watch(
   currentTab,
-  (tab) => {
+  (tab, oldTab) => {
     console.log("tab", tab);
     if (tab === 1) {
       initPolyTabData();
     }
+    if (oldTab == 1 && tab === 0) {
+      console.log('1-0')
+      initCroodTabdata();
+    }
   },
   { deep: true }
 );
+const initCroodTabdata = async () => {
+  const points = scenePosTransform(scenes.value);
+  console.log("initCroodTabdata", points, scenes.value);
+  board.setData(
+    {
+      points: points,
+      lines: [],
+      polygons: [],
+    },
+    String(relicsId.value)
+  );
+
+}
 
 const initPolyTabData = async () => {
   try {
     setTimeout(async () => {
       const res = await getDrawingDetailFetch(String(relicsId.value));
-      console.log("res", res.data);
+      const points = scenePosTransform(scenes.value);
+      console.log("res", points, res.data);
       if (res.data) {
         boardData.value = res.data;
+        boardData.value.points = points.concat(res.data.points)
         board.setData(boardData.value, String(relicsId.value));
       }
     }, 500);
-  } catch (error) {}
+  } catch (error) { }
 };
 
 const handlePolysDel = (id: string) => {
@@ -467,7 +449,7 @@ const clearPolys = async () => {
   &.light {
     --color: #fff;
 
-    > div {
+    >div {
       text-shadow: 0 0 2px #000;
     }
   }
@@ -475,7 +457,7 @@ const clearPolys = async () => {
   &.dark {
     --color: #000;
 
-    > div {
+    >div {
       text-shadow: 0 0 2px #fff;
     }
   }